forked from eriknw/cytoolz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
110 lines (98 loc) · 3.95 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
""" Build ``cytoolz`` with or without Cython.
Deployed versions of CyToolz do not rely on Cython by default even if the
user has Cython installed. A C compiler is used to compile the distributed
*.c files instead.
Pass "--cython" or "--with-cython" as a command line argument to setup.py
to build the project using Cython.
Pass "--no-cython" or "--without-cython" to disable usage of Cython.
For convenience, developmental versions (with 'dev' in the version number)
automatically use Cython unless disabled via a command line argument.
"""
import os.path
import sys
from distutils.core import setup
from distutils.extension import Extension
info = {}
filename = os.path.join('cytoolz', '_version.py')
exec(compile(open(filename, "rb").read(), filename, 'exec'), info)
VERSION = info['__version__']
try:
from Cython.Distutils import build_ext
has_cython = True
except ImportError:
has_cython = False
is_dev = 'dev' in VERSION
use_cython = is_dev or '--cython' in sys.argv or '--with-cython' in sys.argv
if '--no-cython' in sys.argv:
use_cython = False
sys.argv.remove('--no-cython')
if '--without-cython' in sys.argv:
use_cython = False
sys.argv.remove('--without-cython')
if '--cython' in sys.argv:
sys.argv.remove('--cython')
if '--with-cython' in sys.argv:
sys.argv.remove('--with-cython')
if use_cython and not has_cython:
if is_dev:
raise RuntimeError('Cython required to build dev version of cytoolz.')
print('WARNING: Cython not installed. Building without Cython.')
use_cython = False
if use_cython:
suffix = '.pyx'
cmdclass = {'build_ext': build_ext}
else:
suffix = '.c'
cmdclass = {}
ext_modules = []
for modname in ['dicttoolz', 'functoolz', 'itertoolz',
'curried_exceptions', 'recipes']:
ext_modules.append(Extension('cytoolz.' + modname,
['cytoolz/' + modname + suffix]))
if __name__ == '__main__':
setup(
name='cytoolz',
version=VERSION,
description=('Cython implementation of Toolz: '
'High performance functional utilities'),
cmdclass=cmdclass,
ext_modules=ext_modules,
long_description=(open('README.rst').read()
if os.path.exists('README.rst')
else ''),
url='https://github.com/pytoolz/cytoolz',
author='https://raw.github.com/pytoolz/cytoolz/master/AUTHORS.md',
author_email='[email protected]',
maintainer='Erik Welch',
maintainer_email='[email protected]',
license = 'BSD',
packages=['cytoolz'],
package_data={'cytoolz': ['*.pxd']},
# include_package_data = True,
keywords=('functional utility itertools functools iterator generator '
'curry memoize lazy streaming bigdata cython toolz cytoolz'),
classifiers = [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Cython',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
# 'Programming Language :: Python :: 3.4',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Information Analysis',
'Topic :: Software Development',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Utilities',
],
# zip_safe=False
)