Skip to content

Commit 72ffe7d

Browse files
committed
Improved binaries installation.
1 parent 3a06e42 commit 72ffe7d

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

setup.py

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,36 @@
11
#!/usr/bin/python3
22

3-
import platform
3+
import sys
44
try:
55
from setuptools import setup
66
except ImportError:
77
import ez_setup
88
ez_setup.use_setuptools()
99
from setuptools import setup
1010

11-
if platform.system() == "Linux":
12-
BIN_DIR = "bins/linux"
13-
elif platform.system() == "Darwin":
14-
BIN_DIR = "bins/osx"
1511

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+
1834

1935
setup(
2036
name="structure_threader",
@@ -39,7 +55,7 @@
3955
"Natural Language :: English",
4056
"Operating System:: POSIX:: Linux",
4157
"Topic :: Scientific/Engineering :: Bio-Informatics"],
42-
data_files=[('bin', [FASTSTRUCTURE_BIN, STRUCTURE_BIN])],
58+
data_files=DATA_FILES,
4359
entry_points={
4460
"console_scripts": [
4561
"structure_threader = structure_threader.structure_threader:main",

0 commit comments

Comments
 (0)