|
| 1 | +From 5bb9be38eae4afe6246691a7affe0c7681f45ca2 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Geoffrey Thomas < [email protected]> |
| 3 | +Date: Mon, 6 Oct 2025 18:07:47 -0400 |
| 4 | +Subject: [PATCH 1/1] Makefile: Generate relative paths for build-details.json |
| 5 | + |
| 6 | +--- |
| 7 | + Makefile.pre.in | 2 +- |
| 8 | + Tools/build/generate-build-details.py | 5 ++++- |
| 9 | + 2 files changed, 5 insertions(+), 2 deletions(-) |
| 10 | + |
| 11 | +diff --git a/Makefile.pre.in b/Makefile.pre.in |
| 12 | +index 764eef5be3e..4dbbf8ad8bc 100644 |
| 13 | +--- a/Makefile.pre.in |
| 14 | ++++ b/Makefile.pre.in |
| 15 | +@@ -1004,7 +1004,7 @@ pybuilddir.txt: $(PYTHON_FOR_BUILD_DEPS) |
| 16 | + fi |
| 17 | + |
| 18 | + build-details.json: pybuilddir.txt |
| 19 | +- $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/Tools/build/generate-build-details.py `cat pybuilddir.txt`/build-details.json |
| 20 | ++ $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/Tools/build/generate-build-details.py --relative-paths --config-file-path $(LIBDEST)/build-details.json `cat pybuilddir.txt`/build-details.json |
| 21 | + |
| 22 | + # Build static library |
| 23 | + $(LIBRARY): $(LIBRARY_OBJS) |
| 24 | +diff --git a/Tools/build/generate-build-details.py b/Tools/build/generate-build-details.py |
| 25 | +index ed9ab2844d2..8d086ce3b32 100644 |
| 26 | +--- a/Tools/build/generate-build-details.py |
| 27 | ++++ b/Tools/build/generate-build-details.py |
| 28 | +@@ -131,11 +131,12 @@ def generate_data(schema_version: str) -> collections.defaultdict[str, Any]: |
| 29 | + |
| 30 | + |
| 31 | + def make_paths_relative(data: dict[str, Any], config_path: str | None = None) -> None: |
| 32 | ++ base_prefix = data['base_prefix'] |
| 33 | ++ |
| 34 | + # Make base_prefix relative to the config_path directory |
| 35 | + if config_path: |
| 36 | + data['base_prefix'] = relative_path(data['base_prefix'], |
| 37 | + os.path.dirname(config_path)) |
| 38 | +- base_prefix = data['base_prefix'] |
| 39 | + |
| 40 | + # Update path values to make them relative to base_prefix |
| 41 | + PATH_KEYS = ( |
| 42 | +@@ -203,6 +204,8 @@ def main() -> None: |
| 43 | + if args.relative_paths: |
| 44 | + make_paths_relative(data, args.config_file_path) |
| 45 | + |
| 46 | ++ print(f"generate-build-details debug: {sysconfig=} {sysconfig.get_platform()=}", file=sys.stderr) |
| 47 | ++ |
| 48 | + json_output = json.dumps(data, indent=2) |
| 49 | + with open(args.location, 'w', encoding='utf-8') as f: |
| 50 | + f.write(json_output) |
| 51 | +-- |
| 52 | +2.39.5 (Apple Git-154) |
| 53 | + |
0 commit comments