Skip to content

Commit 973fe0b

Browse files
committed
Issue #18093: Factor out the programs that embed the runtime
1 parent d6766ae commit 973fe0b

15 files changed

+37
-32
lines changed

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ Modules/Setup.config
2727
Modules/Setup.local
2828
Modules/config.c
2929
Modules/ld_so_aix
30-
Modules/_freeze_importlib
31-
Modules/_testembed
30+
Programs/_freeze_importlib
31+
Programs/_testembed
3232
PCbuild/*.bsc
3333
PCbuild/*.dll
3434
PCbuild/*.exe

.hgignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ Tools/unicode/build/
8989
Tools/unicode/MAPPINGS/
9090
BuildLog.htm
9191
__pycache__
92-
Modules/_freeze_importlib
93-
Modules/_testembed
92+
Programs/_freeze_importlib
93+
Programs/_testembed
9494
.coverage
9595
coverage/
9696
htmlcov/

.hgtouch

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Define dependencies of generated files that are checked into hg.
33
# The syntax of this file uses make rule dependencies, without actions
44

5-
Python/importlib.h: Lib/importlib/_bootstrap.py Modules/_freeze_importlib.c
5+
Python/importlib.h: Lib/importlib/_bootstrap.py Programs/_freeze_importlib.c
66

77
Include/opcode.h: Lib/opcode.py Tools/scripts/generate_opcode_h.py
88

Makefile.pre.in

+20-20
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ LIBRARY_OBJS= \
466466

467467
# Default target
468468
all: build_all
469-
build_all: $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks Modules/_testembed python-config
469+
build_all: $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks Programs/_testembed python-config
470470

471471
# Compile a binary with gcc profile guided optimization.
472472
profile-opt:
@@ -539,8 +539,8 @@ clinic: $(BUILDPYTHON)
539539
$(RUNSHARED) $(PYTHON_FOR_BUILD) ./Tools/clinic/clinic.py --make
540540

541541
# Build the interpreter
542-
$(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
543-
$(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Modules/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
542+
$(BUILDPYTHON): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
543+
$(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
544544

545545
platform: $(BUILDPYTHON) pybuilddir.txt
546546
$(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print(get_platform()+"-"+sys.version[0:3])' >platform
@@ -665,18 +665,18 @@ Modules/Setup: $(srcdir)/Modules/Setup.dist
665665
echo "-----------------------------------------------"; \
666666
fi
667667

668-
Modules/_testembed: Modules/_testembed.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
669-
$(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Modules/_testembed.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
668+
Programs/_testembed: Programs/_testembed.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
669+
$(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/_testembed.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
670670

671671
############################################################################
672672
# Importlib
673673

674-
Modules/_freeze_importlib: Modules/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN)
675-
$(LINKCC) $(PY_LDFLAGS) -o $@ Modules/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
674+
Programs/_freeze_importlib: Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN)
675+
$(LINKCC) $(PY_LDFLAGS) -o $@ Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
676676

677-
Python/importlib.h: $(srcdir)/Lib/importlib/_bootstrap.py Modules/_freeze_importlib.c
678-
$(MAKE) Modules/_freeze_importlib
679-
./Modules/_freeze_importlib \
677+
Python/importlib.h: $(srcdir)/Lib/importlib/_bootstrap.py Programs/_freeze_importlib.c
678+
$(MAKE) Programs/_freeze_importlib
679+
./Programs/_freeze_importlib \
680680
$(srcdir)/Lib/importlib/_bootstrap.py Python/importlib.h
681681

682682

@@ -704,11 +704,11 @@ Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
704704
-DVPATH='"$(VPATH)"' \
705705
-o $@ $(srcdir)/Modules/getpath.c
706706

707-
Modules/python.o: $(srcdir)/Modules/python.c
708-
$(MAINCC) -c $(PY_CORE_CFLAGS) -o $@ $(srcdir)/Modules/python.c
707+
Programs/python.o: $(srcdir)/Programs/python.c
708+
$(MAINCC) -c $(PY_CORE_CFLAGS) -o $@ $(srcdir)/Programs/python.c
709709

710-
Modules/_testembed.o: $(srcdir)/Modules/_testembed.c
711-
$(MAINCC) -c $(PY_CORE_CFLAGS) -o $@ $(srcdir)/Modules/_testembed.c
710+
Programs/_testembed.o: $(srcdir)/Programs/_testembed.c
711+
$(MAINCC) -c $(PY_CORE_CFLAGS) -o $@ $(srcdir)/Programs/_testembed.c
712712

713713
Modules/_sre.o: $(srcdir)/Modules/_sre.c $(srcdir)/Modules/sre.h $(srcdir)/Modules/sre_constants.h $(srcdir)/Modules/sre_lib.h
714714

@@ -922,7 +922,7 @@ PYTHON_HEADERS= \
922922
$(PARSER_HEADERS) \
923923
$(AST_H)
924924

925-
$(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
925+
$(LIBRARY_OBJS) $(MODOBJS) Programs/python.o: $(PYTHON_HEADERS)
926926

927927

928928
######################################################################
@@ -1332,7 +1332,7 @@ libainstall: all python-config
13321332
fi; \
13331333
fi
13341334
$(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
1335-
$(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
1335+
$(INSTALL_DATA) Programs/python.o $(DESTDIR)$(LIBPL)/python.o
13361336
$(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
13371337
$(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
13381338
$(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
@@ -1343,10 +1343,10 @@ libainstall: all python-config
13431343
$(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
13441344
$(INSTALL_SCRIPT) python-config.py $(DESTDIR)$(LIBPL)/python-config.py
13451345
$(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(LDVERSION)-config
1346-
@if [ -s Modules/python.exp -a \
1346+
@if [ -s Programs/python.exp -a \
13471347
"`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
13481348
echo; echo "Installing support files for building shared extension modules on AIX:"; \
1349-
$(INSTALL_DATA) Modules/python.exp \
1349+
$(INSTALL_DATA) Programs/python.exp \
13501350
$(DESTDIR)$(LIBPL)/python.exp; \
13511351
echo; echo "$(LIBPL)/python.exp"; \
13521352
$(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \
@@ -1526,7 +1526,7 @@ clean: pycremoval
15261526
find build -name '*.py[co]' -exec rm -f {} ';' || true
15271527
-rm -f pybuilddir.txt
15281528
-rm -f Lib/lib2to3/*Grammar*.pickle
1529-
-rm -f Modules/_testembed Modules/_freeze_importlib
1529+
-rm -f Programs/_testembed Programs/_freeze_importlib
15301530

15311531
profile-removal:
15321532
find . -name '*.gc??' -exec rm -f {} ';'
@@ -1550,7 +1550,7 @@ distclean: clobber
15501550
done
15511551
-rm -f core Makefile Makefile.pre config.status \
15521552
Modules/Setup Modules/Setup.local Modules/Setup.config \
1553-
Modules/ld_so_aix Modules/python.exp Misc/python.pc
1553+
Modules/ld_so_aix Programs/python.exp Misc/python.pc
15541554
-rm -f python*-gdb.py
15551555
find $(srcdir)/[a-zA-Z]* '(' -name '*.fdc' -o -name '*~' \
15561556
-o -name '[@,#]*' -o -name '*.old' \

Modules/README

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Source files for standard library extension modules,
2+
and former extension modules that are now builtin modules.

Objects/README

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Source files for various builtin objects

PCbuild/_freeze_importlib.vcxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@
167167
</PostBuildEvent>
168168
</ItemDefinitionGroup>
169169
<ItemGroup>
170-
<ClCompile Include="..\Modules\_freeze_importlib.c" />
170+
<ClCompile Include="..\Programs\_freeze_importlib.c" />
171171
</ItemGroup>
172172
<ItemGroup>
173173
<ProjectReference Include="pythoncore.vcxproj">
@@ -185,4 +185,4 @@
185185
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
186186
<ImportGroup Label="ExtensionTargets">
187187
</ImportGroup>
188-
</Project>
188+
</Project>

PCbuild/_freeze_importlib.vcxproj.filters

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</Filter>
1616
</ItemGroup>
1717
<ItemGroup>
18-
<ClCompile Include="..\Modules\_freeze_importlib.c">
18+
<ClCompile Include="..\Programs\_freeze_importlib.c">
1919
<Filter>Source Files</Filter>
2020
</ClCompile>
2121
</ItemGroup>
@@ -24,4 +24,4 @@
2424
<Filter>Source Files</Filter>
2525
</None>
2626
</ItemGroup>
27-
</Project>
27+
</Project>

PCbuild/python.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ echo @"$(OutDir)python$(PyDebugExt).exe" %%*&gt;&gt; "$(SolutionDir)..\python.ba
510510
<ResourceCompile Include="..\PC\python_exe.rc" />
511511
</ItemGroup>
512512
<ItemGroup>
513-
<ClCompile Include="..\Modules\python.c" />
513+
<ClCompile Include="..\Programs\python.c" />
514514
</ItemGroup>
515515
<ItemGroup>
516516
<ProjectReference Include="pythoncore.vcxproj">

PCbuild/python.vcxproj.filters

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
</ResourceCompile>
2020
</ItemGroup>
2121
<ItemGroup>
22-
<ClCompile Include="..\Modules\python.c">
22+
<ClCompile Include="..\Programs\python.c">
2323
<Filter>Source Files</Filter>
2424
</ClCompile>
2525
</ItemGroup>
26-
</Project>
26+
</Project>

Programs/README

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Source files for binary executables (as opposed to shared modules)
File renamed without changes.
File renamed without changes.

Modules/python.c Programs/python.c

File renamed without changes.

Python/README

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Miscellaneous source files for the main Python shared library

0 commit comments

Comments
 (0)