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

Commit 760ff09

Browse files
author
Matthias Koeppe
committed
Merge #32751
2 parents f1f4759 + 8f3bd8f commit 760ff09

File tree

3 files changed

+30
-8
lines changed

3 files changed

+30
-8
lines changed

build/bin/sage-dist-helpers

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,12 @@
5656
# be given as arguments. If $SAGE_DESTDIR is not set then the command is
5757
# run with $SAGE_SUDO, if set.
5858
#
59-
# - sdh_pip_install [...]
59+
# - sdh_pip_install [--no-deps] [--build-isolation] [...]
6060
#
61-
# Runs `pip install` with the given arguments, as well as additional
62-
# default arguments used for installing packages into Sage with pip.
63-
# Currently this is just a wrapper around the `sage-pip-install` command.
61+
# Builds a wheel using `pip wheel` with the given options [...], then installs
62+
# the wheel. Unless the special option --build-isolation is given,
63+
# the wheel is built using the option --no-build-isolation.
64+
# If the special option --no-deps is given, it is passed to pip install.
6465
# If $SAGE_DESTDIR is not set then the command is run with $SAGE_SUDO, if
6566
# set.
6667
#
@@ -240,10 +241,31 @@ sdh_pip_install() {
240241
echo "Installing $PKG_NAME"
241242
mkdir -p dist
242243
rm -f dist/*.whl
243-
python3 -m pip wheel --wheel-dir=dist --no-binary :all: --verbose --no-deps --no-index --isolated --no-build-isolation --ignore-requires-python "$@" || \
244+
install_options=""
245+
# pip has --no-build-isolation but no flag that turns the default back on...
246+
build_isolation_option="--no-build-isolation --no-binary :all:"
247+
while [ $# -gt 0 ]; do
248+
case "$1" in
249+
--build-isolation)
250+
# If a package requests build isolation, we allow it to provision
251+
# its build environment using the stored wheels.
252+
# We pass --find-links and remove the --no-binary option.
253+
# The SPKG needs to declare "setuptools_wheel" as a dependency.
254+
build_isolation_option="--find-links=$SAGE_SPKG_WHEELS"
255+
;;
256+
--no-deps)
257+
install_options="$install_options $1"
258+
;;
259+
*)
260+
break
261+
;;
262+
esac
263+
shift
264+
done
265+
python3 -m pip wheel --wheel-dir=dist --verbose --no-deps --no-index --isolated --ignore-requires-python $build_isolation_option "$@" || \
244266
sdh_die "Error building a wheel for $PKG_NAME"
245267

246-
sdh_store_and_pip_install_wheel .
268+
sdh_store_and_pip_install_wheel $install_options .
247269
}
248270

249271
sdh_store_wheel() {

build/pkgs/packaging/dependencies

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$(PYTHON) | setuptools pip wheel pyparsing
1+
$(PYTHON) | setuptools pip wheel pyparsing setuptools_wheel
22

33
----------
44
All lines of this file are ignored except the first.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
cd src && sdh_pip_install .
1+
cd src && sdh_pip_install --build-isolation .

0 commit comments

Comments
 (0)