Skip to content

Commit 2d5477e

Browse files
author
Release Manager
committed
gh-37857: Replace special handling of optional extensions (bliss, coxeter3, ....) <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes #12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes #12345". --> We relieve the distribution **sagemath-standard** (in both versions - `SAGE_ROOT/pkgs/sagemath-standard` and `SAGE_ROOT/src`) from the duty to build "optional extensions" based on what Sage packages are installed. The installation is now done uniformly using the modularized distributions **sagemath-bliss**, **sagemath-coxeter3** etc. We introduce the missing features `coxeter3` and `sirocco` so that the doctester does not have to rely on the sage-the-distro installation records any more. The wheels of the distributions now build correctly even when not going through building an sdist first, which previously was required to apply MANIFEST-based filtering. This is achieved using the new `sage_setup.command.build_py`. User-visible change: - To install these options, use `./configure --enable-sagemath_bliss` before building, or use `./sage -i sagemath_bliss` or `make sagemath_bliss`. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - #12345: short description why this is a dependency --> <!-- - #34567: ... --> - Depends on #37737 (merged here) - Depends on #37973 (merged here) URL: #37857 Reported by: Matthias Köppe Reviewer(s): François Bissey
2 parents 1e38432 + d4864f8 commit 2d5477e

38 files changed

+174
-65
lines changed

build/pkgs/sagelib/spkg-install.in

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,10 @@ unset SAGE_PKG_CONFIG_PATH
4343

4444
SITEPACKAGESDIR=$(python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])')
4545

46-
export SAGE_OPTIONAL_PACKAGES_WITH_EXTENSIONS=""
47-
46+
# Make sure that an installed old version of sagelib in which sage is an ordinary package
47+
# does not shadow the namespace package sage during the build.
48+
(cd "$SITEPACKAGESDIR" && rm -f sage/__init__.py)
4849
if [ "$SAGE_EDITABLE" = yes ]; then
49-
# In an incremental build, we may need to uninstall old versions installed by distutils
50-
# under the old distribution name "sage" (before #30912, which switched to setuptools
51-
# and renamed the distribution to "sagemath-standard"). There is no clean way to uninstall
52-
# them, so we just use rm.
53-
(cd "$SITEPACKAGESDIR" && rm -rf sage sage-[1-9]*.egg-info sage-[1-9]*.dist-info)
5450
# Until https://github.com/sagemath/sage/issues/34209 switches us to PEP 660 editable wheels
5551
export SETUPTOOLS_ENABLE_FEATURES=legacy-editable
5652
sdh_pip_editable_install .
@@ -61,12 +57,8 @@ if [ "$SAGE_EDITABLE" = yes ]; then
6157
fi
6258
else
6359
# Now implied: "$SAGE_WHEELS" = yes
64-
# Make sure that an installed old version of sagelib in which sage is an ordinary package
65-
# does not shadow the namespace package sage during the build.
66-
(cd "$SITEPACKAGESDIR" && rm -f sage/__init__.py)
67-
# Likewise, we should remove the egg-link that may have been installed previously.
60+
# We should remove the egg-link that may have been installed previously.
6861
(cd "$SITEPACKAGESDIR" && rm -f sagemath-standard.egg-link)
69-
7062
# Use --no-build-isolation to avoid rebuilds because of dependencies:
7163
# 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
7264
sdh_pip_install --no-build-isolation .

build/pkgs/sagemath_bliss/spkg-install.in

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@ cd src
33
export PIP_NO_INDEX=true
44
export PIP_FIND_LINKS="file://$SAGE_SPKG_WHEELS"
55

6-
if [ "$SAGE_EDITABLE" = yes ]; then
7-
# SAGE_ROOT/src/setup.py installs everything, nothing to do...
8-
if [ "$SAGE_WHEELS" = yes ]; then
9-
# ... except we build the wheel if requested
10-
sdh_setup_bdist_wheel && sdh_store_wheel .
11-
fi
12-
else
13-
# Modularized install via wheels. Now implied: "$SAGE_WHEELS" = yes
14-
sdh_pip_install .
15-
fi
6+
# Modularized install via wheels
7+
# --no-build-isolation so that declared build dependencies,
8+
# in particular sagemath-environment do not have to be present as wheels.
9+
sdh_pip_install --no-build-isolation .
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
meataxe | $(PYTHON_TOOLCHAIN) sage_setup sagemath_environment cython pkgconfig $(PYTHON)
1+
meataxe cysignals | $(PYTHON_TOOLCHAIN) sage_setup sagemath_environment cython pkgconfig $(PYTHON)

pkgs/sagemath-bliss/setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@
4242

4343
from sage_setup.command.sage_build_cython import sage_build_cython
4444
from sage_setup.command.sage_build_ext import sage_build_ext
45+
from sage_setup.command.sage_build_py import sage_build_py
4546
sage_build_cython.built_distributions = ['sagemath-bliss']
4647

4748
cmdclass = dict(build_cython=sage_build_cython,
48-
build_ext=sage_build_ext)
49+
build_ext=sage_build_ext,
50+
build_py=sage_build_py)
4951

5052
from sage_setup.find import find_python_sources
5153
python_packages, python_modules, cython_modules = find_python_sources(

pkgs/sagemath-coxeter3/setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@
4242

4343
from sage_setup.command.sage_build_cython import sage_build_cython
4444
from sage_setup.command.sage_build_ext import sage_build_ext
45+
from sage_setup.command.sage_build_py import sage_build_py
4546
sage_build_cython.built_distributions = ['sagemath-coxeter3']
4647

4748
cmdclass = dict(build_cython=sage_build_cython,
48-
build_ext=sage_build_ext)
49+
build_ext=sage_build_ext,
50+
build_py=sage_build_py)
4951

5052
from sage_setup.find import find_python_sources
5153
python_packages, python_modules, cython_modules = find_python_sources(

pkgs/sagemath-mcqd/setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@
4242

4343
from sage_setup.command.sage_build_cython import sage_build_cython
4444
from sage_setup.command.sage_build_ext import sage_build_ext
45+
from sage_setup.command.sage_build_py import sage_build_py
4546
sage_build_cython.built_distributions = ['sagemath-mcqd']
4647

4748
cmdclass = dict(build_cython=sage_build_cython,
48-
build_ext=sage_build_ext)
49+
build_ext=sage_build_ext,
50+
build_py=sage_build_py)
4951

5052
from sage_setup.find import find_python_sources
5153
python_packages, python_modules, cython_modules = find_python_sources(

pkgs/sagemath-meataxe/setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@
4242

4343
from sage_setup.command.sage_build_cython import sage_build_cython
4444
from sage_setup.command.sage_build_ext import sage_build_ext
45+
from sage_setup.command.sage_build_py import sage_build_py
4546
sage_build_cython.built_distributions = ['sagemath-meataxe']
4647

4748
cmdclass = dict(build_cython=sage_build_cython,
48-
build_ext=sage_build_ext)
49+
build_ext=sage_build_ext,
50+
build_py=sage_build_py)
4951

5052
from sage_setup.find import find_python_sources
5153
python_packages, python_modules, cython_modules = find_python_sources(

pkgs/sagemath-sirocco/setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@
4242

4343
from sage_setup.command.sage_build_cython import sage_build_cython
4444
from sage_setup.command.sage_build_ext import sage_build_ext
45+
from sage_setup.command.sage_build_py import sage_build_py
4546
sage_build_cython.built_distributions = ['sagemath-sirocco']
4647

4748
cmdclass = dict(build_cython=sage_build_cython,
48-
build_ext=sage_build_ext)
49+
build_ext=sage_build_ext,
50+
build_py=sage_build_py)
4951

5052
from sage_setup.find import find_python_sources
5153
python_packages, python_modules, cython_modules = find_python_sources(

pkgs/sagemath-standard/setup.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,7 @@
7272
# TODO: This should be quiet by default
7373
print("Discovering Python/Cython source code....")
7474
t = time.time()
75-
from sage.misc.package import is_package_installed_and_updated
7675
distributions = ['']
77-
optional_packages_with_extensions = os.environ.get('SAGE_OPTIONAL_PACKAGES_WITH_EXTENSIONS', '').split(',')
78-
distributions += ['sagemath-{}'.format(pkg)
79-
for pkg in optional_packages_with_extensions
80-
if is_package_installed_and_updated(pkg)]
8176
log.warn('distributions = {0}'.format(distributions))
8277
from sage_setup.find import find_python_sources
8378
python_packages, python_modules, cython_modules = find_python_sources(

pkgs/sagemath-tdlib/setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@
4242

4343
from sage_setup.command.sage_build_cython import sage_build_cython
4444
from sage_setup.command.sage_build_ext import sage_build_ext
45+
from sage_setup.command.sage_build_py import sage_build_py
4546
sage_build_cython.built_distributions = ['sagemath-tdlib']
4647

4748
cmdclass = dict(build_cython=sage_build_cython,
48-
build_ext=sage_build_ext)
49+
build_ext=sage_build_ext,
50+
build_py=sage_build_py)
4951

5052
from sage_setup.find import find_python_sources
5153
python_packages, python_modules, cython_modules = find_python_sources(

0 commit comments

Comments
 (0)