From be7652793c8f2e0fbff2d8ec39623367c307b83a Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 21 Mar 2022 18:49:22 +0100 Subject: [PATCH] Fix #15 - install Linux files only when building under Linux Signed-off-by: Martin --- CHANGELOG | 1 + setup.py | 66 +++++++++++++++++++++++++++++++++---------------------- 2 files changed, 41 insertions(+), 26 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 010c5fa..b6ab750 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +2022-03-14: More refactoring [5d434c2] 2022-03-14: Code cleanup / refactor [f4c52e1] 2022-03-14: Adapt calibration file format for OH6022 persistent offset storage [3cac630] 2022-03-08: Improved exception and error handling in LibUsbScope, doc update [dc05698] diff --git a/setup.py b/setup.py index 0776553..248b437 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,24 @@ -__version__ = '2.10.2' +__version__ = '2.10.3' from setuptools import setup import os +import platform + + +# data files +data_files=[ + ( 'share/doc/hantek6022api/', [ 'README.md' ] ), + ( 'share/doc/hantek6022api/', [ 'CHANGELOG' ] ), + ( 'share/doc/hantek6022api/', [ 'LICENSE' ] ), +] + +# add linux specific config files and binaries +if platform.system() == 'Linux': + data_files.append( ( '/etc/udev/rules.d/', [ 'udev/60-hantek6022api.rules' ] ) ) + data_files.append( ( 'bin/', [ 'fx2upload/fx2upload' ] ) ) + +# print( data_files ) setup( name='hantek6022api', @@ -12,35 +28,33 @@ long_description= '''A Python API, tools for calibration, data capturing and visualisation as well as an improved FW for Hantek 6022 USB Oscilloscopes''', - platforms=['all'], + platforms=[ 'all' ], version=__version__, license='GPLv2', url='https://github.com/Ho-Ro/Hantek6022API', - packages=['PyHT6022', 'PyHT6022.Firmware'], - package_data={'PyHT6022': [os.path.join('Firmware', 'DSO6022BE', 'dso6022be-firmware.hex'), - os.path.join('Firmware', 'DSO6022BL', 'dso6022bl-firmware.hex'), - os.path.join('Firmware', 'DSO6021', 'dso6021-firmware.hex'), - os.path.join('Firmware', 'DDS120', 'dds120-firmware.hex'), - os.path.join('Firmware', 'modded', 'mod_fw_01.ihex'), - os.path.join('Firmware', 'modded', 'mod_fw_iso.ihex'), - os.path.join('Firmware', 'stock', 'stock_fw.ihex'),] + packages=[ 'PyHT6022', 'PyHT6022.Firmware' ], + package_data={ 'PyHT6022': [os.path.join( 'Firmware', 'DSO6022BE', 'dso6022be-firmware.hex' ), + os.path.join( 'Firmware', 'DSO6022BL', 'dso6022bl-firmware.hex' ), + os.path.join( 'Firmware', 'DSO6021', 'dso6021-firmware.hex' ), + os.path.join( 'Firmware', 'DDS120', 'dds120-firmware.hex' ), + os.path.join( 'Firmware', 'modded', 'mod_fw_01.ihex' ), + os.path.join( 'Firmware', 'modded', 'mod_fw_iso.ihex' ), + os.path.join( 'Firmware', 'stock', 'stock_fw.ihex' ), ] }, include_package_data=True, + # the required python packages install_requires=['libusb1', 'matplotlib'], - data_files=[ - ("/usr/bin/", ["examples/calibrate_6022.py", - "examples/capture_6022.py", - "examples/plot_from_capture_6022.py", - "examples/fft_from_capture_6022.py", - "examples/fft_ft_from_capture_6022.py", - "examples/set_cal_out_freq_6022.py", - "examples/upload_6022_firmware_from_hex.py", - "examples/upload_6022_firmware.py", - "fx2upload/fx2upload"] - ), - ("/usr/share/doc/hantek6022api/", ["README.md"]), - ("/usr/share/doc/hantek6022api/", ["CHANGELOG"]), - ("/usr/share/doc/hantek6022api/", ["LICENSE"]), - ("/etc/udev/rules.d/", ["udev/60-hantek6022api.rules"]), - ] + # the python scripts will be found via the PATH + scripts=[ + 'examples/calibrate_6022.py', + 'examples/capture_6022.py', + 'examples/plot_from_capture_6022.py', + 'examples/fft_from_capture_6022.py', + 'examples/fft_ft_from_capture_6022.py', + 'examples/set_cal_out_freq_6022.py', + 'examples/upload_6022_firmware_from_hex.py', + 'examples/upload_6022_firmware.py', + ], + # the data_files from above + data_files = data_files )