Skip to content

Commit 049491d

Browse files
committed
Cleanup
1 parent 60dcc1e commit 049491d

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

Tools/jit/_targets.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class _Target(typing.Generic[_S, _R]):
4747
debug: bool = False
4848
verbose: bool = False
4949
known_symbols: dict[str, int] = dataclasses.field(default_factory=dict)
50-
pyconfig: pathlib.Path | None = None
50+
pyconfig_dir: pathlib.Path = pathlib.Path.cwd().resolve()
5151

5252
def _get_nop(self) -> bytes:
5353
if re.fullmatch(r"aarch64-.*", self.triple):
@@ -64,8 +64,7 @@ def _compute_digest(self) -> str:
6464
hasher.update(self.debug.to_bytes())
6565
# These dependencies are also reflected in _JITSources in regen.targets:
6666
hasher.update(PYTHON_EXECUTOR_CASES_C_H.read_bytes())
67-
assert self.pyconfig is not None
68-
hasher.update(self.pyconfig.read_bytes())
67+
hasher.update((self.pyconfig_dir / "pyconfig.h").read_bytes())
6968
for dirpath, _, filenames in sorted(os.walk(TOOLS_JIT)):
7069
for filename in filenames:
7170
hasher.update(pathlib.Path(dirpath, filename).read_bytes())
@@ -120,15 +119,14 @@ async def _compile(
120119
self, opname: str, c: pathlib.Path, tempdir: pathlib.Path
121120
) -> _stencils.StencilGroup:
122121
o = tempdir / f"{opname}.o"
123-
assert self.pyconfig is not None
124122
args = [
125123
f"--target={self.triple}",
126124
"-DPy_BUILD_CORE_MODULE",
127125
"-D_DEBUG" if self.debug else "-DNDEBUG",
128126
f"-D_JIT_OPCODE={opname}",
129127
"-D_PyJIT_ACTIVE",
130128
"-D_Py_JIT",
131-
f"-I{self.pyconfig.parent}",
129+
f"-I{self.pyconfig_dir}",
132130
f"-I{CPYTHON / 'Include'}",
133131
f"-I{CPYTHON / 'Include' / 'internal'}",
134132
f"-I{CPYTHON / 'Include' / 'internal' / 'mimalloc'}",

Tools/jit/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
target.debug = args.debug
4545
target.force = args.force
4646
target.verbose = args.verbose
47-
target.pyconfig = args.pyconfig_dir / "pyconfig.h"
47+
target.pyconfig_dir = args.pyconfig_dir
4848
target.build(
4949
comment=comment,
5050
force=args.force,

configure

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2776,7 +2776,7 @@ AS_VAR_IF([jit_flags],
27762776
[],
27772777
[AS_VAR_APPEND([CFLAGS_NODIST], [" $jit_flags"])
27782778
AS_VAR_SET([REGEN_JIT_COMMAND],
2779-
["\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host}"])
2779+
["\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host} --output-dir . --pyconfig-dir ."])
27802780
AS_VAR_SET([JIT_STENCILS_H], ["jit_stencils.h"])
27812781
AS_VAR_IF([Py_DEBUG],
27822782
[true],

0 commit comments

Comments
 (0)