python,python3: move shebang handle in install script
This extends the Python[3] shebang fixup to all packages. Only Python scripts in `/usr/bin` will be handled at the moment. Later it may make sense to also cover executables in `/bin`, though typically Python executables shouldn't be placed there. Previously the shebang handling was only done for python[3]-pip & python[3]-setuptools. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
This commit is contained in:
parent
1bf7679211
commit
ed862da936
5 changed files with 6 additions and 8 deletions
|
@ -65,6 +65,12 @@ process_filespec "$src_dir" "$dst_dir" "$filespec" || {
|
||||||
exit 1
|
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 $usr_bin_dir/*
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$mode" == "sources" ] ; then
|
if [ "$mode" == "sources" ] ; then
|
||||||
# Copy only python source files
|
# Copy only python source files
|
||||||
find "$dst_dir" -not -type d -not -name "*\.py" -exec rm -f {} \;
|
find "$dst_dir" -not -type d -not -name "*\.py" -exec rm -f {} \;
|
||||||
|
|
|
@ -14,8 +14,6 @@ endef
|
||||||
|
|
||||||
define PyPackage/python-pip/install
|
define PyPackage/python-pip/install
|
||||||
$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/python$(PYTHON_VERSION)/site-packages
|
$(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/bin/* $(1)/usr/bin
|
||||||
$(CP) \
|
$(CP) \
|
||||||
$(PKG_BUILD_DIR)/install-pip/lib/python$(PYTHON_VERSION)/site-packages/pip \
|
$(PKG_BUILD_DIR)/install-pip/lib/python$(PYTHON_VERSION)/site-packages/pip \
|
||||||
|
|
|
@ -14,8 +14,6 @@ endef
|
||||||
|
|
||||||
define PyPackage/python-setuptools/install
|
define PyPackage/python-setuptools/install
|
||||||
$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/python$(PYTHON_VERSION)/site-packages
|
$(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/bin/* $(1)/usr/bin
|
||||||
$(CP) \
|
$(CP) \
|
||||||
$(PKG_BUILD_DIR)/install-setuptools/lib/python$(PYTHON_VERSION)/site-packages/pkg_resources \
|
$(PKG_BUILD_DIR)/install-setuptools/lib/python$(PYTHON_VERSION)/site-packages/pkg_resources \
|
||||||
|
|
|
@ -14,8 +14,6 @@ endef
|
||||||
|
|
||||||
define Package/python3-pip/install
|
define Package/python3-pip/install
|
||||||
$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages
|
$(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/bin/pip3* $(1)/usr/bin
|
||||||
$(CP) \
|
$(CP) \
|
||||||
$(PKG_BUILD_DIR)/install-pip/lib/python$(PYTHON3_VERSION)/site-packages/pip \
|
$(PKG_BUILD_DIR)/install-pip/lib/python$(PYTHON3_VERSION)/site-packages/pip \
|
||||||
|
|
|
@ -14,8 +14,6 @@ endef
|
||||||
|
|
||||||
define Py3Package/python3-setuptools/install
|
define Py3Package/python3-setuptools/install
|
||||||
$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages
|
$(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
|
$(CP) $(PKG_BUILD_DIR)/install-setuptools/bin/easy_install-* $(1)/usr/bin
|
||||||
$(LN) easy_install-$(PYTHON3_VERSION) $(1)/usr/bin/easy_install-3
|
$(LN) easy_install-$(PYTHON3_VERSION) $(1)/usr/bin/easy_install-3
|
||||||
$(CP) \
|
$(CP) \
|
||||||
|
|
Loading…
Reference in a new issue