summaryrefslogtreecommitdiffstats
path: root/third_party/python/multidict/setup.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /third_party/python/multidict/setup.py
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/python/multidict/setup.py')
-rw-r--r--third_party/python/multidict/setup.py96
1 files changed, 96 insertions, 0 deletions
diff --git a/third_party/python/multidict/setup.py b/third_party/python/multidict/setup.py
new file mode 100644
index 0000000000..044f1d72ed
--- /dev/null
+++ b/third_party/python/multidict/setup.py
@@ -0,0 +1,96 @@
+import codecs
+import os
+import platform
+import re
+import sys
+
+from setuptools import Extension, setup
+
+NO_EXTENSIONS = bool(os.environ.get("MULTIDICT_NO_EXTENSIONS"))
+
+if sys.implementation.name != "cpython":
+ NO_EXTENSIONS = True
+
+CFLAGS = ["-O2"]
+# CFLAGS = ['-g']
+if platform.system() != "Windows":
+ CFLAGS.extend(
+ [
+ "-std=c99",
+ "-Wall",
+ "-Wsign-compare",
+ "-Wconversion",
+ "-fno-strict-aliasing",
+ "-pedantic",
+ ]
+ )
+
+extensions = [
+ Extension(
+ "multidict._multidict",
+ ["multidict/_multidict.c"],
+ extra_compile_args=CFLAGS,
+ ),
+]
+
+
+with codecs.open(
+ os.path.join(
+ os.path.abspath(os.path.dirname(__file__)), "multidict", "__init__.py"
+ ),
+ "r",
+ "latin1",
+) as fp:
+ try:
+ version = re.findall(r'^__version__ = "([^"]+)"\r?$', fp.read(), re.M)[0]
+ except IndexError:
+ raise RuntimeError("Unable to determine version.")
+
+
+def read(f):
+ return open(os.path.join(os.path.dirname(__file__), f)).read().strip()
+
+
+args = dict(
+ name="multidict",
+ version=version,
+ description=("multidict implementation"),
+ long_description=read("README.rst"),
+ classifiers=[
+ "License :: OSI Approved :: Apache Software License",
+ "Intended Audience :: Developers",
+ "Programming Language :: Python",
+ "Programming Language :: Python :: 3",
+ "Programming Language :: Python :: 3.6",
+ "Programming Language :: Python :: 3.7",
+ "Programming Language :: Python :: 3.8",
+ "Programming Language :: Python :: 3.9",
+ "Development Status :: 5 - Production/Stable",
+ ],
+ author="Andrew Svetlov",
+ author_email="andrew.svetlov@gmail.com",
+ url="https://github.com/aio-libs/multidict",
+ project_urls={
+ "Chat: Gitter": "https://gitter.im/aio-libs/Lobby",
+ "CI: Azure Pipelines": "https://dev.azure.com/aio-libs/multidict/_build",
+ "Coverage: codecov": "https://codecov.io/github/aio-libs/multidict",
+ "Docs: RTD": "https://multidict.readthedocs.io",
+ "GitHub: issues": "https://github.com/aio-libs/multidict/issues",
+ "GitHub: repo": "https://github.com/aio-libs/multidict",
+ },
+ license="Apache 2",
+ packages=["multidict"],
+ python_requires=">=3.6",
+ include_package_data=True,
+)
+
+if not NO_EXTENSIONS:
+ print("*********************")
+ print("* Accelerated build *")
+ print("*********************")
+ setup(ext_modules=extensions, **args)
+else:
+ print("*********************")
+ print("* Pure Python build *")
+ print("*********************")
+ setup(**args)