forked from fastavro/fastavro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
110 lines (98 loc) · 3.52 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
import ast
import os
import re
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from setuptools import Extension
# publish.sh should set this variable to 1.
try:
USE_CYTHON = int(os.getenv('FASTAVRO_USE_CYTHON'))
except TypeError:
USE_CYTHON = False
ext = '.pyx' if USE_CYTHON else '.c'
# See http://setuptools.readthedocs.io/en/latest/setuptools.html\
# #distributing-extensions-compiled-with-pyrex
ext_modules = []
if not hasattr(sys, 'pypy_version_info'):
ext_modules += [
Extension('fastavro._read', ["fastavro/_read" + ext]),
Extension('fastavro._schema', ["fastavro/_schema" + ext]),
Extension('fastavro._six', ["fastavro/_six" + ext]),
Extension('fastavro._write', ["fastavro/_write" + ext]),
Extension('fastavro._validation', ["fastavro/_validation" + ext]),
Extension('fastavro._logical_writers', ["fastavro/_logical_writers" + ext]),
]
def version():
pyfile = 'fastavro/__init__.py'
with open(pyfile) as fp:
data = fp.read()
match = re.search('__version_info__ = (\(.*\))', data)
assert match, 'cannot find version in {}'.format(pyfile)
vinfo = ast.literal_eval(match.group(1))
return '.'.join(str(v) for v in vinfo)
setup_requires = []
if not hasattr(sys, 'pypy_version_info'):
cpython_requires = [
# Setuptools 18.0 properly handles Cython extensions.
'setuptools>=18.0',
]
if USE_CYTHON:
cpython_requires += [
'Cython',
]
setup_requires += cpython_requires
tests_require = ['pytest', 'flake8', 'check-manifest']
if sys.version_info >= (3, 0) and sys.implementation.name != "pypy":
tests_require.append('mypy')
setup(
name='fastavro',
version=version(),
description='Fast read/write of AVRO files',
long_description=open('README.md').read(),
long_description_content_type="text/markdown",
author='Miki Tebeka',
author_email='[email protected]',
license='MIT',
url='https://github.com/fastavro/fastavro',
packages=['fastavro', 'fastavro.io'],
ext_modules=ext_modules,
zip_safe=False,
entry_points={
'console_scripts': [
'fastavro = fastavro.__main__:main',
]
},
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: POSIX :: Linux',
'Operating System :: Microsoft :: Windows',
'Operating System :: MacOS',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Programming Language :: Python',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Software Development :: Libraries',
'Topic :: Scientific/Engineering :: Information Analysis',
],
install_requires=["pytz"],
extras_require={
'codecs': ['python-snappy', 'zstandard', 'lz4', 'backports.lzma'],
'snappy': ['python-snappy'],
'zstandard': ['zstandard'],
'lz4': ['lz4'],
'xz': ['backports.lzma']
},
tests_require=tests_require,
setup_requires=setup_requires
)