Skip to content

Commit be76527

Browse files
committed
Fix #15 - install Linux files only when building under Linux
Signed-off-by: Martin <[email protected]>
1 parent 5d434c2 commit be76527

File tree

2 files changed

+41
-26
lines changed

2 files changed

+41
-26
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
2022-03-14: More refactoring [5d434c2]
12
2022-03-14: Code cleanup / refactor [f4c52e1]
23
2022-03-14: Adapt calibration file format for OH6022 persistent offset storage [3cac630]
34
2022-03-08: Improved exception and error handling in LibUsbScope, doc update [dc05698]

setup.py

Lines changed: 40 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
1-
__version__ = '2.10.2'
1+
__version__ = '2.10.3'
22

33

44
from setuptools import setup
55
import os
6+
import platform
7+
8+
9+
# data files
10+
data_files=[
11+
( 'share/doc/hantek6022api/', [ 'README.md' ] ),
12+
( 'share/doc/hantek6022api/', [ 'CHANGELOG' ] ),
13+
( 'share/doc/hantek6022api/', [ 'LICENSE' ] ),
14+
]
15+
16+
# add linux specific config files and binaries
17+
if platform.system() == 'Linux':
18+
data_files.append( ( '/etc/udev/rules.d/', [ 'udev/60-hantek6022api.rules' ] ) )
19+
data_files.append( ( 'bin/', [ 'fx2upload/fx2upload' ] ) )
20+
21+
# print( data_files )
622

723
setup(
824
name='hantek6022api',
@@ -12,35 +28,33 @@
1228
long_description=
1329
'''A Python API, tools for calibration, data capturing and visualisation
1430
as well as an improved FW for Hantek 6022 USB Oscilloscopes''',
15-
platforms=['all'],
31+
platforms=[ 'all' ],
1632
version=__version__,
1733
license='GPLv2',
1834
url='https://github.com/Ho-Ro/Hantek6022API',
19-
packages=['PyHT6022', 'PyHT6022.Firmware'],
20-
package_data={'PyHT6022': [os.path.join('Firmware', 'DSO6022BE', 'dso6022be-firmware.hex'),
21-
os.path.join('Firmware', 'DSO6022BL', 'dso6022bl-firmware.hex'),
22-
os.path.join('Firmware', 'DSO6021', 'dso6021-firmware.hex'),
23-
os.path.join('Firmware', 'DDS120', 'dds120-firmware.hex'),
24-
os.path.join('Firmware', 'modded', 'mod_fw_01.ihex'),
25-
os.path.join('Firmware', 'modded', 'mod_fw_iso.ihex'),
26-
os.path.join('Firmware', 'stock', 'stock_fw.ihex'),]
35+
packages=[ 'PyHT6022', 'PyHT6022.Firmware' ],
36+
package_data={ 'PyHT6022': [os.path.join( 'Firmware', 'DSO6022BE', 'dso6022be-firmware.hex' ),
37+
os.path.join( 'Firmware', 'DSO6022BL', 'dso6022bl-firmware.hex' ),
38+
os.path.join( 'Firmware', 'DSO6021', 'dso6021-firmware.hex' ),
39+
os.path.join( 'Firmware', 'DDS120', 'dds120-firmware.hex' ),
40+
os.path.join( 'Firmware', 'modded', 'mod_fw_01.ihex' ),
41+
os.path.join( 'Firmware', 'modded', 'mod_fw_iso.ihex' ),
42+
os.path.join( 'Firmware', 'stock', 'stock_fw.ihex' ), ]
2743
},
2844
include_package_data=True,
45+
# the required python packages
2946
install_requires=['libusb1', 'matplotlib'],
30-
data_files=[
31-
("/usr/bin/", ["examples/calibrate_6022.py",
32-
"examples/capture_6022.py",
33-
"examples/plot_from_capture_6022.py",
34-
"examples/fft_from_capture_6022.py",
35-
"examples/fft_ft_from_capture_6022.py",
36-
"examples/set_cal_out_freq_6022.py",
37-
"examples/upload_6022_firmware_from_hex.py",
38-
"examples/upload_6022_firmware.py",
39-
"fx2upload/fx2upload"]
40-
),
41-
("/usr/share/doc/hantek6022api/", ["README.md"]),
42-
("/usr/share/doc/hantek6022api/", ["CHANGELOG"]),
43-
("/usr/share/doc/hantek6022api/", ["LICENSE"]),
44-
("/etc/udev/rules.d/", ["udev/60-hantek6022api.rules"]),
45-
]
47+
# the python scripts will be found via the PATH
48+
scripts=[
49+
'examples/calibrate_6022.py',
50+
'examples/capture_6022.py',
51+
'examples/plot_from_capture_6022.py',
52+
'examples/fft_from_capture_6022.py',
53+
'examples/fft_ft_from_capture_6022.py',
54+
'examples/set_cal_out_freq_6022.py',
55+
'examples/upload_6022_firmware_from_hex.py',
56+
'examples/upload_6022_firmware.py',
57+
],
58+
# the data_files from above
59+
data_files = data_files
4660
)

0 commit comments

Comments
 (0)