Bug 1890793: Assert CallArgs::newTarget is not gray. r=spidermonkey-reviewers,sfink...
[gecko.git] / third_party / python / pyrsistent / setup.py
blob931800ff15c6e157ecf190f7b1022b525bbfff5f
1 import os
2 from setuptools import setup, Extension
3 import sys
4 import platform
5 import warnings
6 import codecs
7 from distutils.command.build_ext import build_ext
8 from distutils.errors import CCompilerError
9 from distutils.errors import DistutilsPlatformError, DistutilsExecError
10 from _pyrsistent_version import __version__
12 readme_path = os.path.join(os.path.dirname(__file__), 'README.rst')
13 with codecs.open(readme_path, encoding='utf8') as f:
14 readme = f.read()
16 extensions = []
17 if platform.python_implementation() == 'CPython':
18 extensions = [Extension('pvectorc', sources=['pvectorcmodule.c'])]
20 needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv)
21 pytest_runner = ['pytest-runner'] if needs_pytest else []
24 class custom_build_ext(build_ext):
25 """Allow C extension building to fail."""
27 warning_message = """
28 ********************************************************************************
29 WARNING: Could not build the %s.
30 Pyrsistent will still work but performance may be degraded.
32 ********************************************************************************
33 """
35 def run(self):
36 try:
37 build_ext.run(self)
38 except Exception:
39 e = sys.exc_info()[1]
40 sys.stderr.write('%s\n' % str(e))
41 sys.stderr.write(self.warning_message % ("extension modules", "There was an issue with your platform configuration - see above."))
43 def build_extension(self, ext):
44 name = ext.name
45 try:
46 build_ext.build_extension(self, ext)
47 except Exception:
48 e = sys.exc_info()[1]
49 sys.stderr.write('%s\n' % str(e))
50 sys.stderr.write(self.warning_message % ("%s extension module" % name, "The output above this warning shows how the compilation failed."))
52 setup(
53 name='pyrsistent',
54 version=__version__,
55 description='Persistent/Functional/Immutable data structures',
56 long_description=readme,
57 author='Tobias Gustafsson',
58 author_email='tobias.l.gustafsson@gmail.com',
59 url='http://github.com/tobgu/pyrsistent/',
60 license='MIT',
61 license_files=['LICENCE.mit'],
62 py_modules=['_pyrsistent_version'],
63 classifiers=[
64 'Intended Audience :: Developers',
65 'License :: OSI Approved :: MIT License',
66 'Operating System :: OS Independent',
67 'Programming Language :: Python :: 3.5',
68 'Programming Language :: Python :: 3.6',
69 'Programming Language :: Python :: 3.7',
70 'Programming Language :: Python :: Implementation :: PyPy',
72 test_suite='tests',
73 tests_require=['pytest<5', 'hypothesis<5'],
74 scripts=[],
75 setup_requires=pytest_runner,
76 ext_modules=extensions,
77 cmdclass={'build_ext': custom_build_ext},
78 install_requires=['six'],
79 packages=['pyrsistent'],
80 package_data={'pyrsistent': ['py.typed', '__init__.pyi', 'typing.pyi']},