comparison contrib/python-zstandard/setup.py @ 37495:b1fb341d8a61

zstandard: vendor python-zstandard 0.9.0 This was just released. It features a number of goodies. More info at https://gregoryszorc.com/blog/2018/04/09/release-of-python-zstandard-0.9/. The clang-format ignore list was updated to reflect the new source of files. The project contains a vendored copy of zstandard 1.3.4. The old version was 1.1.3. One of the changes between those versions is that zstandard is now dual licensed BSD + GPLv2 and the patent rights grant has been removed. Good riddance. The API should be backwards compatible. So no changes in core should be needed. However, there were a number of changes in the library that we'll want to adapt to. Those will be addressed in subsequent commits. Differential Revision: https://phab.mercurial-scm.org/D3198
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 09 Apr 2018 10:13:29 -0700
parents e0dc40530c5a
children c0081d3e1598
comparison
equal deleted inserted replaced
37494:1ce7a55b09d1 37495:b1fb341d8a61
3 # All rights reserved. 3 # All rights reserved.
4 # 4 #
5 # This software may be modified and distributed under the terms 5 # This software may be modified and distributed under the terms
6 # of the BSD license. See the LICENSE file for details. 6 # of the BSD license. See the LICENSE file for details.
7 7
8 import os
8 import sys 9 import sys
9 from setuptools import setup 10 from setuptools import setup
10 11
11 try: 12 try:
12 import cffi 13 import cffi
14 cffi = None 15 cffi = None
15 16
16 import setup_zstd 17 import setup_zstd
17 18
18 SUPPORT_LEGACY = False 19 SUPPORT_LEGACY = False
20 SYSTEM_ZSTD = False
21 WARNINGS_AS_ERRORS = False
19 22
20 if "--legacy" in sys.argv: 23 if os.environ.get('ZSTD_WARNINGS_AS_ERRORS', ''):
24 WARNINGS_AS_ERRORS = True
25
26 if '--legacy' in sys.argv:
21 SUPPORT_LEGACY = True 27 SUPPORT_LEGACY = True
22 sys.argv.remove("--legacy") 28 sys.argv.remove('--legacy')
29
30 if '--system-zstd' in sys.argv:
31 SYSTEM_ZSTD = True
32 sys.argv.remove('--system-zstd')
33
34 if '--warnings-as-errors' in sys.argv:
35 WARNINGS_AS_ERRORS = True
36 sys.argv.remote('--warning-as-errors')
23 37
24 # Code for obtaining the Extension instance is in its own module to 38 # Code for obtaining the Extension instance is in its own module to
25 # facilitate reuse in other projects. 39 # facilitate reuse in other projects.
26 extensions = [setup_zstd.get_c_extension(SUPPORT_LEGACY, 'zstd')] 40 extensions = [
41 setup_zstd.get_c_extension(name='zstd',
42 support_legacy=SUPPORT_LEGACY,
43 system_zstd=SYSTEM_ZSTD,
44 warnings_as_errors=WARNINGS_AS_ERRORS),
45 ]
27 46
28 install_requires = [] 47 install_requires = []
29 48
30 if cffi: 49 if cffi:
31 import make_cffi 50 import make_cffi
32 extensions.append(make_cffi.ffi.distutils_extension()) 51 extensions.append(make_cffi.ffi.distutils_extension())
33 52
34 # Need change in 1.8 for ffi.from_buffer() behavior. 53 # Need change in 1.10 for ffi.from_buffer() to handle all buffer types
35 install_requires.append('cffi>=1.8') 54 # (like memoryview).
55 # Need feature in 1.11 for ffi.gc() to declare size of objects so we avoid
56 # garbage collection pitfalls.
57 install_requires.append('cffi>=1.11')
36 58
37 version = None 59 version = None
38 60
39 with open('c-ext/python-zstandard.h', 'r') as fh: 61 with open('c-ext/python-zstandard.h', 'r') as fh:
40 for line in fh: 62 for line in fh:
60 classifiers=[ 82 classifiers=[
61 'Development Status :: 4 - Beta', 83 'Development Status :: 4 - Beta',
62 'Intended Audience :: Developers', 84 'Intended Audience :: Developers',
63 'License :: OSI Approved :: BSD License', 85 'License :: OSI Approved :: BSD License',
64 'Programming Language :: C', 86 'Programming Language :: C',
65 'Programming Language :: Python :: 2.6',
66 'Programming Language :: Python :: 2.7', 87 'Programming Language :: Python :: 2.7',
67 'Programming Language :: Python :: 3.3',
68 'Programming Language :: Python :: 3.4', 88 'Programming Language :: Python :: 3.4',
69 'Programming Language :: Python :: 3.5', 89 'Programming Language :: Python :: 3.5',
70 'Programming Language :: Python :: 3.6', 90 'Programming Language :: Python :: 3.6',
71 ], 91 ],
72 keywords='zstandard zstd compression', 92 keywords='zstandard zstd compression',
93 packages=['zstandard'],
73 ext_modules=extensions, 94 ext_modules=extensions,
74 test_suite='tests', 95 test_suite='tests',
75 install_requires=install_requires, 96 install_requires=install_requires,
76 ) 97 )