diff --git a/Makefile b/Makefile index 004a6750920..414398ddf0d 100644 --- a/Makefile +++ b/Makefile @@ -101,7 +101,7 @@ pypi-wheels: rm -f venv/var/lib/sage/installed/$$a-*; \ done for a in $(PYPI_WHEEL_PACKAGES); do \ - $(MAKE) SAGE_EDITABLE=no $$a; \ + $(MAKE) SAGE_EDITABLE=no SAGE_WHEELS=yes $$a; \ done @echo "Built wheels are in venv/var/lib/sage/wheels/" @@ -112,7 +112,7 @@ wheels: rm -f venv/var/lib/sage/installed/$$a-*; \ done for a in $(WHEEL_PACKAGES); do \ - $(MAKE) SAGE_EDITABLE=no $$a; \ + $(MAKE) SAGE_EDITABLE=no SAGE_WHEELS=yes $$a; \ done @echo "Built wheels are in venv/var/lib/sage/wheels/" diff --git a/build/bin/sage-build-env b/build/bin/sage-build-env index ed999b703f0..87cd0fde5f3 100644 --- a/build/bin/sage-build-env +++ b/build/bin/sage-build-env @@ -31,6 +31,10 @@ if [ "x$SAGE_BUILD_ENV_SOURCED" = "x" ]; then if [ "x$SAGE_EDITABLE" = "x" ]; then export SAGE_EDITABLE="$CONFIGURED_SAGE_EDITABLE" fi + # Likewise for SAGE_WHEELS + if [ "x$SAGE_WHEELS" = "x" ]; then + export SAGE_WHEELS="$CONFIGURED_SAGE_WHEELS" + fi # This is usually blank if the system GMP is used, or $SAGE_LOCAL otherwise if [ -n "$SAGE_GMP_PREFIX" ]; then diff --git a/build/bin/sage-build-env-config.in b/build/bin/sage-build-env-config.in index 58d6bd5e5d7..b00fd2a3f99 100644 --- a/build/bin/sage-build-env-config.in +++ b/build/bin/sage-build-env-config.in @@ -58,3 +58,4 @@ export SAGE_SUITESPARSE_PREFIX="@SAGE_SUITESPARSE_PREFIX@" export SAGE_CONFIGURE_FFLAS_FFPACK="@SAGE_CONFIGURE_FFLAS_FFPACK@" export CONFIGURED_SAGE_EDITABLE="@SAGE_EDITABLE@" +export CONFIGURED_SAGE_WHEELS="@SAGE_WHEELS@" diff --git a/build/pkgs/sagelib/spkg-install b/build/pkgs/sagelib/spkg-install index 473cfe06db8..8e5e97f2688 100755 --- a/build/pkgs/sagelib/spkg-install +++ b/build/pkgs/sagelib/spkg-install @@ -60,17 +60,30 @@ if [ "$SAGE_EDITABLE" = yes ]; then # under the old distribution name "sage" (before #30912, which switched to setuptools # and renamed the distribution to "sagemath-standard"). There is no clean way to uninstall # them, so we just use rm. - (cd "$SITEPACKAGESDIR" && rm -rf sage sage_setup sage-[1-9]*.egg-info sage-[1-9]*.dist-info) + (cd "$SITEPACKAGESDIR" && rm -rf sage sage-[1-9]*.egg-info sage-[1-9]*.dist-info) time sdh_pip_editable_install . + + if [ "$SAGE_WHEELS" = yes ]; then + # Additionally build a wheel (for use in other venvs) + cd $SAGE_PKGS/sagelib/src && time sdh_setup_bdist_wheel && sdh_store_wheel . + fi else # Make sure that an installed old version of sagelib in which sage is an ordinary package # does not shadow the namespace package sage during the build. (cd "$SITEPACKAGESDIR" && rm -f sage/__init__.py) # Likewise, we should remove the egg-link that may have been installed previously. (cd "$SITEPACKAGESDIR" && rm -f sagemath-standard.egg-link) - # Use --no-build-isolation to avoid rebuilds because of dependencies: - # Compiling sage/interfaces/sagespawn.pyx because it depends on /private/var/folders/38/wnh4gf1552g_crsjnv2vmmww0000gp/T/pip-build-env-609n5985/overlay/lib/python3.10/site-packages/Cython/Includes/posix/unistd.pxd - time sdh_pip_install --no-build-isolation . + + if [ "$SAGE_WHEELS" = yes ]; then + # Use --no-build-isolation to avoid rebuilds because of dependencies: + # Compiling sage/interfaces/sagespawn.pyx because it depends on /private/var/folders/38/wnh4gf1552g_crsjnv2vmmww0000gp/T/pip-build-env-609n5985/overlay/lib/python3.10/site-packages/Cython/Includes/posix/unistd.pxd + time sdh_pip_install --no-build-isolation . + else + # We no longer use the install-cleaner for installation directory cleaning. + # So uninstall first. + time sdh_pip_uninstall sagemath-standard + time python3 -u setup.py --no-user-cfg build install || exit 1 + fi fi # Trac #33103: The temp.* directories are large after a full build. diff --git a/configure.ac b/configure.ac index 10351b8c416..ca5003e83e0 100644 --- a/configure.ac +++ b/configure.ac @@ -132,6 +132,12 @@ AC_ARG_ENABLE([editable], [AC_SUBST([SAGE_EDITABLE], [$enableval])], [AC_SUBST([SAGE_EDITABLE], [yes])]) +AC_ARG_ENABLE([wheels], + [AS_HELP_STRING([--enable-wheels], + [build and update wheels for the Sage library])], + [AC_SUBST([SAGE_WHEELS], [$enableval])], + []) + # Check whether we are on a supported platform AC_CANONICAL_BUILD() AC_CANONICAL_HOST()