Skip to content

Commit d1d9c27

Browse files
committed
build: Integrate venvlauncher build/installation into the Makefile
This is required for venv creation on Windows. Ideally this would use the venv specific launcher (PC/launcher.c), but a copy of main binary seems to work as well for now.
1 parent c6ef700 commit d1d9c27

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

Makefile.pre.in

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ BINLIBDEST= @BINLIBDEST@
167167
LIBDEST= $(SCRIPTDIR)/python$(VERSION)
168168
INCLUDEPY= $(INCLUDEDIR)/python$(LDVERSION)
169169
CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(LDVERSION)
170+
VENVLAUNCHERDIR= $(BINLIBDEST)/venv/scripts/nt
170171

171172
# Symbols used for using shared libraries
172173
SHLIB_SUFFIX= @SHLIB_SUFFIX@
@@ -295,6 +296,8 @@ LIBOBJS= @LIBOBJS@
295296
PYTHON= python$(EXE)
296297
BUILDPYTHON= python$(BUILDEXE)
297298
BUILDPYTHONW= pythonw$(BUILDEXE)
299+
BUILDVENVLAUNCHER= venvlauncher$(BUILDEXE)
300+
BUILDVENVWLAUNCHER= venvwlauncher$(BUILDEXE)
298301

299302
HOSTRUNNER= @HOSTRUNNER@
300303

@@ -597,7 +600,7 @@ LIBEXPAT_HEADERS= \
597600

598601
# Default target
599602
all: @DEF_MAKE_ALL_RULE@
600-
build_all: check-clean-src $(BUILDPYTHON) $(BUILDPYTHONW) platform oldsharedmods sharedmods \
603+
build_all: check-clean-src $(BUILDPYTHON) $(BUILDPYTHONW) $(BUILDVENVLAUNCHER) $(BUILDVENVWLAUNCHER) platform oldsharedmods sharedmods \
601604
gdbhooks Programs/_testembed python-config
602605
build_wasm: check-clean-src $(BUILDPYTHON) platform oldsharedmods python-config
603606

@@ -729,6 +732,14 @@ $(BUILDPYTHONW): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) pythonw
729732
$(BUILDPYTHON): Programs/python.o $(LINK_PYTHON_DEPS) python_exe.o
730733
$(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -municode -o $@ Programs/python.o $(LINK_PYTHON_OBJS) $(LIBS) $(MODLIBS) $(SYSLIBS) python_exe.o
731734

735+
# FIXME: build these from PC/launcher.c instead
736+
$(BUILDVENVLAUNCHER): $(BUILDPYTHON)
737+
cp $(BUILDPYTHON) $(BUILDVENVLAUNCHER)
738+
739+
# FIXME: build these from PC/launcher.c instead
740+
$(BUILDVENVWLAUNCHER): $(BUILDPYTHONW)
741+
cp $(BUILDPYTHONW) $(BUILDVENVWLAUNCHER)
742+
732743
platform: $(PYTHON_FOR_BUILD_DEPS) pybuilddir.txt
733744
$(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print("%s-%d.%d" % (get_platform(), *sys.version_info[:2]))' >platform
734745

@@ -1821,7 +1832,7 @@ $(DESTSHARED):
18211832
# Install the interpreter with $(VERSION) affixed
18221833
# This goes into $(exec_prefix)
18231834
altbininstall: $(BUILDPYTHON) @FRAMEWORKPYTHONW@
1824-
@for i in $(BINDIR) $(LIBDIR); \
1835+
@for i in $(BINDIR) $(LIBDIR) $(VENVLAUNCHERDIR); \
18251836
do \
18261837
if test ! -d $(DESTDIR)$$i; then \
18271838
echo "Creating directory $$i"; \
@@ -1832,6 +1843,8 @@ altbininstall: $(BUILDPYTHON) @FRAMEWORKPYTHONW@
18321843
if test "$(PYTHONFRAMEWORKDIR)" = "no-framework" ; then \
18331844
$(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(LDVERSION)$(EXE); \
18341845
$(INSTALL_PROGRAM) $(BUILDPYTHONW) $(DESTDIR)$(BINDIR)/python3w$(EXE); \
1846+
$(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(VENVLAUNCHERDIR)/python$(EXE); \
1847+
$(INSTALL_PROGRAM) $(BUILDPYTHONW) $(DESTDIR)$(VENVLAUNCHERDIR)/pythonw$(EXE); \
18351848
else \
18361849
$(INSTALL_PROGRAM) $(STRIPFLAG) Mac/pythonw $(DESTDIR)$(BINDIR)/python$(LDVERSION)$(EXE); \
18371850
fi

0 commit comments

Comments
 (0)