You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible-common/scripts/pip-pgks-offline-install.sh

36 lines
975 B
Bash

#!/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