|
56 | 56 | # be given as arguments. If $SAGE_DESTDIR is not set then the command is
|
57 | 57 | # run with $SAGE_SUDO, if set.
|
58 | 58 | #
|
59 |
| -# - sdh_pip_install [...] |
| 59 | +# - sdh_pip_install [--no-deps] [--build-isolation] [...] |
60 | 60 | #
|
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. |
64 | 65 | # If $SAGE_DESTDIR is not set then the command is run with $SAGE_SUDO, if
|
65 | 66 | # set.
|
66 | 67 | #
|
@@ -240,10 +241,31 @@ sdh_pip_install() {
|
240 | 241 | echo "Installing $PKG_NAME"
|
241 | 242 | mkdir -p dist
|
242 | 243 | rm -f dist/*.whl
|
243 |
| - python3 -m pip wheel --use-feature=in-tree-build --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 --use-feature=in-tree-build --wheel-dir=dist --verbose --no-deps --no-index --isolated --ignore-requires-python $build_isolation_option "$@" || \ |
244 | 266 | sdh_die "Error building a wheel for $PKG_NAME"
|
245 | 267 |
|
246 |
| - sdh_store_and_pip_install_wheel . |
| 268 | + sdh_store_and_pip_install_wheel $install_options . |
247 | 269 | }
|
248 | 270 |
|
249 | 271 | sdh_store_wheel() {
|
|
0 commit comments