forked from ultrajson/ultrajson
-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
77 lines (67 loc) · 2.03 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
try:
from setuptools import setup, Extension
except ImportError:
from distutils.core import setup, Extension
import os.path
import re
from glob import glob
CLASSIFIERS = list(filter(None, map(str.strip,
"""
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
License :: OSI Approved :: BSD License
Programming Language :: C
Programming Language :: Python :: 2.6
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.2
Programming Language :: Python :: 3.4
""".splitlines())))
dconv_source_files = glob("./deps/double-conversion/double-conversion/*.cc")
dconv_source_files.append("./lib/dconv_wrapper.cc")
module1 = Extension(
'ujson_hpy',
sources = dconv_source_files + [
'./python/ujson.c',
'./python/objToJSON.c',
'./python/JSONtoObj.c',
'./lib/ultrajsonenc.c',
'./lib/ultrajsondec.c'
],
include_dirs = ['./python', './lib', './deps/double-conversion/double-conversion'],
extra_compile_args = ['-D_GNU_SOURCE'],
extra_link_args = ['-lstdc++', '-lm']
)
def get_version():
filename = os.path.join(os.path.dirname(__file__), './python/version.h')
file = None
try:
file = open(filename)
header = file.read()
finally:
if file:
file.close()
m = re.search(r'#define\s+UJSON_VERSION\s+"(\d+\.\d+(?:\.\d+)?)"', header)
assert m, "version.h must contain UJSON_VERSION macro"
return m.group(1)
f = open('README.rst')
try:
README = f.read()
finally:
f.close()
setup(
name = 'ujson-hpy',
setup_requires=['hpy>=0.9.0rc1'],
py_modules=[],
version = get_version(),
description = "Ultra fast JSON encoder and decoder for Python",
long_description = README,
hpy_ext_modules = [module1],
author="Jonas Tarnstrom",
author_email="[email protected]",
download_url="http://github.com/esnme/ultrajson",
license="BSD License",
platforms=['any'],
url="http://www.esn.me",
classifiers=CLASSIFIERS,
)