Skip to content

Commit

Permalink
#1149 cache pip packages to explicit directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Kuker committed Apr 28, 2023
1 parent 9c5296a commit ae7e56e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
14 changes: 11 additions & 3 deletions easyinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,17 @@ function installPackagesWeb() {

# cache the pip packages
function cachePipPackages(){
pushd $WEB_INSTALL_PATH
sudo pip3 install -r ./requirements.txt
popd
mkdir -p $HOME/.pip_cache
# Note: these need to be installed in source form ONLY. If the binary packages are installed, the architecture
# is selected based upon the building host architecture, not the target architecture. (so, if you're building
# a PiSCSI image on x86, pip will download x86 binaries, which aren't usefull on a Raspberry Pi
python3 -m pip download --no-binary :all: --destination-directory $HOME/.pip_cache setuptools
python3 -m pip download --no-binary :all: --destination-directory $HOME/.pip_cache wheel
python3 -m pip download --no-binary :all: --destination-directory $HOME/.pip_cache flit_core
python3 -m pip download --no-binary :all: --destination-directory $HOME/.pip_cache -r $WEB_INSTALL_PATH/requirements.txt
python3 -m pip download --no-binary :all: --destination-directory $HOME/.pip_cache -r $CTRLBOARD_INSTALL_PATH/requirements.txt
# TODO: The OLED requirements.txt includes a circuit python package that doesn't work with non-binary
# pip3 download
}

# compile the PiSCSI binaries
Expand Down
7 changes: 4 additions & 3 deletions python/web/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ if ! test -e venv; then
echo "Activating venv"
source venv/bin/activate
echo "Installing requirements.txt"
pip3 install wheel
pip3 install -r requirements.txt
pip3 install wheel --no-index --find-links=$HOME/.pip_cache
# Reference: https://pip.pypa.io/en/latest/user_guide/#installing-from-local-packages
pip3 install -r requirements.txt --no-index --find-links=$HOME/.pip_cache

if git rev-parse --is-inside-work-tree &> /dev/null; then
git rev-parse HEAD > current
Expand All @@ -79,7 +80,7 @@ if [[ $? -eq 0 ]]; then
git rev-parse > current
elif [ "$(cat current)" != "$(git rev-parse HEAD)" ]; then
echo "New version detected, updating libraries from requirements.txt"
pip3 install -r requirements.txt
pip3 install -r requirements.txt --no-index --find-links=$HOME/.pip_cache
git rev-parse HEAD > current
fi
else
Expand Down

0 comments on commit ae7e56e

Please sign in to comment.