1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
import os.path
import sys
from os import environ
import setuptools
from wheel.bdist_wheel import bdist_wheel
extra_compile_args = []
include_dirs = [
os.path.join("vendor", "ls-qpack"),
os.path.join("vendor", "ls-qpack", "deps", "xxhash"),
]
if sys.platform == "win32":
include_dirs.append(os.path.join("vendor", "ls-qpack", "wincompat"))
else:
extra_compile_args = ["-std=c99", environ.get("LDFLAGS")]
class bdist_wheel_abi3(bdist_wheel):
def get_tag(self):
python, abi, plat = super().get_tag()
if python.startswith("cp"):
return "cp310", "abi3", plat
return python, abi, plat
setuptools.setup(
ext_modules=[
setuptools.Extension(
"pylsqpack._binding",
define_macros=[("Py_LIMITED_API", "0x030A0000")],
extra_compile_args=extra_compile_args,
include_dirs=include_dirs,
py_limited_api=True,
sources=[
"src/pylsqpack/binding.c",
"vendor/ls-qpack/lsqpack.c",
"vendor/ls-qpack/deps/xxhash/xxhash.c",
],
),
],
cmdclass={"bdist_wheel": bdist_wheel_abi3},
)
|