diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index d7284c69..58531d9d 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -588,7 +588,7 @@ fetch_jar() { # Must use full path to jar and destination directory: # http://bugs.jython.org/issue2350 - { if $JAVA -jar $PWD/${package_name}.jar -s -d $PWD/${package_name}; then + { if $JAVA -jar "$PWD/${package_name}.jar" -s -d "$PWD/${package_name}"; then if [ -z "$KEEP_BUILD_PATH" ]; then rm -f "$package_filename" else @@ -902,11 +902,10 @@ fix_jython_shebangs() { 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}" + sed -i.bak "1 s:.*:#\!${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}" + sed -i.bak "1 s:.*:#\!\/usr\/bin\/env python:" "${file}" ;; esac rm -f "${file}.bak" @@ -1276,6 +1275,17 @@ require_java() { export JAVA="$java" } +# Let Jython installer to generate shell script instead of python script even if there's `python2.7` available in `$PATH` (#800) +# FIXME: better function naming +unrequire_python27() { + export PATH="${BUILD_PATH}/bin:${PATH}" + mkdir -p "${BUILD_PATH}/bin" + if command -v python2.7 1>/dev/null 2>&1; then + echo false > "${BUILD_PATH}/bin/python2.7" + chmod +x "${BUILD_PATH}/bin/python2.7" + fi +} + require_distro() { for arg; do if [[ "$(cat /etc/issue 2>/dev/null || true)" == "$arg"* ]]; then diff --git a/plugins/python-build/share/python-build/jython-2.7.0 b/plugins/python-build/share/python-build/jython-2.7.0 index b4f49716..35cf2e1b 100644 --- a/plugins/python-build/share/python-build/jython-2.7.0 +++ b/plugins/python-build/share/python-build/jython-2.7.0 @@ -1,4 +1,5 @@ require_java +unrequire_python27 install_jar "jython-2.7.0" "https://repo1.maven.org/maven2/org/python/jython-installer/2.7.0/jython-installer-2.7.0.jar#b44352ece72382268a60e2848741c96609a91d796bb9a9c6ebeff62f0c12c9cf" jython case "$(pypy_architecture 2>/dev/null || true)" in diff --git a/plugins/python-build/share/python-build/jython-2.7.1b1 b/plugins/python-build/share/python-build/jython-2.7.1b1 index 2caf78aa..44c6d197 100644 --- a/plugins/python-build/share/python-build/jython-2.7.1b1 +++ b/plugins/python-build/share/python-build/jython-2.7.1b1 @@ -1,4 +1,5 @@ require_java +unrequire_python27 install_jar "jython-2.7.1b1" "https://repo1.maven.org/maven2/org/python/jython-installer/2.7.1b1/jython-installer-2.7.1b1.jar#c7a05911fed666c8f9df5bdce50bb5dc75482b7f6b1f1dbe433162d94c960ec3" jython case "$(pypy_architecture 2>/dev/null || true)" in diff --git a/plugins/python-build/share/python-build/jython-2.7.1b2 b/plugins/python-build/share/python-build/jython-2.7.1b2 index a47e850f..51b39656 100644 --- a/plugins/python-build/share/python-build/jython-2.7.1b2 +++ b/plugins/python-build/share/python-build/jython-2.7.1b2 @@ -1,4 +1,5 @@ require_java +unrequire_python27 install_jar "jython-2.7.1b2" "https://repo1.maven.org/maven2/org/python/jython-installer/2.7.1b2/jython-installer-2.7.1b2.jar#d994500808c8d448baab1f98e043e6a11360cff302f401901e73f0e34c27251a" jython case "$(pypy_architecture 2>/dev/null || true)" in diff --git a/plugins/python-build/share/python-build/jython-2.7.1b3 b/plugins/python-build/share/python-build/jython-2.7.1b3 index c13abbcd..058d927f 100644 --- a/plugins/python-build/share/python-build/jython-2.7.1b3 +++ b/plugins/python-build/share/python-build/jython-2.7.1b3 @@ -1,4 +1,5 @@ require_java +unrequire_python27 install_jar "jython-2.7.1b3" "https://repo1.maven.org/maven2/org/python/jython-installer/2.7.1b3/jython-installer-2.7.1b3.jar#5c6c7dc372a131dbc2b29b95407c69a4ebab22c1823d9098b7f993444f3090c5" jython case "$(pypy_architecture 2>/dev/null || true)" in diff --git a/plugins/python-build/share/python-build/jython-dev b/plugins/python-build/share/python-build/jython-dev index 576c3a51..7b58692e 100644 --- a/plugins/python-build/share/python-build/jython-dev +++ b/plugins/python-build/share/python-build/jython-dev @@ -1,4 +1,5 @@ require_java +unrequire_python27 install_hg "jython-dev" "https://hg.python.org/jython" "default" jython_builder ez_setup # pip (>= 1.3) does not work properly since it uses HTTPS for downloads # * https://github.com/yyuu/pyenv/issues/15