#!/bin/sh # This script will do an offline install of the packages defined by PIP_PKGS and # will install them from the tar.gzs defined by PIP_TARS_GZS. These variables # must be defined and each of them should be a space delimited list. set -u # TODO REM add a way to configure python. echo "Installing packages \"$PIP_PKGS\" from archives: $PIP_TARS_GZS" # Create temporary directories. # # Archives defined on PIP_TARS_GZS are extracted to `tmp`. The wheel files are # pulled out of `tmp` and put into `wheels`. mkdir tmp wheels # For each archive in PIP_TARS_GZS, extract the contents into tmp. for ARCHIVE in $PIP_TARS_GZS; do tar xvzf "$ARCHIVE" -C tmp/ done # Find all the `whl` files and copy them into `wheels`. find tmp -name "*.whl" -exec cp {} wheels/ \; # Install all packages defined in PIP_PKGS. # # shellcheck disable=SC2086 pip install \ --no-index \ --find-links=wheels/ \ $PIP_PKGS # Remove temporary directories. rm -rf tmp wheels