This repository has been archived by the owner on Jan 30, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 't/29500/install_all_python_packages_via_pip_wheel__crea…
…te_pep_503_simple_repository_for_wheels' into t/30657/fix_up__sage__p_
- Loading branch information
Showing
8 changed files
with
136 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/env bash | ||
# This command ensures that any previous installations of the same package | ||
# are uninstalled. | ||
|
||
# Only argument must be "." and will be ignored. | ||
if [ $# -gt 1 ]; then | ||
echo >&2 "$0 requires . as only argument" | ||
exit 1 | ||
fi | ||
if [ "$1" != "." ]; then | ||
echo >&2 "$0 requires . as final argument" | ||
exit 1 | ||
fi | ||
|
||
# Note: We need to take care to specify the full path to Sage's Python here | ||
# to emphasize that this command should use it, and not the system Python; | ||
# see https://trac.sagemath.org/ticket/18438 | ||
# But now we delegate this to sage-python23. | ||
PYTHON=sage-python23 | ||
|
||
# The PIP variable is only used to determine the name of the lock file. | ||
PIP=pip3 | ||
|
||
# Find out the name of the package that we are installing | ||
name="$($PYTHON setup.py --name)" | ||
|
||
if [ $? -ne 0 ]; then | ||
echo >&2 "Error: could not determine package name" | ||
exit 1 | ||
fi | ||
|
||
if [ $(echo "$name" | wc -l) -gt 1 ]; then | ||
name="$(echo "$name" | tail -1)" | ||
echo >&2 "Warning: This package has a badly-behaved setup.py which outputs" | ||
echo >&2 "more than the package name for 'setup.py --name'; using the last" | ||
echo >&2 "line as the package name: $name" | ||
fi | ||
|
||
# We should avoid running pip while uninstalling a package because that | ||
# is prone to race conditions. Therefore, we use a lockfile while | ||
# running pip. This is implemented in the Python script sage-flock | ||
LOCK="$SAGE_LOCAL/var/lock/$PIP.lock" | ||
|
||
# Keep uninstalling as long as it succeeds | ||
while true; do | ||
out=$(sage-flock -x $LOCK $PYTHON -m pip uninstall --disable-pip-version-check -y "$name" 2>&1) | ||
if [ $? -ne 0 ]; then | ||
# Uninstall failed | ||
echo >&2 "$out" | ||
exit 1 | ||
fi | ||
|
||
# Uninstall succeeded, which may mean that the package was not | ||
# installed to begin with. | ||
if [[ "$out" != *"not installed" ]]; then | ||
break | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters