tcontrib/freeze_packages: should not use too new python interpreter - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 5ec0747effca06cae53f6f7525e57f5bae9eeb8b DIR parent cfdfbd2bfe82088d4e3a3cde5e52ffbe543d09df HTML Author: SomberNight <somber.night@protonmail.com> Date: Wed, 3 Jun 2020 17:45:44 +0200 contrib/freeze_packages: should not use too new python interpreter Certain dependencies are only needed on old python versions, e.g. backports of stdlib functionality. We should definitely not use newer python when running freeze_packages.sh tthan what we bundle in the binaries. Perhaps it is prudent to use the min python version that we support (which is atm older than what we bundle). Diffstat: M contrib/freeze_packages.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) --- DIR diff --git a/contrib/freeze_packages.sh b/contrib/freeze_packages.sh t@@ -6,13 +6,23 @@ set -e venv_dir=~/.electrum-venv contrib=$(dirname "$0") +# note: we should not use a higher version of python than what the binaries bundle +if [[ ! "$SYSTEM_PYTHON" ]] ; then + SYSTEM_PYTHON=$(which python3.6) || printf "" +else + SYSTEM_PYTHON=$(which $SYSTEM_PYTHON) || printf "" +fi +if [[ ! "$SYSTEM_PYTHON" ]] ; then + echo "Please specify which python to use in \$SYSTEM_PYTHON" && exit 1; +fi + which virtualenv > /dev/null 2>&1 || { echo "Please install virtualenv" && exit 1; } -python3 -m hashin -h > /dev/null 2>&1 || { python3 -m pip install hashin; } -other_python=$(which python3) + +${SYSTEM_PYTHON} -m hashin -h > /dev/null 2>&1 || { ${SYSTEM_PYTHON} -m pip install hashin; } for i in '' '-hw' '-binaries' '-wine-build' '-mac-build'; do rm -rf "$venv_dir" - virtualenv -p $(which python3) $venv_dir + virtualenv -p ${SYSTEM_PYTHON} $venv_dir source $venv_dir/bin/activate t@@ -23,7 +33,7 @@ for i in '' '-hw' '-binaries' '-wine-build' '-mac-build'; do echo "OK." requirements=$(pip freeze --all) - restricted=$(echo $requirements | $other_python $contrib/deterministic-build/find_restricted_dependencies.py) + restricted=$(echo $requirements | ${SYSTEM_PYTHON} $contrib/deterministic-build/find_restricted_dependencies.py) requirements="$requirements $restricted" echo "Generating package hashes..." t@@ -32,7 +42,7 @@ for i in '' '-hw' '-binaries' '-wine-build' '-mac-build'; do for requirement in $requirements; do echo -e "\r Hashing $requirement..." - $other_python -m hashin -r $contrib/deterministic-build/requirements${i}.txt ${requirement} + ${SYSTEM_PYTHON} -m hashin -r $contrib/deterministic-build/requirements${i}.txt ${requirement} done echo "OK."