| 1 |
import sys |
| •2 |
from os import environ |
| 3 |
|
| 4 |
import setuptools |
| 5 |
from wheel.bdist_wheel import bdist_wheel |
| 6 |
|
| 7 |
if sys.platform == "win32": |
| 8 |
extra_compile_args = [] |
| 9 |
libraries = ["libcrypto", "advapi32", "crypt32", "gdi32", "user32", "ws2_32"] |
| 10 |
else: |
| •11 |
extra_compile_args = ["-std=c99", environ.get("LDFLAGS")] |
| 12 |
libraries = ["crypto"] |
| 13 |
|
| 14 |
|
| 15 |
class bdist_wheel_abi3(bdist_wheel): |
| 16 |
def get_tag(self): |
| 17 |
python, abi, plat = super().get_tag() |
| 18 |
|
| 19 |
if python.startswith("cp"): |
| 20 |
return "cp310", "abi3", plat |
| 21 |
|
| 22 |
return python, abi, plat |
| 23 |
|
| 24 |
|
| 25 |
setuptools.setup( |
| 26 |
ext_modules=[ |
| 27 |
setuptools.Extension( |
| 28 |
"aioquic._buffer", |
| 29 |
extra_compile_args=extra_compile_args, |
| 30 |
sources=["src/aioquic/_buffer.c"], |
| 31 |
define_macros=[("Py_LIMITED_API", "0x030A0000")], |
| 32 |
py_limited_api=True, |
| 33 |
), |
| 34 |
setuptools.Extension( |
| 35 |
"aioquic._crypto", |
| 36 |
extra_compile_args=extra_compile_args, |
| 37 |
libraries=libraries, |
| 38 |
sources=["src/aioquic/_crypto.c"], |
| 39 |
define_macros=[("Py_LIMITED_API", "0x030A0000")], |
| 40 |
py_limited_api=True, |
| 41 |
), |
| 42 |
], |
| 43 |
cmdclass={"bdist_wheel": bdist_wheel_abi3}, |
| 44 |
) |