2 from setuptools
import setup
, Extension
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
:
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."""
28 ********************************************************************************
29 WARNING: Could not build the %s.
30 Pyrsistent will still work but performance may be degraded.
32 ********************************************************************************
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
):
46 build_ext
.build_extension(self
, ext
)
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."))
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/',
61 license_files
=['LICENCE.mit'],
62 py_modules
=['_pyrsistent_version'],
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',
73 tests_require
=['pytest<5', 'hypothesis<5'],
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']},