Skip to content

Commit f0aba43

Browse files
itamaroclaude
andcommitted
Take the installed location from sysconfig, not the Makefile
`make install prefix=...` (which the Android build uses) changes `$(LIBDEST)` but not the prefix that `sysconfig` reports, so `base_prefix` was computed between two unrelated paths. Add an `--installed-location` flag that uses `sysconfig.get_path('stdlib')`. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
1 parent 22c061e commit f0aba43

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

‎Makefile.pre.in‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ pybuilddir.txt: $(PYTHON_FOR_BUILD_DEPS)
10341034

10351035
$(BUILD_DETAILS): pybuilddir.txt
10361036
$(RUNSHARED_FOR_BUILD) $(PYTHON_FOR_BUILD) $(srcdir)/Tools/build/generate-build-details.py \
1037-
--relative-paths --config-file-path "$(LIBDEST)/$(BUILD_DETAILS)" \
1037+
--relative-paths --installed-location \
10381038
`cat pybuilddir.txt`/$(BUILD_DETAILS)
10391039

10401040
# Build static library

‎Tools/build/generate-build-details.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,20 @@ def main() -> None:
216216
default=None,
217217
help='If specified, ``base_prefix`` will be set as a relative path to the given config file path.',
218218
)
219+
parser.add_argument(
220+
'--installed-location',
221+
action='store_true',
222+
help='Use the path the file is installed to as ``--config-file-path``.',
223+
)
219224

220225
args = parser.parse_args()
221226

222227
data = generate_data(args.schema_version)
228+
if args.installed_location:
229+
# Not taken from the Makefile: `make install prefix=...` changes
230+
# LIBDEST, but not the prefix that sysconfig reports.
231+
args.config_file_path = os.path.join(
232+
sysconfig.get_path('stdlib'), 'build-details.json')
223233
if args.relative_paths:
224234
make_paths_relative(data, args.config_file_path)
225235

0 commit comments

Comments
 (0)