diff contrib/python-zstandard/setup.py @ 43994:de7838053207

zstandard: vendor python-zstandard 0.13.0 Version 0.13.0 of the package was just released. It contains an upgraded zstd C library which can result in some performance wins, official support for Python 3.8, and a blackened code base. There were no meaningful code or functionality changes in this release of python-zstandard: just reformatting and an upgraded zstd library version. So the diff seems much larger than what it is. Files were added without modifications. The clang-format-ignorelist file was updated to reflect a new header file in the zstd distribution. # no-check-commit because 3rd party code has different style guidelines Differential Revision: https://phab.mercurial-scm.org/D7770
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 28 Dec 2019 09:55:45 -0800
parents 69de49c4e39c
children 5e84a96d865b
line wrap: on
line diff
--- a/contrib/python-zstandard/setup.py	Fri Dec 27 18:54:57 2019 -0500
+++ b/contrib/python-zstandard/setup.py	Sat Dec 28 09:55:45 2019 -0800
@@ -16,7 +16,7 @@
 # (like memoryview).
 # Need feature in 1.11 for ffi.gc() to declare size of objects so we avoid
 # garbage collection pitfalls.
-MINIMUM_CFFI_VERSION = '1.11'
+MINIMUM_CFFI_VERSION = "1.11"
 
 try:
     import cffi
@@ -26,9 +26,11 @@
     # out the CFFI version here and reject CFFI if it is too old.
     cffi_version = LooseVersion(cffi.__version__)
     if cffi_version < LooseVersion(MINIMUM_CFFI_VERSION):
-        print('CFFI 1.11 or newer required (%s found); '
-              'not building CFFI backend' % cffi_version,
-              file=sys.stderr)
+        print(
+            "CFFI 1.11 or newer required (%s found); "
+            "not building CFFI backend" % cffi_version,
+            file=sys.stderr,
+        )
         cffi = None
 
 except ImportError:
@@ -40,73 +42,77 @@
 SYSTEM_ZSTD = False
 WARNINGS_AS_ERRORS = False
 
-if os.environ.get('ZSTD_WARNINGS_AS_ERRORS', ''):
+if os.environ.get("ZSTD_WARNINGS_AS_ERRORS", ""):
     WARNINGS_AS_ERRORS = True
 
-if '--legacy' in sys.argv:
+if "--legacy" in sys.argv:
     SUPPORT_LEGACY = True
-    sys.argv.remove('--legacy')
+    sys.argv.remove("--legacy")
 
-if '--system-zstd' in sys.argv:
+if "--system-zstd" in sys.argv:
     SYSTEM_ZSTD = True
-    sys.argv.remove('--system-zstd')
+    sys.argv.remove("--system-zstd")
 
-if '--warnings-as-errors' in sys.argv:
+if "--warnings-as-errors" in sys.argv:
     WARNINGS_AS_ERRORS = True
-    sys.argv.remove('--warning-as-errors')
+    sys.argv.remove("--warning-as-errors")
 
 # Code for obtaining the Extension instance is in its own module to
 # facilitate reuse in other projects.
 extensions = [
-    setup_zstd.get_c_extension(name='zstd',
-                               support_legacy=SUPPORT_LEGACY,
-                               system_zstd=SYSTEM_ZSTD,
-                               warnings_as_errors=WARNINGS_AS_ERRORS),
+    setup_zstd.get_c_extension(
+        name="zstd",
+        support_legacy=SUPPORT_LEGACY,
+        system_zstd=SYSTEM_ZSTD,
+        warnings_as_errors=WARNINGS_AS_ERRORS,
+    ),
 ]
 
 install_requires = []
 
 if cffi:
     import make_cffi
+
     extensions.append(make_cffi.ffi.distutils_extension())
-    install_requires.append('cffi>=%s' % MINIMUM_CFFI_VERSION)
+    install_requires.append("cffi>=%s" % MINIMUM_CFFI_VERSION)
 
 version = None
 
-with open('c-ext/python-zstandard.h', 'r') as fh:
+with open("c-ext/python-zstandard.h", "r") as fh:
     for line in fh:
-        if not line.startswith('#define PYTHON_ZSTANDARD_VERSION'):
+        if not line.startswith("#define PYTHON_ZSTANDARD_VERSION"):
             continue
 
         version = line.split()[2][1:-1]
         break
 
 if not version:
-    raise Exception('could not resolve package version; '
-                    'this should never happen')
+    raise Exception("could not resolve package version; " "this should never happen")
 
 setup(
-    name='zstandard',
+    name="zstandard",
     version=version,
-    description='Zstandard bindings for Python',
-    long_description=open('README.rst', 'r').read(),
-    url='https://github.com/indygreg/python-zstandard',
-    author='Gregory Szorc',
-    author_email='gregory.szorc@gmail.com',
-    license='BSD',
+    description="Zstandard bindings for Python",
+    long_description=open("README.rst", "r").read(),
+    url="https://github.com/indygreg/python-zstandard",
+    author="Gregory Szorc",
+    author_email="gregory.szorc@gmail.com",
+    license="BSD",
     classifiers=[
-        'Development Status :: 4 - Beta',
-        'Intended Audience :: Developers',
-        'License :: OSI Approved :: BSD License',
-        'Programming Language :: C',
-        'Programming Language :: Python :: 2.7',
-        'Programming Language :: Python :: 3.5',
-        'Programming Language :: Python :: 3.6',
-        'Programming Language :: Python :: 3.7',
+        "Development Status :: 4 - Beta",
+        "Intended Audience :: Developers",
+        "License :: OSI Approved :: BSD License",
+        "Programming Language :: C",
+        "Programming Language :: Python :: 2.7",
+        "Programming Language :: Python :: 3.5",
+        "Programming Language :: Python :: 3.6",
+        "Programming Language :: Python :: 3.7",
+        "Programming Language :: Python :: 3.8",
     ],
-    keywords='zstandard zstd compression',
-    packages=['zstandard'],
+    keywords="zstandard zstd compression",
+    packages=["zstandard"],
     ext_modules=extensions,
-    test_suite='tests',
+    test_suite="tests",
     install_requires=install_requires,
+    tests_require=["hypothesis"],
 )