aboutsummaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-07-09 09:03:36 +0200
committerWojtek Kosior <koszko@koszko.org>2022-07-09 09:03:36 +0200
commite55faf7dd0c13af4c4eaf94ebe0f2ae18799898a (patch)
treefd372e8d5686185ad06675f0d93dbe2c61ddd7dd /setup.py
parentca42184b18f521ac84ed98c371528af4ac2640e3 (diff)
parent9f7f7386c7fe49b249f6dd8c558266ce65e407dd (diff)
downloadimmutables-e55faf7dd0c13af4c4eaf94ebe0f2ae18799898a.tar.gz
immutables-e55faf7dd0c13af4c4eaf94ebe0f2ae18799898a.zip
Update upstream source from tag 'upstream/0.18'
Update to upstream version '0.18' with Debian dir 4633953086f923825337301a18d98b4bc0c0e8b4
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py93
1 files changed, 93 insertions, 0 deletions
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..09b8de4
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,93 @@
+import os
+import platform
+import setuptools
+
+
+# Minimal dependencies required to test immutables.
+TEST_DEPENDENCIES = [
+ # pycodestyle is a dependency of flake8, but it must be frozen because
+ # their combination breaks too often
+ # (example breakage: https://gitlab.com/pycqa/flake8/issues/427)
+ 'flake8~=3.8.4',
+ 'pycodestyle~=2.6.0',
+ 'mypy==0.942',
+ 'pytest~=6.2.4',
+]
+
+EXTRA_DEPENDENCIES = {
+ 'test': TEST_DEPENDENCIES,
+}
+
+CFLAGS = ['-O2']
+if platform.uname().system != 'Windows':
+ CFLAGS.extend(['-std=c99', '-fsigned-char', '-Wall',
+ '-Wsign-compare', '-Wconversion'])
+
+
+with open(os.path.join(
+ os.path.dirname(__file__), 'immutables', '_version.py')) as f:
+ for line in f:
+ if line.startswith('__version__ ='):
+ _, _, version = line.partition('=')
+ VERSION = version.strip(" \n'\"")
+ break
+ else:
+ raise RuntimeError(
+ 'unable to read the version from immutables/_version.py')
+
+
+if platform.python_implementation() == 'CPython':
+ if os.environ.get("DEBUG_IMMUTABLES") == '1':
+ define_macros = []
+ undef_macros = ['NDEBUG']
+ else:
+ define_macros = [('NDEBUG', '1')]
+ undef_macros = []
+
+ ext_modules = [
+ setuptools.Extension(
+ "immutables._map",
+ ["immutables/_map.c"],
+ extra_compile_args=CFLAGS,
+ define_macros=define_macros,
+ undef_macros=undef_macros)
+ ]
+else:
+ ext_modules = []
+
+
+with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as f:
+ readme = f.read()
+
+
+setuptools.setup(
+ name='immutables',
+ version=VERSION,
+ description='Immutable Collections',
+ long_description=readme,
+ python_requires='>=3.6',
+ classifiers=[
+ 'License :: OSI Approved :: Apache Software License',
+ 'Intended Audience :: Developers',
+ 'Programming Language :: Python :: 3 :: Only',
+ 'Programming Language :: Python :: 3.6',
+ 'Programming Language :: Python :: 3.7',
+ 'Programming Language :: Python :: 3.8',
+ 'Programming Language :: Python :: 3.9',
+ 'Programming Language :: Python :: 3.10',
+ 'Operating System :: POSIX',
+ 'Operating System :: MacOS :: MacOS X',
+ 'Operating System :: Microsoft :: Windows',
+ ],
+ author='MagicStack Inc',
+ author_email='hello@magic.io',
+ url='https://github.com/MagicStack/immutables',
+ license='Apache License, Version 2.0',
+ packages=['immutables'],
+ package_data={"immutables": ["py.typed", "*.pyi"]},
+ provides=['immutables'],
+ include_package_data=True,
+ ext_modules=ext_modules,
+ install_requires=['typing-extensions>=3.7.4.3;python_version<"3.8"'],
+ extras_require=EXTRA_DEPENDENCIES,
+)