From bdfe6d383f05a2bff61a95b2a80b03f59474d4d8 Mon Sep 17 00:00:00 2001 From: "Yamashita, Yuu" Date: Sun, 18 Oct 2015 11:47:12 +0900 Subject: [PATCH] Add shebang workaround for Jython 2.7.x (fixes #458) --- plugins/python-build/bin/python-build | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index ac3e524a..0d0d4c5d 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -844,6 +844,23 @@ build_package_jython() { ( cd "${PREFIX_PATH}/bin" && ln -fs jython python ) fi } >&4 2>&1 + fix_jython_shebangs +} + +fix_jython_shebangs() { + # Workaround for Jython 2.7+ (#458) + for file in "${PREFIX_PATH}/bin"/*; do + case "$(head -1 "${file}")" in + "#!"*"/bin/jython" ) + sed -i.bak "1 s:.*:#\!\/usr\/bin\/env ${PREFIX_PATH}\/bin\/jython:" "${file}" + ;; + "#!"*"/bin/python2.7"* ) + # Jython 2.7+ requires CPython 2.7 to run + sed -i.bak "1 s:.*:#\!\/usr\/bin\/env python2.7:" "${file}" + ;; + esac + rm -f "${file}.bak" + done } build_package_jython_builder() {