|
1 | 1 | #!/usr/bin/python3 |
2 | 2 |
|
3 | | -import platform |
| 3 | +import sys |
4 | 4 | try: |
5 | 5 | from setuptools import setup |
6 | 6 | except ImportError: |
7 | 7 | import ez_setup |
8 | 8 | ez_setup.use_setuptools() |
9 | 9 | from setuptools import setup |
10 | 10 |
|
11 | | -if platform.system() == "Linux": |
12 | | - BIN_DIR = "bins/linux" |
13 | | -elif platform.system() == "Darwin": |
14 | | - BIN_DIR = "bins/osx" |
15 | 11 |
|
16 | | -STRUCTURE_BIN = BIN_DIR + "/structure" |
17 | | -FASTSTRUCTURE_BIN = BIN_DIR + "/fastStructure" |
| 12 | +def platform_detection(install_binaries=True): |
| 13 | + """ |
| 14 | + Detect the platform and adapt the binaries location. |
| 15 | + """ |
| 16 | + if install_binaries is True: |
| 17 | + if sys.platform == "linux": |
| 18 | + bin_dir = "bins/linux" |
| 19 | + elif sys.platform == "darwin": |
| 20 | + bin_dir = "bins/osx" |
| 21 | + else: |
| 22 | + return None |
| 23 | + else: |
| 24 | + return None |
| 25 | + |
| 26 | + structure_bin = bin_dir + "/structure" |
| 27 | + faststructure_bin = bin_dir + "/fastStructure" |
| 28 | + |
| 29 | + return [('bin', [faststructure_bin, structure_bin])] |
| 30 | + |
| 31 | + |
| 32 | +DATA_FILES = platform_detection() |
| 33 | + |
18 | 34 |
|
19 | 35 | setup( |
20 | 36 | name="structure_threader", |
|
39 | 55 | "Natural Language :: English", |
40 | 56 | "Operating System:: POSIX:: Linux", |
41 | 57 | "Topic :: Scientific/Engineering :: Bio-Informatics"], |
42 | | - data_files=[('bin', [FASTSTRUCTURE_BIN, STRUCTURE_BIN])], |
| 58 | + data_files=DATA_FILES, |
43 | 59 | entry_points={ |
44 | 60 | "console_scripts": [ |
45 | 61 | "structure_threader = structure_threader.structure_threader:main", |
|
0 commit comments