Skip to content

Commit 6dbef07

Browse files
Tony Kukerrdmark
authored andcommitted
#1149 cache pip packages to explicit directory
1 parent 2ec4433 commit 6dbef07

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

easyinstall.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,17 @@ function installPackagesWeb() {
153153

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

161169
# compile the PiSCSI binaries

python/web/start.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ if ! test -e venv; then
5959
echo "Activating venv"
6060
source venv/bin/activate
6161
echo "Installing requirements.txt"
62-
pip3 install wheel
63-
pip3 install -r requirements.txt
62+
pip3 install wheel --no-index --find-links=$HOME/.pip_cache
63+
# Reference: https://pip.pypa.io/en/latest/user_guide/#installing-from-local-packages
64+
pip3 install -r requirements.txt --no-index --find-links=$HOME/.pip_cache
6465

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

0 commit comments

Comments
 (0)