diff options
author | Christian Heimes <christian@python.org> | 2022-06-28 12:56:06 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-28 12:56:06 (GMT) |
commit | 44fa03d748eb2b9a13a77c6143b18968521a1980 (patch) | |
tree | e7b970066438111cdc9dee290d1262e5deff20ad /Makefile.pre.in | |
parent | 600c65c094b0b48704d8ec2416930648052ba715 (diff) | |
download | cpython-44fa03d748eb2b9a13a77c6143b18968521a1980.zip cpython-44fa03d748eb2b9a13a77c6143b18968521a1980.tar.gz cpython-44fa03d748eb2b9a13a77c6143b18968521a1980.tar.bz2 |
gh-93939: Create and install scripts in Makefile (GH-94324)
Scripts for 2to3, idle, and pydoc are now created and installed by make.
Diffstat (limited to 'Makefile.pre.in')
-rw-r--r-- | Makefile.pre.in | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/Makefile.pre.in b/Makefile.pre.in index 5af9efd..3601d8a 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -150,6 +150,8 @@ CONFINCLUDEDIR= $(exec_prefix)/include PLATLIBDIR= @PLATLIBDIR@ SCRIPTDIR= $(prefix)/$(PLATLIBDIR) ABIFLAGS= @ABIFLAGS@ +# executable name for shebangs +EXENAME= $(BINDIR)/python$(LDVERSION)$(EXE) # Variable used by ensurepip WHEEL_PKG_DIR= @WHEEL_PKG_DIR@ @@ -580,7 +582,7 @@ LIBEXPAT_HEADERS= \ # Default target all: @DEF_MAKE_ALL_RULE@ build_all: check-clean-src $(BUILDPYTHON) platform oldsharedmods sharedmods \ - gdbhooks Programs/_testembed python-config + gdbhooks Programs/_testembed scripts build_wasm: check-clean-src $(BUILDPYTHON) platform oldsharedmods python-config # Check that the source is clean when building out of source. @@ -2111,7 +2113,7 @@ libinstall: all $(srcdir)/Modules/xxmodule.c python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh @ # Substitution happens here, as the completely-expanded BINDIR @ # is not available in configure - sed -e "s,@EXENAME@,$(BINDIR)/python$(LDVERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config.py + sed -e "s,@EXENAME@,$(EXENAME)," < $(srcdir)/Misc/python-config.in >python-config.py @ # Replace makefile compat. variable references with shell script compat. ones; $(VAR) -> ${VAR} LC_ALL=C sed -e 's,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g' < Misc/python-config.sh >python-config @ # On Darwin, always use the python version of the script, the shell @@ -2121,6 +2123,29 @@ python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh cp python-config.py python-config; \ fi +# macOS' make seems to ignore a dependency on a +# "$(BUILD_SCRIPTS_DIR): $(MKDIR_P) $@" rule. +BUILD_SCRIPTS_DIR=build/scripts-$(VERSION) +SCRIPT_2TO3=$(BUILD_SCRIPTS_DIR)/2to3-$(VERSION) +SCRIPT_IDLE=$(BUILD_SCRIPTS_DIR)/idle$(VERSION) +SCRIPT_PYDOC=$(BUILD_SCRIPTS_DIR)/pydoc$(VERSION) + +$(SCRIPT_2TO3): $(srcdir)/Tools/scripts/2to3 + @$(MKDIR_P) $(BUILD_SCRIPTS_DIR) + sed -e "s,/usr/bin/env python3,$(EXENAME)," < $(srcdir)/Tools/scripts/2to3 > $@ + @chmod +x $@ + +$(SCRIPT_IDLE): $(srcdir)/Tools/scripts/idle3 + @$(MKDIR_P) $(BUILD_SCRIPTS_DIR) + sed -e "s,/usr/bin/env python3,$(EXENAME)," < $(srcdir)/Tools/scripts/idle3 > $@ + @chmod +x $@ + +$(SCRIPT_PYDOC): $(srcdir)/Tools/scripts/pydoc3 + @$(MKDIR_P) $(BUILD_SCRIPTS_DIR) + sed -e "s,/usr/bin/env python3,$(EXENAME)," < $(srcdir)/Tools/scripts/pydoc3 > $@ + @chmod +x $@ + +scripts: $(SCRIPT_2TO3) $(SCRIPT_IDLE) $(SCRIPT_PYDOC) python-config # Install the include files INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY) @@ -2167,7 +2192,7 @@ LIBPL= @LIBPL@ # pkgconfig directory LIBPC= $(LIBDIR)/pkgconfig -libainstall: all python-config +libainstall: all scripts @for i in $(LIBDIR) $(LIBPL) $(LIBPC) $(BINDIR); \ do \ if test ! -d $(DESTDIR)$$i; then \ @@ -2203,6 +2228,9 @@ libainstall: all python-config $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh $(INSTALL_SCRIPT) python-config.py $(DESTDIR)$(LIBPL)/python-config.py $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(LDVERSION)-config + $(INSTALL_SCRIPT) $(SCRIPT_2TO3) $(DESTDIR)$(BINDIR)/2to3-$(VERSION) + $(INSTALL_SCRIPT) $(SCRIPT_IDLE) $(DESTDIR)$(BINDIR)/idle$(VERSION) + $(INSTALL_SCRIPT) $(SCRIPT_PYDOC) $(DESTDIR)$(BINDIR)/pydoc$(VERSION) @if [ -s Modules/python.exp -a \ "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \ echo; echo "Installing support files for building shared extension modules on AIX:"; \ @@ -2512,7 +2540,7 @@ Python/thread.o: @THREADHEADERS@ $(srcdir)/Python/condvar.h .PHONY: smelly funny patchcheck touch altmaninstall commoninstall .PHONY: clean-retain-profile profile-removal run_profile_task .PHONY: build_all_generate_profile build_all_merge_profile -.PHONY: gdbhooks +.PHONY: gdbhooks scripts ########################################################################## # Module dependencies and platform-specific files |