-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathsetup.py
More file actions
78 lines (71 loc) · 3.19 KB
/
setup.py
File metadata and controls
78 lines (71 loc) · 3.19 KB
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
from setuptools import setup, Extension, find_packages
#############################################################################
### check for Python.h
#############################################################################
from distutils.command.config import config as _config
# a faux config command that checks for the Python.h header file
class config(_config):
def run(self):
self.check_python_dev()
_config.run(self)
def check_python_dev(self):
from distutils import sysconfig
ok = self.check_header('Python.h',include_dirs=[sysconfig.get_python_inc()])
if not ok:
from distutils.errors import DistutilsPlatformError
errmsg = ("The compiler cannot find the 'Python.h' header file.\n"
"Please check your configuration to see if you have python-dev installed.")
raise DistutilsPlatformError(errmsg)
# a faux build_ext command that calls the faux config command
from distutils.command.build_ext import build_ext as _build_ext
class build_ext(_build_ext):
def run(self):
self.run_command('config')
_build_ext.run(self)
#############################################################################
### define the C extension for the original mfinder code
#############################################################################
mfinder = Extension('_mfinder',
sources=['/'.join(['pymfinder','mfinder',f]) \
for f in ['clustering.c',
'globals.c',
'grassberger.c',
'hash.c',
'list.c',
'mat.c',
'metropolis.c',
'motif_ids.c',
'output.c',
'permutation.c',
'prob.c',
'random.c',
'results.c',
'role.c',
'stubs.c',
'switches.c',
'wrapper.c',
#'mfinder.i', # not required unless the user modifies the swig interface
'mfinder_wrap.c', # preferred since the user does not need to use swig directly
]
],
define_macros=[('UNIX', None),],
extra_compile_args = ["-O3",],
)
#############################################################################
#### the pymfinder setup
#############################################################################
setup(
name = "pymfinder",
version = "1.0",
description = "Python wrapper for mfinder 1.2",
author = "Daniel B. Stouffer",
author_email = "daniel.stouffer@canterbury.ac.nz",
url = 'http://github.com/stoufferlab/pymfinder',
packages = find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
ext_package = 'pymfinder.mfinder',
ext_modules = [mfinder,],
cmdclass={'build_ext': build_ext,
'config': config,
},
test_suite = 'tests.test_pymfinder',
)