Merge pull request #9513 from BKPepe/openwrt-18.06_python_shebang
[OpenWrt 18.06] python,python3: move shebang handle in install script
This commit is contained in:
commit
6d55ff558b
9 changed files with 12 additions and 10 deletions
|
@ -47,11 +47,19 @@ python="$4"
|
|||
mode="$5"
|
||||
filespec="$6"
|
||||
|
||||
SED="${SED:-sed -e}"
|
||||
|
||||
process_filespec "$src_dir" "$dst_dir" "$filespec" || {
|
||||
echo "process filespec error-ed"
|
||||
exit 1
|
||||
}
|
||||
|
||||
usr_bin_dir="$dst_dir/usr/bin"
|
||||
|
||||
if [ -d "$usr_bin_dir" ] ; then
|
||||
$SED "1"'!'"b;s,^#"'!'".*python.*,#"'!'"/usr/bin/python${ver}," -i --follow-symlinks $usr_bin_dir/*
|
||||
fi
|
||||
|
||||
if [ "$mode" == "sources" ] ; then
|
||||
# Copy only python source files
|
||||
find $dst_dir -not -type d -not -name "*\.py" | xargs rm -f
|
||||
|
|
|
@ -70,6 +70,7 @@ define PyPackage
|
|||
define Package/$(1)/install
|
||||
$(call PyPackage/$(1)/install,$$(1))
|
||||
find $(PKG_INSTALL_DIR) -name "*\.exe" | xargs rm -f
|
||||
SED="$(SED)" \
|
||||
$(SHELL) $(python_mk_path)python-package-install.sh "2" \
|
||||
"$(PKG_INSTALL_DIR)" "$$(1)" \
|
||||
"$(HOST_PYTHON_BIN)" "$$(2)" \
|
||||
|
|
|
@ -12,7 +12,7 @@ include ../python-version.mk
|
|||
|
||||
PKG_NAME:=python
|
||||
PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO)
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=3
|
||||
|
||||
PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=https://www.python.org/ftp/python/$(PKG_VERSION)
|
||||
|
|
|
@ -14,8 +14,6 @@ endef
|
|||
|
||||
define PyPackage/python-pip/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/python$(PYTHON_VERSION)/site-packages
|
||||
# Adjust shebang to proper python location on target
|
||||
sed "1s@.*@#\!/usr/bin/python$(PYTHON_VERSION)@" -i $(PKG_BUILD_DIR)/install-pip/bin/*
|
||||
$(CP) $(PKG_BUILD_DIR)/install-pip/bin/* $(1)/usr/bin
|
||||
$(CP) \
|
||||
$(PKG_BUILD_DIR)/install-pip/lib/python$(PYTHON_VERSION)/site-packages/pip \
|
||||
|
|
|
@ -14,8 +14,6 @@ endef
|
|||
|
||||
define PyPackage/python-setuptools/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/python$(PYTHON_VERSION)/site-packages
|
||||
# Adjust shebang to proper python location on target
|
||||
sed "1s@.*@#\!/usr/bin/python$(PYTHON_VERSION)@" -i $(PKG_BUILD_DIR)/install-setuptools/bin/*
|
||||
$(CP) $(PKG_BUILD_DIR)/install-setuptools/bin/* $(1)/usr/bin
|
||||
$(CP) \
|
||||
$(PKG_BUILD_DIR)/install-setuptools/lib/python$(PYTHON_VERSION)/site-packages/pkg_resources \
|
||||
|
|
|
@ -69,6 +69,7 @@ define Py3Package
|
|||
define Package/$(1)/install
|
||||
$(call Py3Package/$(1)/install,$$(1))
|
||||
find $(PKG_INSTALL_DIR) -name "*\.exe" | xargs rm -f
|
||||
SED="$(SED)" \
|
||||
$(SHELL) $(python3_mk_path)python-package-install.sh "3" \
|
||||
"$(PKG_INSTALL_DIR)" "$$(1)" \
|
||||
"$(HOST_PYTHON3_BIN)" "$$(2)" \
|
||||
|
|
|
@ -14,7 +14,7 @@ PYTHON_VERSION:=$(PYTHON3_VERSION)
|
|||
PYTHON_VERSION_MICRO:=$(PYTHON3_VERSION_MICRO)
|
||||
|
||||
PKG_NAME:=python3
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=3
|
||||
PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO)
|
||||
|
||||
PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
|
||||
|
|
|
@ -14,8 +14,6 @@ endef
|
|||
|
||||
define Package/python3-pip/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages
|
||||
# Adjust shebang to proper python location on target
|
||||
sed "1s@.*@#\!/usr/bin/python$(PYTHON3_VERSION)@" -i $(PKG_BUILD_DIR)/install-pip/bin/*
|
||||
$(CP) $(PKG_BUILD_DIR)/install-pip/bin/pip3* $(1)/usr/bin
|
||||
$(CP) \
|
||||
$(PKG_BUILD_DIR)/install-pip/lib/python$(PYTHON3_VERSION)/site-packages/pip \
|
||||
|
|
|
@ -14,8 +14,6 @@ endef
|
|||
|
||||
define Py3Package/python3-setuptools/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages
|
||||
# Adjust shebang to proper python location on target
|
||||
sed "1s@.*@#\!/usr/bin/python$(PYTHON3_VERSION)@" -i $(PKG_BUILD_DIR)/install-setuptools/bin/*
|
||||
$(CP) $(PKG_BUILD_DIR)/install-setuptools/bin/easy_install-* $(1)/usr/bin
|
||||
$(LN) easy_install-$(PYTHON3_VERSION) $(1)/usr/bin/easy_install-3
|
||||
$(CP) \
|
||||
|
|
Loading…
Reference in a new issue