File: setup.py

package info (click to toggle)
pylsqpack 0.3.23-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,996 kB
  • sloc: ansic: 146,535; perl: 340; python: 198; sh: 53; makefile: 21
file content (45 lines) | stat: -rw-r--r-- 1,177 bytes parent folder | download
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},
)