This repository was archived by the owner on Jan 20, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.py
49 lines (44 loc) · 1.48 KB
/
setup.py
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
46
47
48
49
from __future__ import annotations
import platform
import sys
from setuptools import Extension
from setuptools import setup
if sys.platform != 'win32' and platform.python_implementation() == 'CPython':
try:
import wheel.bdist_wheel
except ImportError:
cmdclass = {}
else:
class bdist_wheel(wheel.bdist_wheel.bdist_wheel):
def finalize_options(self) -> None:
self.py_limited_api = f'cp3{sys.version_info[1]}'
super().finalize_options()
cmdclass = {'bdist_wheel': bdist_wheel}
else:
cmdclass = {}
setup(
ext_modules=[
Extension(
'c_module', ['c_module_proj/c_module.c'],
py_limited_api=True, define_macros=[('Py_LIMITED_API', None)],
),
Extension(
'hello_lib', ['hello_lib_proj/hello_lib.go'],
py_limited_api=True, define_macros=[('Py_LIMITED_API', None)],
),
Extension(
'red', ['red_proj/red.go'],
py_limited_api=True, define_macros=[('Py_LIMITED_API', None)],
),
Extension(
'sum_go', ['sum_go_proj/sum_go.go'],
py_limited_api=True, define_macros=[('Py_LIMITED_API', None)],
),
Extension(
'sum_pure_go', ['sum_pure_go_proj/sum_pure_go.go'],
py_limited_api=True, define_macros=[('Py_LIMITED_API', None)],
),
],
cmdclass=cmdclass,
build_golang={'root': 'github.com/asottile/setuptools-golang-examples'},
)