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
|
#!/usr/bin/python3
import os
import platform
from setuptools import setup, Extension
use_limited_api = "USE_LIMITED_API" in os.environ
extension_sources = ["cwcwidth/_impl.pyx"]
define_macros = []
if platform.system() == "Windows":
extension_sources.append("cwcwidth/wcwidth.c")
define_macros.append(
("USE_MK_WCWIDTH", None),
)
options = {}
if use_limited_api:
define_macros.append(("Py_LIMITED_API", 0x030B0000)) # 3.11
options["bdist_wheel"] = {"py_limited_api": "cp311"}
ext_modules = [
Extension(
"cwcwidth._impl",
extension_sources,
define_macros=define_macros,
py_limited_api=use_limited_api,
)
]
setup(
ext_modules=ext_modules,
packages=["cwcwidth"],
package_data={
"cwcwidth": ["_impl.pyi", "py.typed"],
},
options=options,
)
|