mode="$5"
filespec="$6"
-SED="${SED:-sed -e}"
-
find "$src_dir" -name "*.exe" -delete
process_filespec "$src_dir" "$dst_dir" "$filespec" || {
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" -delete
TARGET_CFLAGS += -mno-mips16 -mno-interlink-mips16
endif
+define PyShebang
+$(SED) "1"'!'"b;s,^#"'!'".*python.*,#"'!'"/usr/bin/python2," -i --follow-symlinks $(1)
+endef
+
define PyPackage
define Package/$(1)-src
define Package/$(1)/install
$$(call PyPackage/$(1)/install,$$(1))
- SED="$(SED)" \
$(SHELL) $(python_mk_path)python-package-install.sh "2" \
"$(PKG_INSTALL_DIR)" "$$(1)" \
"$(HOST_PYTHON_BIN)" "$$(2)" \
- "$$$$$$$$$$(call shvar,PyPackage/$(1)/filespec)"
+ "$$$$$$$$$$(call shvar,PyPackage/$(1)/filespec)" && \
+ if [ -d "$$(1)/usr/bin" ]; then \
+ $(call PyShebang,$$(1)/usr/bin/*) ; \
+ fi
endef
define Package/$(1)-src/install
TARGET_CFLAGS += -mno-mips16 -mno-interlink-mips16
endif
+define Py3Shebang
+$(SED) "1"'!'"b;s,^#"'!'".*python.*,#"'!'"/usr/bin/python3," -i --follow-symlinks $(1)
+endef
+
define Py3Package
define Package/$(1)-src
define Package/$(1)/install
$$(call Py3Package/$(1)/install,$$(1))
- SED="$(SED)" \
$(SHELL) $(python3_mk_path)python-package-install.sh "3" \
"$(PKG_INSTALL_DIR)" "$$(1)" \
"$(HOST_PYTHON3_BIN)" "$$(2)" \
- "$$$$$$$$$$(call shvar,Py3Package/$(1)/filespec)"
- endef
+ "$$$$$$$$$$(call shvar,Py3Package/$(1)/filespec)" && \
+ if [ -d "$$(1)/usr/bin" ]; then \
+ $(call Py3Shebang,$$(1)/usr/bin/*) ; \
+ fi
+ endef
define Package/$(1)-src/install
$$(call Package/$(1)/install,$$(1),sources)