1##############################################################################
2#
3# Copyright (c) 2013 Zope Foundation and Contributors.
4# All Rights Reserved.
5#
6# This software is subject to the provisions of the Zope Public License,
7# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
8# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
9# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
10# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
11# FOR A PARTICULAR PURPOSE.
12#
13##############################################################################
14"""Setup"""
15import os
16import platform
17import sys
18
19from setuptools import Extension, find_packages, setup
20
21here = os.path.abspath(os.path.dirname(__file__))
22
23
24def read(fname):
25    with open(os.path.join(here, fname)) as f:
26        return f.read()
27
28
29README = read('README.rst') + '\n\n' + read('CHANGES.rst')
30
31if sys.version_info[:1] < (3,):
32    EXT = 'src/zodbpickle/_pickle_27.c'
33else:
34    EXT = 'src/zodbpickle/_pickle_33.c'
35
36# PyPy and jython won't build the extension.
37py_impl = getattr(platform, 'python_implementation', lambda: None)
38is_pypy = py_impl() == 'PyPy'
39is_jython = py_impl() == 'Jython'
40is_pure = int(os.environ.get('PURE_PYTHON', '0'))
41if is_pypy or is_jython:
42    ext_modules = []
43else:
44    ext_modules = [Extension(name='zodbpickle._pickle',
45                             sources=[EXT])]
46
47
48setup(
49    name='zodbpickle',
50    version='2.2.0',
51    description='Fork of Python 2 and 3 pickle module.',
52    author='Python and Zope Foundation',
53    author_email='zodb-dev@zope.org',
54    url='https://github.com/zopefoundation/zodbpickle',
55    license='PSFL 2 and ZPL 2.1',
56    long_description=README,
57    classifiers=[
58        'Development Status :: 4 - Beta',
59        'License :: OSI Approved :: Zope Public License',
60        'License :: OSI Approved :: Python Software Foundation License',
61        'Programming Language :: Python',
62        'Programming Language :: Python :: 2',
63        'Programming Language :: Python :: 2.7',
64        'Programming Language :: Python :: 3',
65        'Programming Language :: Python :: 3.5',
66        'Programming Language :: Python :: 3.6',
67        'Programming Language :: Python :: 3.7',
68        'Programming Language :: Python :: 3.8',
69        'Programming Language :: Python :: 3.9',
70        'Programming Language :: Python :: 3.10',
71        'Programming Language :: Python :: Implementation :: CPython',
72        'Programming Language :: Python :: Implementation :: PyPy',
73        'Programming Language :: Python :: Implementation :: Jython',
74        'Framework :: ZODB',
75        'Topic :: Database',
76        'Topic :: Software Development :: Libraries :: Python Modules',
77        'Operating System :: Microsoft :: Windows',
78        'Operating System :: Unix',
79        'Operating System :: MacOS :: MacOS X',
80    ],
81    keywords='zodb pickle',
82    platforms=['any'],
83    packages=find_packages('src'),
84    package_dir={'': 'src'},
85    ext_modules=ext_modules,
86    extras_require={
87        'test': ['zope.testrunner'],
88    },
89    test_suite='zodbpickle.tests.test_pickle.test_suite',
90    install_requires=[
91        'setuptools',
92    ],
93    include_package_data=True,
94    zip_safe=False,
95)
96