-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsetup.py
86 lines (72 loc) · 2.35 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
import os
import sys
import re
try:
import setuptools
except ImportError:
pass
from distutils.core import setup, Extension
try:
from Cython.Build import cythonize
import Cython.Compiler.Options as cython_options
cython_options.annotate = True
cython_available = True
except ImportError:
cython_available = False
cython = None
PKG_ROOT = os.path.join('src', 'quicktions')
try:
sys.argv.remove("--with-profile")
except ValueError:
enable_profiling = False
else:
enable_profiling = True
ext_modules = None
try:
sys.argv.remove("--with-cython")
except ValueError:
cythonize = None
else:
if cython_available:
compiler_directives = {}
if enable_profiling:
compiler_directives['profile'] = True
ext_modules = cythonize(os.path.join(PKG_ROOT, '*.pyx'), compiler_directives=compiler_directives)
if ext_modules is None:
ext_modules = [
Extension("quicktions.quicktions", [os.path.join(PKG_ROOT, "quicktions.c")]),
]
with open(os.path.join(PKG_ROOT, 'quicktions.pyx')) as f:
version = re.search("__version__\s*=\s*'([^']+)'", f.read(2048)).group(1)
with open('README.rst') as f:
long_description = ''.join(f.readlines()[3:]).strip()
with open('CHANGES.rst') as f:
long_description += '\n\n' + f.read()
setup(
name="quicktions",
version=version,
description="Fast fractions data type for rational numbers. "
"Cythonized version of 'fractions.Fraction'.",
long_description=long_description,
author="Stefan Behnel",
author_email="[email protected]",
url="https://github.com/scoder/quicktions",
#bugtrack_url="https://github.com/scoder/quicktions/issues",
ext_modules=ext_modules,
package_dir={'':'src'},
packages=['quicktions'],
package_data={'quicktions':['*.pxd']},
include_package_data=True,
classifiers=[
"Development Status :: 6 - Mature",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 3",
"Programming Language :: Cython",
"Topic :: Scientific/Engineering :: Mathematics",
"Topic :: Office/Business :: Financial",
"License :: OSI Approved :: Python Software Foundation License",
],
)