Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
Latest commit
96 lines (83 loc) · 2.43 KB
/
Copy pathsetup.py
File metadata and controls
96 lines (83 loc) · 2.43 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Build the CPython private remote-debugging module from version-matched sources.
# Project metadata and package discovery live in pyproject.toml.
from __future__ importannotations
importos
importsys
importsysconfig
frompathlibimportPath
fromsetuptoolsimportExtension, setup
ROOT=Path(__file__).parent.resolve()
NATIVE_DIR=ROOT/"_remote_debugging"
SOURCES_315= [
"module.c",
"gc_stats.c",
"object_reading.c",
"code_objects.c",
"frames.c",
"frame_cache.c",
"threads.c",
"asyncio.c",
"binary_io_writer.c",
"binary_io_reader.c",
"subprocess.c",
"interpreters.c",
]
HEADERS_315= [
"_remote_debugging.h",
"binary_io.h",
"debug_offsets_validation.h",
"gc_stats.h",
"remote_debug.h",
"clinic/module.c.h",
]
ifsys.version_info[:2] == (3, 14):
sources= ["remote_debugging_314.c"]
headers= [
"remote_debug_314.h",
"clinic/_remote_debugging_module_314.c.h",
]
elifsys.version_info[:2] == (3, 15):
sources=SOURCES_315
headers=HEADERS_315
else:
raiseRuntimeError(
"python-profiling supports CPython 3.14 and 3.15 only; "
f"found {sys.version_info.major}.{sys.version_info.minor}"
)
include_dirs= [
str(NATIVE_DIR),
str(Path(sysconfig.get_path("include")) /"internal"),
]
define_macros= [("Py_BUILD_CORE_MODULE", "1")]
libraries= []
library_dirs= []
extra_compile_args= []
ifos.name=="nt":
ifsys.version_info[:2] >= (3, 15):
libraries.append("ntdll")
extra_compile_args.extend(["/std:c11", "/utf-8"])
else:
extra_compile_args.append("-std=c11")
# Zstandard is used only by the 3.15 binary profile implementation.
if (
sys.version_info[:2] >= (3, 15)
andos.environ.get("PYTHON_PROFILING_WITH_ZSTD") =="1"
):
define_macros.append(("HAVE_ZSTD", "1"))
libraries.append("zstd")
ifvalue:=os.environ.get("PYTHON_PROFILING_ZSTD_INCLUDE"):
include_dirs.append(value)
ifvalue:=os.environ.get("PYTHON_PROFILING_ZSTD_LIB"):
library_dirs.append(value)
extension=Extension(
"_remote_debugging",
sources=[f"_remote_debugging/{source}"forsourceinsources],
depends=[f"_remote_debugging/{header}"forheaderinheaders],
include_dirs=include_dirs,
define_macros=define_macros,
libraries=libraries,
library_dirs=library_dirs,
extra_compile_args=extra_compile_args,
py_limited_api=False,
)
setup(ext_modules=[extension])