|
1 #!/usr/bin/env python |
|
2 # Copyright (c) 2016-present, Gregory Szorc |
|
3 # All rights reserved. |
|
4 # |
|
5 # This software may be modified and distributed under the terms |
|
6 # of the BSD license. See the LICENSE file for details. |
|
7 |
|
8 from setuptools import setup |
|
9 |
|
10 try: |
|
11 import cffi |
|
12 except ImportError: |
|
13 cffi = None |
|
14 |
|
15 import setup_zstd |
|
16 |
|
17 # Code for obtaining the Extension instance is in its own module to |
|
18 # facilitate reuse in other projects. |
|
19 extensions = [setup_zstd.get_c_extension()] |
|
20 |
|
21 if cffi: |
|
22 import make_cffi |
|
23 extensions.append(make_cffi.ffi.distutils_extension()) |
|
24 |
|
25 version = None |
|
26 |
|
27 with open('c-ext/python-zstandard.h', 'r') as fh: |
|
28 for line in fh: |
|
29 if not line.startswith('#define PYTHON_ZSTANDARD_VERSION'): |
|
30 continue |
|
31 |
|
32 version = line.split()[2][1:-1] |
|
33 break |
|
34 |
|
35 if not version: |
|
36 raise Exception('could not resolve package version; ' |
|
37 'this should never happen') |
|
38 |
|
39 setup( |
|
40 name='zstandard', |
|
41 version=version, |
|
42 description='Zstandard bindings for Python', |
|
43 long_description=open('README.rst', 'r').read(), |
|
44 url='https://github.com/indygreg/python-zstandard', |
|
45 author='Gregory Szorc', |
|
46 author_email='gregory.szorc@gmail.com', |
|
47 license='BSD', |
|
48 classifiers=[ |
|
49 'Development Status :: 4 - Beta', |
|
50 'Intended Audience :: Developers', |
|
51 'License :: OSI Approved :: BSD License', |
|
52 'Programming Language :: C', |
|
53 'Programming Language :: Python :: 2.6', |
|
54 'Programming Language :: Python :: 2.7', |
|
55 'Programming Language :: Python :: 3.3', |
|
56 'Programming Language :: Python :: 3.4', |
|
57 'Programming Language :: Python :: 3.5', |
|
58 ], |
|
59 keywords='zstandard zstd compression', |
|
60 ext_modules=extensions, |
|
61 test_suite='tests', |
|
62 ) |