Skip to content

Commit

Permalink
test-upgrade.sh: install python libraries without upgrading.
Browse files Browse the repository at this point in the history
We want to avoid "upgrading" python libraries using pip, because this
may not give predictable results, and if installation fails it can
leave the system in a broken half-installed state.  Instead, we want
to install packages from scratch whenever it is required.

To be consistent with the new behavior of the git update hook, do the
same thing when running upgrade tests: rather than "upgrading" the
virtualenv directory, delete the old one and create a new one.  This
makes caching simpler, too, since the directory contents should be
reproducible just from requirements.txt.
  • Loading branch information
Benjamin Moody committed Mar 21, 2023
1 parent cfb893c commit 425d21a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,14 @@ export PATH=$venvdir/bin:$PATH

msg_testing "Installing new requirements"
if ! cmp -s "$olddir/requirements.txt" "$topdir/requirements.txt"; then
cachefile=$venvcachedir/$old_reqs_hash-$new_reqs_hash.tar.gz
prereq_cmd rm -rf "$venvdir"
cachefile=$venvcachedir/$new_reqs_hash.tar.gz
if [ -n "$venvcachedir" ] && [ -f "$cachefile" ]; then
prereq_cmd rm -rf "$venvdir"
prereq_cmd mkdir "$venvdir"
prereq_cmd tar -xzf "$cachefile" -C "$venvdir"
else
prereq_cmd virtualenv --quiet --quiet \
--no-download -ppython3 "$venvdir"
prereq_cmd pip3 install --require-hashes \
-r "$topdir/requirements.txt"
if [ -n "$venvcachedir" ]; then
Expand Down

0 comments on commit 425d21a

Please sign in to comment.