forked from dedupeio/pyhacrf
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
74 lines (60 loc) · 2.42 KB
/
setup.py
File metadata and controls
74 lines (60 loc) · 2.42 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
import sys
from setuptools import setup, Extension
from codecs import open
from os import path
# from Michael Hoffman's http://www.ebi.ac.uk/~hoffman/software/sunflower/
class NumpyExtension(Extension):
def __init__(self, *args, **kwargs):
from numpy import get_include
from numpy.distutils.misc_util import get_info
kwargs.update(get_info('npymath'))
kwargs['include_dirs'] += [get_include()]
Extension.__init__(self, *args, **kwargs)
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
def setup_package():
setup_args = {
"name": 'pyhacrf-datamade',
"version": '0.2.0',
"packages": ['pyhacrf'],
"install_requires": ['numpy>=1.9', 'PyLBFGS>=0.1.3'],
"setup_requires": ['numpy'],
"url": 'https://github.com/dirko/pyhacrf',
"download_url": 'https://github.com/datamade/pyhacrf',
"author": 'Dirko Coetsee',
"author_email": '[email protected]',
'maintainer': 'Forest Gregg',
'maintiner_email': '[email protected]',
"description": 'Hidden alignment conditional random field, a discriminative string edit distance',
"long_description": long_description,
"classifiers": [
'Intended Audience : : Science/Research',
'License : : OSI Approved :: BSD License',
'Operating System : : OS Independent',
'Programming Language : : Python',
'Topic : : Scientific/Engineering',
],
}
def is_special_command():
if len(sys.argv) < 2:
return False
special_list = ('--help-commands',
'egg_info',
'--version',
'clean')
return ('--help' in sys.argv[1:] or
sys.argv[1] in special_list)
if not is_special_command():
setup_args['ext_modules'] = [
NumpyExtension('pyhacrf.algorithms',
['pyhacrf/algorithms.c'],
extra_compile_args = ["-ffast-math", "-O4"]),
NumpyExtension('pyhacrf.adjacent',
['pyhacrf/adjacent.c'],
extra_compile_args = ["-ffast-math", "-O4"]),
]
setup(**setup_args)
if __name__ == "__main__":
setup_package()