Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Merge #33789
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Jul 3, 2022
2 parents 28d3469 + f6ba526 commit 0b744be
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
38 changes: 29 additions & 9 deletions build/bin/sage-dist-helpers
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@
# be given as arguments. If $SAGE_DESTDIR is not set then the command is
# run with $SAGE_SUDO, if set.
#
# - sdh_pip_install [--no-deps] [--build-isolation] [...]
# - sdh_pip_install [--no-deps] [--build-isolation] [--no-build-isolation] [...]
#
# Builds a wheel using `pip wheel` with the given options [...], then installs
# the wheel. Unless the special option --build-isolation is given,
# the wheel is built using the option --no-build-isolation.
# the wheel. Unless the special option --no-build-isolation is given,
# the wheel is built using build isolation.
# If the special option --no-deps is given, it is passed to pip install.
# If $SAGE_DESTDIR is not set then the command is run with $SAGE_SUDO, if
# set.
Expand Down Expand Up @@ -243,16 +243,20 @@ sdh_pip_install() {
rm -f dist/*.whl
install_options=""
# pip has --no-build-isolation but no flag that turns the default back on...
build_isolation_option="--no-build-isolation --no-binary :all:"
build_isolation_option="--find-links=$SAGE_SPKG_WHEELS"
while [ $# -gt 0 ]; do
case "$1" in
--build-isolation)
# If a package requests build isolation, we allow it to provision
# Our new default: We allow the package to provision
# its build environment using the stored wheels.
# We pass --find-links and remove the --no-binary option.
# We pass --find-links.
# The SPKG needs to declare "setuptools_wheel" as a dependency.
build_isolation_option="--find-links=$SAGE_SPKG_WHEELS"
;;
--no-build-isolation)
# Use --no-binary, so that no wheels from caches are used.
build_isolation_option="--no-build-isolation --no-binary :all:"
;;
--no-deps)
install_options="$install_options $1"
;;
Expand All @@ -262,9 +266,25 @@ sdh_pip_install() {
esac
shift
done
python3 -m pip wheel --wheel-dir=dist --verbose --no-deps --no-index --isolated --ignore-requires-python $build_isolation_option "$@" || \
sdh_die "Error building a wheel for $PKG_NAME"

if python3 -m pip wheel --wheel-dir=dist --verbose --no-deps --no-index --isolated --ignore-requires-python $build_isolation_option "$@"; then
: # successful
else
case $build_isolation_option in
*--no-build-isolation*)
sdh_die "Error building a wheel for $PKG_NAME"
;;
*)
echo >&2 "Warning: building with \"python3 -m pip wheel --wheel-dir=dist --verbose --no-deps --no-index --isolated --ignore-requires-python $build_isolation_option\" failed."
build_isolation_option="--no-build-isolation --no-binary :all:"
echo >&2 "Retrying with \"python3 -m pip wheel --wheel-dir=dist --verbose --no-deps --no-index --isolated --ignore-requires-python $build_isolation_option\"."
if python3 -m pip wheel --wheel-dir=dist --verbose --no-deps --no-index --isolated --ignore-requires-python $build_isolation_option "$@"; then
echo >&2 "Warning: Wheel building needed to use \"$build_isolation_option\" to succeed. This means that a dependencies file in build/pkgs/ needs to be updated. Please report this to sage-devel@googlegroups.com, including the build log of this package."
else
sdh_die "Error building a wheel for $PKG_NAME"
fi
;;
esac
fi
sdh_store_and_pip_install_wheel $install_options .
}

Expand Down
2 changes: 1 addition & 1 deletion build/pkgs/tomli/spkg-install.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cd src
# tomli's build system, flit_core, has a runtime dependency on tomli.
export PYTHONPATH="$(pwd)"
sdh_pip_install .
sdh_pip_install --no-build-isolation .

0 comments on commit 0b744be

Please sign in to comment.