Skip to content

Commit ccb73a0

Browse files
authored
bpo-45582: Fix out-of-tree build issues with new getpath (GH-29902)
1 parent 03768c4 commit ccb73a0

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ Mac/pythonw
7474
Misc/python.pc
7575
Misc/python-embed.pc
7676
Misc/python-config.sh
77-
Modules/getpath.h
7877
Modules/Setup.config
7978
Modules/Setup.local
8079
Modules/Setup.stdlib

Makefile.pre.in

+7-8
Original file line numberDiff line numberDiff line change
@@ -1062,10 +1062,9 @@ FROZEN_FILES_OUT = \
10621062
Programs/_freeze_module.o: Programs/_freeze_module.c Makefile
10631063

10641064
Modules/getpath_noop.o: $(srcdir)/Modules/getpath_noop.c Makefile
1065-
$(CC) -c $(PY_CORE_CFLAGS) -o $@ $(srcdir)/Modules/getpath_noop.c
10661065

1067-
Programs/_freeze_module: Programs/_freeze_module.o $(LIBRARY_OBJS_OMIT_FROZEN) Modules/getpath_noop.o
1068-
$(LINKCC) $(PY_CORE_LDFLAGS) -o $@ Programs/_freeze_module.o $(LIBRARY_OBJS_OMIT_FROZEN) Modules/getpath_noop.o $(LIBS) $(MODLIBS) $(SYSLIBS)
1066+
Programs/_freeze_module: Programs/_freeze_module.o Modules/getpath_noop.o $(LIBRARY_OBJS_OMIT_FROZEN)
1067+
$(LINKCC) $(PY_CORE_LDFLAGS) -o $@ Programs/_freeze_module.o Modules/getpath_noop.o $(LIBRARY_OBJS_OMIT_FROZEN) $(LIBS) $(MODLIBS) $(SYSLIBS)
10691068

10701069
# BEGIN: freezing modules
10711070

@@ -1131,11 +1130,11 @@ Python/frozen_modules/frozen_only.h: $(FREEZE_MODULE) Tools/freeze/flag.py
11311130

11321131
# END: freezing modules
11331132

1134-
Tools/scripts/freeze_modules.py: $(FREEZE_MODULE)
1135-
11361133
# We manually freeze getpath.py rather than through freeze_modules
1137-
Modules/getpath.h: Programs/_freeze_module Modules/getpath.py
1138-
Programs/_freeze_module getpath $(srcdir)/Modules/getpath.py $(srcdir)/Modules/getpath.h
1134+
Python/frozen_modules/getpath.h: $(FREEZE_MODULE) Modules/getpath.py
1135+
$(FREEZE_MODULE) getpath $(srcdir)/Modules/getpath.py Python/frozen_modules/getpath.h
1136+
1137+
Tools/scripts/freeze_modules.py: $(FREEZE_MODULE)
11391138

11401139
.PHONY: regen-frozen
11411140
regen-frozen: Tools/scripts/freeze_modules.py $(FROZEN_FILES_IN)
@@ -1177,7 +1176,7 @@ Modules/getbuildinfo.o: $(PARSER_OBJS) \
11771176
-DGITBRANCH="\"`LC_ALL=C $(GITBRANCH)`\"" \
11781177
-o $@ $(srcdir)/Modules/getbuildinfo.c
11791178

1180-
Modules/getpath.o: $(srcdir)/Modules/getpath.c Modules/getpath.h Makefile
1179+
Modules/getpath.o: $(srcdir)/Modules/getpath.c Python/frozen_modules/getpath.h Makefile $(PYTHON_HEADERS)
11811180
$(CC) -c $(PY_CORE_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
11821181
-DPREFIX='"$(prefix)"' \
11831182
-DEXEC_PREFIX='"$(exec_prefix)"' \

Modules/getpath.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#endif
2020

2121
/* Reference the precompiled getpath.py */
22-
#include "getpath.h"
22+
#include "../Python/frozen_modules/getpath.h"
2323

2424
#if (!defined(PREFIX) || !defined(EXEC_PREFIX) \
2525
|| !defined(VERSION) || !defined(VPATH) \

PCbuild/_freeze_module.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@
379379
<GetPath Include="..\Modules\getpath.py">
380380
<ModName>getpath</ModName>
381381
<IntFile>$(IntDir)getpath.g.h</IntFile>
382-
<OutFile>$(PySourcePath)Modules\getpath.h</OutFile>
382+
<OutFile>$(PySourcePath)Python\frozen_modules\getpath.h</OutFile>
383383
</GetPath>
384384
</ItemGroup>
385385
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

0 commit comments

Comments
 (0)