freeze_packages.sh (1674B)
1 #!/bin/bash 2 # Run this after a new release to update dependencies 3 4 set -e 5 6 venv_dir=~/.electrum-venv 7 contrib=$(dirname "$0") 8 9 # note: we should not use a higher version of python than what the binaries bundle 10 if [[ ! "$SYSTEM_PYTHON" ]] ; then 11 SYSTEM_PYTHON=$(which python3.6) || printf "" 12 else 13 SYSTEM_PYTHON=$(which $SYSTEM_PYTHON) || printf "" 14 fi 15 if [[ ! "$SYSTEM_PYTHON" ]] ; then 16 echo "Please specify which python to use in \$SYSTEM_PYTHON" && exit 1; 17 fi 18 19 which virtualenv > /dev/null 2>&1 || { echo "Please install virtualenv" && exit 1; } 20 21 ${SYSTEM_PYTHON} -m hashin -h > /dev/null 2>&1 || { ${SYSTEM_PYTHON} -m pip install hashin; } 22 23 for i in '' '-hw' '-binaries' '-binaries-mac' '-build-wine' '-build-mac' '-build-sdist' '-build-appimage'; do 24 rm -rf "$venv_dir" 25 virtualenv -p ${SYSTEM_PYTHON} $venv_dir 26 27 source $venv_dir/bin/activate 28 29 echo "Installing dependencies... (requirements${i}.txt)" 30 31 python -m pip install -r "$contrib/requirements/requirements${i}.txt" --upgrade 32 33 echo "OK." 34 35 requirements=$(pip freeze --all) 36 restricted=$(echo $requirements | ${SYSTEM_PYTHON} $contrib/deterministic-build/find_restricted_dependencies.py) 37 requirements="$requirements $restricted" 38 39 echo "Generating package hashes... (requirements${i}.txt)" 40 rm "$contrib/deterministic-build/requirements${i}.txt" 41 touch "$contrib/deterministic-build/requirements${i}.txt" 42 43 for requirement in $requirements; do 44 echo -e "\r Hashing $requirement..." 45 ${SYSTEM_PYTHON} -m hashin -r "$contrib/deterministic-build/requirements${i}.txt" "${requirement}" 46 done 47 48 echo "OK." 49 done 50 51 echo "Done. Updated requirements"