forked from DNA-and-Natural-Algorithms-Group/xgrow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
69 lines (56 loc) · 1.89 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env python
from setuptools import setup, find_packages
from distutils.command.build import build
from setuptools.command.develop import develop
BUILD_STRING = "{} -Wall -Wno-unused-result -g -O2 src/xgrow.c src/grow.c -o xgrow/_xgrow -lm {}"
def find_x11():
import os
if 'X11_FLAGS' in os.environ:
x11s = os.environ['X11_FLAGS']
else:
x11f = []
includes = ['/usr/include/X11','/opt/X11/include']
for x in includes:
#if x is None:
# raise Exception("Can't find an X11 include dir.")
if os.path.exists(x):
x11f.append("-I{}".format(x))
break
libs = ['/usr/lib/X11','/opt/X11/lib','/usr/lib64','/usr/lib']
for x in libs:
#if x is None:
# raise Exception("Can't find an X11 lib dir.")
if os.path.exists(x):
x11f.append("-L{}".format(x))
break
x11f.append('-lX11')
x11s = " ".join(x11f)
if 'CC' in os.environ:
cc = os.environ['CC']
else:
cc = 'cc'
return (cc,x11s)
class build_xgrow(build):
def run(self):
import os
os.system(BUILD_STRING.format(*find_x11()))
build.run(self)
class develop_xgrow(develop):
def run(self):
import os
os.system(BUILD_STRING.format(*find_x11()))
develop.run(self)
setup(
name = "xgrow",
version = "20181022.dev0",
packages = ['xgrow'],
install_requires = [ "pyyaml" ],
include_package_data=True,
package_data= {'xgrow': ['_xgrow']},
cmdclass={'build': build_xgrow, 'develop': develop_xgrow},
entry_points={ 'console_scripts': [
'xgrow = xgrow._script_xgrow:main']},
author = "Constantine Evans et al (this version)",
author_email = "cgevans@evans.foundation",
description = "Xgrow in pythonic form"
)