-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.py
executable file
·160 lines (112 loc) · 3.98 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#input-encoding: latin-1
import distribute_setup
distribute_setup.use_setuptools()
# use autowrap to generate cython and cpp file for wrapping openms:
import autowrap.Main
import glob
pxd_files = glob.glob("pxds/*.pxd")
addons = glob.glob("addons/*.pyx")
converters = glob.glob("converters/*.py")
extra_cimports = ["from libc.stdint cimport *",
"from libc.stddef cimport *",
"from UniqueIdInterface cimport setUniqueId as _setUniqueId",
"cimport numpy as np"]
autowrap_include_dirs = autowrap.Main.run(pxd_files,
addons,
converters,
"pyopenms/pyopenms.pyx",
extra_cimports)
from setuptools import setup, Extension
import os, shutil
import sys
import time
IS_DEBUG = sys.argv[-1] == "develop"
# create version information
ctime = os.stat("pyopenms").st_mtime
ts = time.gmtime(ctime)
timestamp = "%02d-%02d-%4d" % (ts.tm_mday, ts.tm_mon, ts.tm_year)
from version import version
full_version= "%s_%s" % (version, timestamp)
print >> open("pyopenms/version.py", "w"), "version=%r\n" % version
# import config
from env import *
# parse config
if OPEN_MS_CONTRIB_BUILD_DIRS.endswith(";"):
OPEN_MS_CONTRIB_BUILD_DIRS = OPEN_MS_CONTRIB_BUILD_DIRS[:-1]
for OPEN_MS_CONTRIB_BUILD_DIR in OPEN_MS_CONTRIB_BUILD_DIRS.split(";"):
if os.path.exists(OPEN_MS_CONTRIB_BUILD_DIR):
break
j=os.path.join
# package data expected to be installed. on linux the debian package
# contains share/ data and must be intalled to get access to the openms shared
# library.
#
# windows ?
iswin = sys.platform == "win32"
if iswin:
shutil.copy(OPEN_MS_LIB, "pyopenms")
shutil.copy(MSVCRDLL, "pyopenms")
shutil.copy(j(OPEN_MS_CONTRIB_BUILD_DIR, "lib", "xerces-c_3_0.dll"),\
"pyopenms")
libraries=["OpenMSd", "xerces-c_3D", "QtCored4", "gsl_d",
"cblas_d",
]
libraries=["OpenMS", "xerces-c_3", "QtCore4", "gsl",
"cblas",
]
elif sys.platform == "linux2":
# shutil.copy(OPEN_MS_LIB, "pyOpenMS")
libraries=["OpenMS", "xerces-c", "QtCore", "gsl",
"gslcblas",
]
else:
print
print "platform ", sys.platform, "not supported yet"
print
exit()
library_dirs=[ OPEN_MS_BUILD_DIR,
j(OPEN_MS_BUILD_DIR,"lib"),
j(OPEN_MS_CONTRIB_BUILD_DIR,"lib"),
QT_LIBRARY_DIR,
]
import numpy
include_dirs=[
QT_HEADERS_DIR,
QT_QTCORE_INCLUDE_DIR,
j(OPEN_MS_CONTRIB_BUILD_DIR, "include"),
j(OPEN_MS_CONTRIB_BUILD_DIR, "src", "boost_1_42_0", "include", "boost-1_42"),
j(OPEN_MS_BUILD_DIR , "include"),
j(OPEN_MS_SRC , "include"),
j(numpy.core.__path__[0],"include"),
]
ext = Extension(
"pyopenms",
sources = ["pyopenms/pyopenms.cpp"],
language="c++",
library_dirs = library_dirs,
libraries = libraries,
include_dirs = include_dirs + autowrap_include_dirs,
# /EHs is important. It sets _CPPUNWIND which causes boost to
# set BOOST_NO_EXCEPTION in <boost/config/compiler/visualc.hpp>
# such that boost::throw_excption() is declared but not implemented.
# The linker does not like that very much ...
extra_compile_args = iswin and [ "/EHs"] or (IS_DEBUG and ["-g2"] or [])
)
share_data = []
if iswin:
share_data += [MSVCRDLL, "xerces-c_3_0.dll"]
else:
share_data += ["pyopenms/libOpenMS.so" ]
share_data.append("License.txt")
setup(
name = "pyopenms",
packages = ["pyopenms"],
ext_package = "pyopenms",
version = full_version,
url="http://github.com/uweschmitt/pyopenms",
author="Uwe Schmitt",
author_email="[email protected]",
ext_modules = [ext ],
# setup_requires=["autowrap", "cython"],
package_data= { "pyopenms": share_data },
)