diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cfcd9f6dc6c..eec448fed1f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,18 +25,11 @@ jobs: container: ghcr.io/sagemath/sage/sage-docker-${{ github.event.inputs.platform || 'ubuntu-focal-standard' }}-with-targets:${{ github.event.inputs.docker_tag || 'dev'}} steps: - name: Checkout + id: checkout uses: actions/checkout@v2 - - name: Set up node to install pyright - uses: actions/setup-node@v1 - with: - node-version: '12' - - - name: Install pyright - # Fix to v232 due to bug https://github.com/microsoft/pyright/issues/3239 - run: npm install -g pyright@1.1.232 - - name: Prepare + id: prepare run: | # Install test tools. if apt-get update && apt-get install -y git python3-venv; then @@ -53,10 +46,31 @@ jobs: ./bootstrap ./configure --enable-build-as-root --prefix=/sage/local --with-sage-venv --enable-editable --enable-download-from-upstream-url + - name: Build and test modularized distributions + if: always() && steps.prepare.outcome == 'success' + run: make V=0 tox && make pypi-wheels + env: + MAKE: make -j2 + SAGE_NUM_THREADS: 2 + + - name: Set up node to install pyright + if: always() && steps.prepare.outcome == 'success' + uses: actions/setup-node@v1 + with: + node-version: '12' + + - name: Install pyright + if: always() && steps.prepare.outcome == 'success' + # Fix to v232 due to bug https://github.com/microsoft/pyright/issues/3239 + run: npm install -g pyright@1.1.232 + - name: Static code check with pyright + if: always() && steps.prepare.outcome == 'success' run: pyright - name: Build + id: build + if: always() && steps.prepare.outcome == 'success' run: make build env: MAKE: make -j2 @@ -73,20 +87,21 @@ jobs: COLUMNS: 120 - name: Test + if: always() && steps.build.outcome == 'success' run: | ../sage -python -m pip install coverage ../sage -python -m coverage run ./bin/sage-runtests --all -p2 working-directory: ./src - name: Prepare coverage results - if: always() + if: always() && steps.build.outcome == 'success' run: | ./venv/bin/python3 -m coverage combine src/.coverage/ ./venv/bin/python3 -m coverage xml find . -name *coverage* - name: Upload coverage to codecov - if: always() + if: always() && steps.build.outcome == 'success' uses: codecov/codecov-action@v2 with: files: ./coverage.xml diff --git a/Makefile b/Makefile index ed376cfa0e1..004a6750920 100644 --- a/Makefile +++ b/Makefile @@ -92,6 +92,30 @@ pypi-sdists: sage_setup ./sage --sh build/pkgs/sagemath_repl/spkg-src @echo "Built sdists are in upstream/" +# Ensuring wheels are present, even for packages that may have been installed +# as editable. Until we have better uninstallation of script packages, we +# just remove the timestamps, which will lead to rebuilds of the packages. +PYPI_WHEEL_PACKAGES = sage_sws2rst sage_setup sagemath_environment sagemath_objects sagemath_repl sagemath_categories +pypi-wheels: + for a in $(PYPI_WHEEL_PACKAGES); do \ + rm -f venv/var/lib/sage/installed/$$a-*; \ + done + for a in $(PYPI_WHEEL_PACKAGES); do \ + $(MAKE) SAGE_EDITABLE=no $$a; \ + done + @echo "Built wheels are in venv/var/lib/sage/wheels/" + +# sage_docbuild is here, not in PYPI_WHEEL_PACKAGES, because it depends on sagelib +WHEEL_PACKAGES = $(PYPI_WHEEL_PACKAGES) sage_conf sagelib sage_docbuild +wheels: + for a in $(WHEEL_PACKAGES); do \ + rm -f venv/var/lib/sage/installed/$$a-*; \ + done + for a in $(WHEEL_PACKAGES); do \ + $(MAKE) SAGE_EDITABLE=no $$a; \ + done + @echo "Built wheels are in venv/var/lib/sage/wheels/" + ############################################################################### # Cleaning up ############################################################################### @@ -356,6 +380,7 @@ list: @$(MAKE) --silent -f build/make/Makefile SAGE_PKGCONFIG=dummy $@ .PHONY: default build dist install micro_release \ + pypi-sdists pypi-wheels wheels \ misc-clean bdist-clean distclean bootstrap-clean maintainer-clean \ test check testoptional testall testlong testoptionallong testallong \ ptest ptestoptional ptestall ptestlong ptestoptionallong ptestallong \ diff --git a/build/bin/sage-build-env b/build/bin/sage-build-env index ddda5ce212d..ed999b703f0 100644 --- a/build/bin/sage-build-env +++ b/build/bin/sage-build-env @@ -27,6 +27,10 @@ if [ "x$SAGE_BUILD_ENV_SOURCED" = "x" ]; then if [ "x$SAGE_DEBUG" = "x" ]; then export SAGE_DEBUG="$CONFIGURED_SAGE_DEBUG" fi + # Likewise for SAGE_EDITABLE + if [ "x$SAGE_EDITABLE" = "x" ]; then + export SAGE_EDITABLE="$CONFIGURED_SAGE_EDITABLE" + 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 92e7dadba06..58d6bd5e5d7 100644 --- a/build/bin/sage-build-env-config.in +++ b/build/bin/sage-build-env-config.in @@ -57,4 +57,4 @@ export SAGE_SUITESPARSE_PREFIX="@SAGE_SUITESPARSE_PREFIX@" export SAGE_CONFIGURE_FFLAS_FFPACK="@SAGE_CONFIGURE_FFLAS_FFPACK@" -export SAGE_EDITABLE="@SAGE_EDITABLE@" +export CONFIGURED_SAGE_EDITABLE="@SAGE_EDITABLE@" diff --git a/build/pkgs/python_build/SPKG.rst b/build/pkgs/python_build/SPKG.rst new file mode 100644 index 00000000000..9249861c610 --- /dev/null +++ b/build/pkgs/python_build/SPKG.rst @@ -0,0 +1,18 @@ +python_build: A simple, correct PEP517 package builder +====================================================== + +Description +----------- + +``build`` is a simple, correct PEP517 package builder + +License +------- + +MIT + +Upstream Contact +---------------- + +https://pypi.org/project/build/ + diff --git a/build/pkgs/python_build/dependencies b/build/pkgs/python_build/dependencies new file mode 100644 index 00000000000..769e08a8c26 --- /dev/null +++ b/build/pkgs/python_build/dependencies @@ -0,0 +1,4 @@ +$(PYTHON) pyparsing tomli packaging | $(PYTHON_TOOLCHAIN) + +---------- +All lines of this file are ignored except the first. diff --git a/build/pkgs/python_build/requirements.txt b/build/pkgs/python_build/requirements.txt new file mode 100644 index 00000000000..378eac25d31 --- /dev/null +++ b/build/pkgs/python_build/requirements.txt @@ -0,0 +1 @@ +build diff --git a/build/pkgs/python_build/type b/build/pkgs/python_build/type new file mode 100644 index 00000000000..134d9bc32d5 --- /dev/null +++ b/build/pkgs/python_build/type @@ -0,0 +1 @@ +optional diff --git a/build/pkgs/sage_conf/install-requires.txt b/build/pkgs/sage_conf/install-requires.txt index 2d13b49ef28..8ec83b2b905 100644 --- a/build/pkgs/sage_conf/install-requires.txt +++ b/build/pkgs/sage_conf/install-requires.txt @@ -1 +1,2 @@ -sage-conf ~= 9.7.b3 +# This file is updated on every release by the sage-update-version script +sage-conf ~= 9.7b6 diff --git a/build/pkgs/sage_docbuild/install-requires.txt b/build/pkgs/sage_docbuild/install-requires.txt index b6e14e76015..9199fde5772 100644 --- a/build/pkgs/sage_docbuild/install-requires.txt +++ b/build/pkgs/sage_docbuild/install-requires.txt @@ -1 +1,2 @@ -sage_docbuild +# This file is updated on every release by the sage-update-version script +sage-docbuild ~= 9.7b6 diff --git a/build/pkgs/sage_setup/install-requires.txt b/build/pkgs/sage_setup/install-requires.txt index 17adea02d63..4497f3f35a9 100644 --- a/build/pkgs/sage_setup/install-requires.txt +++ b/build/pkgs/sage_setup/install-requires.txt @@ -1 +1,2 @@ -sage-setup ~= 9.7.b3 +# This file is updated on every release by the sage-update-version script +sage-setup ~= 9.7b6 diff --git a/build/pkgs/sage_sws2rst/install-requires.txt b/build/pkgs/sage_sws2rst/install-requires.txt index b489fda6aeb..aabd0d31807 100644 --- a/build/pkgs/sage_sws2rst/install-requires.txt +++ b/build/pkgs/sage_sws2rst/install-requires.txt @@ -1 +1,2 @@ -sage_sws2rst +# This file is updated on every release by the sage-update-version script +sage-sws2rst ~= 9.7b6 diff --git a/build/pkgs/sagelib/install-requires.txt b/build/pkgs/sagelib/install-requires.txt index 29a9a5df969..35f845894d6 100644 --- a/build/pkgs/sagelib/install-requires.txt +++ b/build/pkgs/sagelib/install-requires.txt @@ -1 +1,2 @@ -sagemath-standard +# This file is updated on every release by the sage-update-version script +sagelib ~= 9.7b6 diff --git a/build/pkgs/sagemath_categories/install-requires.txt b/build/pkgs/sagemath_categories/install-requires.txt index e35667f8201..da1b503c697 100644 --- a/build/pkgs/sagemath_categories/install-requires.txt +++ b/build/pkgs/sagemath_categories/install-requires.txt @@ -1 +1,2 @@ -sagemath-categories ~= 9.5b6 +# This file is updated on every release by the sage-update-version script +sagemath-categories ~= 9.7b6 diff --git a/build/pkgs/sagemath_environment/install-requires.txt b/build/pkgs/sagemath_environment/install-requires.txt index bea4334d7e4..1dd6c84bc68 100644 --- a/build/pkgs/sagemath_environment/install-requires.txt +++ b/build/pkgs/sagemath_environment/install-requires.txt @@ -1 +1,2 @@ -sagemath-environment == 9.6rc3.post2 +# This file is updated on every release by the sage-update-version script +sagemath-environment ~= 9.7b6 diff --git a/build/pkgs/sagemath_objects/dependencies b/build/pkgs/sagemath_objects/dependencies index 9aff58ee6b1..217821d206b 100644 --- a/build/pkgs/sagemath_objects/dependencies +++ b/build/pkgs/sagemath_objects/dependencies @@ -1,4 +1,4 @@ -FORCE $(PYTHON) cysignals gmpy2 ipython | $(PYTHON_TOOLCHAIN) cython pkgconfig +FORCE $(PYTHON) cysignals gmpy2 ipython | $(PYTHON_TOOLCHAIN) sage_setup cython pkgconfig python_build # FORCE: Always run the spkg-install script # ipython - for the doctester diff --git a/build/pkgs/sagemath_objects/install-requires.txt b/build/pkgs/sagemath_objects/install-requires.txt index 06766454a53..b28d0b381ca 100644 --- a/build/pkgs/sagemath_objects/install-requires.txt +++ b/build/pkgs/sagemath_objects/install-requires.txt @@ -1,2 +1,2 @@ -# Pinned in Trac #29941 until proper namespace packages are supported in #28925. -sagemath-objects == 9.6rc3.post4 +# This file is updated on every release by the sage-update-version script +sagemath-objects ~= 9.7b6 diff --git a/build/pkgs/sagemath_objects/spkg-install b/build/pkgs/sagemath_objects/spkg-install index 59e83e7010f..5c2ab2350c4 100755 --- a/build/pkgs/sagemath_objects/spkg-install +++ b/build/pkgs/sagemath_objects/spkg-install @@ -1,8 +1,33 @@ #!/usr/bin/env bash +# From sage-spkg. +# For type=script packages, the build rule in build/make/Makefile sources +# sage-env but not sage-dist-helpers. +lib="$SAGE_ROOT/build/bin/sage-dist-helpers" +source "$lib" +if [ $? -ne 0 ]; then + echo >&2 "Error: failed to source $lib" + echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?" + exit 1 +fi cd src +export PIP_NO_INDEX=true +export PIP_FIND_LINKS="file://$SAGE_SPKG_WHEELS" + +# First build the sdist, then build the wheel from the sdist. +# https://pypa-build.readthedocs.io/en/latest/#python--m-build +# (Important because sagemath-objects uses MANIFEST.in for filtering.) +# Do not install the wheel. +DIST_DIR="$(mktemp -d)" +if ! python3 -m build --outdir "$DIST_DIR"/dist .; then + # This happens on Debian without python3-venv installed - "ensurepip" is missing + echo "Falling back to --no-isolation" + python3 -m build --no-isolation --outdir "$DIST_DIR"/dist . || sdh_die "Failure building sdist and wheel" +fi + +wheel=$(cd "$DIST_DIR" && sdh_store_wheel . && echo $wheel) +ls -l "$wheel" + if [ "$SAGE_CHECK" != no ]; then - tox + tox -v -e sagepython-norequirements --installpkg "$wheel" fi -# We skip the install for now. -exit 0 diff --git a/build/pkgs/tox/install-requires.txt b/build/pkgs/tox/install-requires.txt index 053148f8486..ffbf4099ae8 100644 --- a/build/pkgs/tox/install-requires.txt +++ b/build/pkgs/tox/install-requires.txt @@ -1 +1 @@ -tox +tox >= 3.21.4 diff --git a/build/pkgs/tox/spkg-configure.m4 b/build/pkgs/tox/spkg-configure.m4 index 40f9a596fb6..98918e97397 100644 --- a/build/pkgs/tox/spkg-configure.m4 +++ b/build/pkgs/tox/spkg-configure.m4 @@ -1,8 +1,6 @@ SAGE_SPKG_CONFIGURE([tox], [ - dnl src/tox.ini has only minimal version requirements. We use 2.5.0 just to set a baseline. - dnl (SAGE_ROOT/tox.ini needs negated factor conditions introduced in 3.0.0, but it is - dnl best to run it with system tox anyway.) - m4_pushdef([TOX_MIN_VERSION], [2.5.0]) + dnl Use non-ancient tox with full support for PEP 517. + m4_pushdef([TOX_MIN_VERSION], [3.21.4]) AC_CACHE_CHECK([for tox >= ]TOX_MIN_VERSION, [ac_cv_path_TOX], [ AC_PATH_PROGS_FEATURE_CHECK([TOX], [tox], [ tox_version=$($ac_path_TOX --version 2> /dev/null | tail -1) diff --git a/pkgs/sagemath-categories/setup.cfg.m4 b/pkgs/sagemath-categories/setup.cfg.m4 index 6bf81129de3..4ba67f86fdb 100644 --- a/pkgs/sagemath-categories/setup.cfg.m4 +++ b/pkgs/sagemath-categories/setup.cfg.m4 @@ -30,6 +30,7 @@ install_requires = esyscmd(`sage-get-system-packages install-requires \ cython \ pkgconfig \ + ipython \ gmpy2 \ cysignals \ | sed "2,\$s/^/ /;"')dnl diff --git a/pkgs/sagemath-categories/tox.ini b/pkgs/sagemath-categories/tox.ini index 1de9266d941..7ac63bae0ec 100644 --- a/pkgs/sagemath-categories/tox.ini +++ b/pkgs/sagemath-categories/tox.ini @@ -7,33 +7,38 @@ # pkgs/sagemath-categories/.tox/sagepython/bin/python # [tox] +envlist = + sagepython-norequirements [testenv] -deps = -rrequirements.txt +deps = + !norequirements: -rrequirements.txt setenv = # Sage scripts such as sage-runtests like to use $HOME/.sage HOME={envdir} passenv = - SAGE_NUM_THREADS - SAGE_NUM_THREADS_PARALLEL + # Parallel build + SAGE_NUM_THREADS + SAGE_NUM_THREADS_PARALLEL + # SAGE_VENV only for referring to the basepython + sagepython: SAGE_VENV whitelist_externals = bash - commands = # Beware of the treacherous non-src layout. "./sage/" shadows the install sage package. - python -c 'import sys; "" in sys.path and sys.path.remove(""); import sage.cpython.builtin_types, sage.cpython.cython_metaclass, sage.cpython.debug, sage.structure.all, sage.categories.all' + {envpython} -c 'import sys; "" in sys.path and sys.path.remove(""); import sage.cpython.builtin_types, sage.cpython.cython_metaclass, sage.cpython.debug, sage.structure.all, sage.categories.all' # Test that importing sage.categories.all initializes categories - python -c 'import sys; "" in sys.path and sys.path.remove(""); from sage.categories.all import *; SimplicialComplexes(); FunctionFields()' + {envpython} -c 'import sys; "" in sys.path and sys.path.remove(""); from sage.categories.all import *; SimplicialComplexes(); FunctionFields()' bash -c 'cd bin && SAGE_SRC=$(python -c "from sage.env import SAGE_SRC; print(SAGE_SRC)") && sage-runtests --environment=sage.all__sagemath_categories --optional=sage $SAGE_SRC/sage/structure || echo "(lots of doctest failures are expected)"' [testenv:sagepython] -passenv = - SAGE_VENV +basepython = {env:SAGE_VENV}/bin/python3 +[testenv:sagepython-norequirements] basepython = {env:SAGE_VENV}/bin/python3 diff --git a/pkgs/sagemath-environment/tox.ini b/pkgs/sagemath-environment/tox.ini index 8af948f4676..890ffdf0015 100644 --- a/pkgs/sagemath-environment/tox.ini +++ b/pkgs/sagemath-environment/tox.ini @@ -1,34 +1,41 @@ # To build and test in the tox environment: # -# ./sage -sh -c '(cd pkgs/sagemath-environment && tox -v -v)' +# ./sage -sh -c '(cd pkgs/sagemath-environment && tox -v -v -e sagepython)' # # To test interactively: # -# pkgs/sagemath-environment/.tox/python/bin/python +# pkgs/sagemath-environment/.tox/sagepython/bin/python # [tox] +envlist = + sagepython-norequirements + isolated_build = True [testenv] -deps = -rrequirements.txt +deps = + !norequirements: -rrequirements.txt setenv = # Sage scripts such as sage-runtests like to use $HOME/.sage HOME={envdir} passenv = - SAGE_NUM_THREADS - SAGE_NUM_THREADS_PARALLEL + # Parallel build + SAGE_NUM_THREADS + SAGE_NUM_THREADS_PARALLEL + # SAGE_VENV only for referring to the basepython + sagepython: SAGE_VENV whitelist_externals = bash commands = # Beware of the treacherous non-src layout. "./sage/" shadows the installed sage package. - python -c 'import sys; "" in sys.path and sys.path.remove(""); from sage.features.all import all_features; print(sorted(all_features(), key=lambda x: x.name)); import sage.misc.package' + {envpython} -c 'import sys; "" in sys.path and sys.path.remove(""); from sage.features.all import all_features; print(sorted(all_features(), key=lambda x: x.name)); import sage.misc.package' [testenv:sagepython] -passenv = - SAGE_VENV +basepython = {env:SAGE_VENV}/bin/python3 +[testenv:sagepython-norequirements] basepython = {env:SAGE_VENV}/bin/python3 diff --git a/pkgs/sagemath-objects/setup.cfg.m4 b/pkgs/sagemath-objects/setup.cfg.m4 index 34a4ffd2bc6..00c65ca9f8a 100644 --- a/pkgs/sagemath-objects/setup.cfg.m4 +++ b/pkgs/sagemath-objects/setup.cfg.m4 @@ -30,6 +30,7 @@ install_requires = esyscmd(`sage-get-system-packages install-requires \ cython \ pkgconfig \ + ipython \ gmpy2 \ cysignals \ | sed "2,\$s/^/ /;"')dnl diff --git a/pkgs/sagemath-objects/tox.ini b/pkgs/sagemath-objects/tox.ini index 9be3fc7605d..e03cbab1c3c 100644 --- a/pkgs/sagemath-objects/tox.ini +++ b/pkgs/sagemath-objects/tox.ini @@ -7,31 +7,37 @@ # pkgs/sagemath-objects/.tox/sagepython/bin/python # [tox] +envlist = + sagepython-norequirements [testenv] -deps = -rrequirements.txt +deps = + !norequirements: -rrequirements.txt setenv = # Sage scripts such as sage-runtests like to use $HOME/.sage HOME={envdir} passenv = - SAGE_NUM_THREADS - SAGE_NUM_THREADS_PARALLEL + # Parallel build + SAGE_NUM_THREADS + SAGE_NUM_THREADS_PARALLEL + # SAGE_VENV only for referring to the basepython + sagepython: SAGE_VENV whitelist_externals = bash commands = # Beware of the treacherous non-src layout. "./sage/" shadows the installed sage package. - python -c 'import sys; "" in sys.path and sys.path.remove(""); import sage.structure.all, sage.categories.sets_cat' + {envpython} -c 'import sys; "" in sys.path and sys.path.remove(""); import sage.structure.all, sage.categories.sets_cat' - python -c 'import sys; "" in sys.path and sys.path.remove(""); from sage.all__sagemath_objects import *' + {envpython} -c 'import sys; "" in sys.path and sys.path.remove(""); from sage.all__sagemath_objects import *' - bash -c 'cd bin && SAGE_SRC=$(python -c "from sage.env import SAGE_SRC; print(SAGE_SRC)") && sage-runtests --environment=sage.all__sagemath_objects --optional=sage $SAGE_SRC/sage/structure || echo "(lots of doctest failures are expected)"' + #bash -c 'cd bin && SAGE_SRC=$(python -c "from sage.env import SAGE_SRC; print(SAGE_SRC)") && sage-runtests --environment=sage.all__sagemath_objects --optional=sage $SAGE_SRC/sage/structure || echo "(lots of doctest failures are expected)"' [testenv:sagepython] -passenv = - SAGE_VENV +basepython = {env:SAGE_VENV}/bin/python3 +[testenv:sagepython-norequirements] basepython = {env:SAGE_VENV}/bin/python3 diff --git a/pkgs/sagemath-repl/tox.ini b/pkgs/sagemath-repl/tox.ini index ff2e8e826f1..a7e321104cd 100644 --- a/pkgs/sagemath-repl/tox.ini +++ b/pkgs/sagemath-repl/tox.ini @@ -1,36 +1,43 @@ # To build and test in the tox environment: # -# ./sage -sh -c '(cd pkgs/sagemath-repl && tox -v -v)' +# ./sage -sh -c '(cd pkgs/sagemath-repl && tox -v -v -e sagepython)' # # To test interactively: # -# pkgs/sagemath-repl/.tox/python/bin/python +# pkgs/sagemath-repl/.tox/sagepython/bin/python # [tox] +envlist = + sagepython-norequirements + isolated_build = True [testenv] -deps = -rrequirements.txt +deps = + !norequirements: -rrequirements.txt setenv = # Sage scripts such as sage-runtests like to use $HOME/.sage HOME={envdir} passenv = - SAGE_NUM_THREADS - SAGE_NUM_THREADS_PARALLEL + # Parallel build + SAGE_NUM_THREADS + SAGE_NUM_THREADS_PARALLEL + # SAGE_VENV only for referring to the basepython + sagepython: SAGE_VENV whitelist_externals = bash commands = # Beware of the treacherous non-src layout. "./sage/" shadows the installed sage package. - python -c 'import sys; "" in sys.path and sys.path.remove(""); import sage.repl.all; import sage.doctest.all' + {envpython} -c 'import sys; "" in sys.path and sys.path.remove(""); import sage.repl.all; import sage.doctest.all' - bash -c 'cd bin && SAGE_SRC=$(python -c "from sage.env import SAGE_SRC; print(SAGE_SRC)") && sage-runtests --environment=sage.all__sagemath_repl --optional=sage $SAGE_SRC/sage/repl $SAGE_SRC/sage/doctest $SAGE_SRC/sage/misc/sage_input.py $SAGE_SRC/sage/misc/sage_eval.py || echo "(lots of doctest failures are expected)"' + bash -c 'cd bin && SAGE_SRC=$({envpython} -c "from sage.env import SAGE_SRC; print(SAGE_SRC)") && sage-runtests --environment=sage.all__sagemath_repl --optional=sage $SAGE_SRC/sage/repl $SAGE_SRC/sage/doctest $SAGE_SRC/sage/misc/sage_input.py $SAGE_SRC/sage/misc/sage_eval.py || echo "(lots of doctest failures are expected)"' [testenv:sagepython] -passenv = - SAGE_VENV +basepython = {env:SAGE_VENV}/bin/python3 +[testenv:sagepython-norequirements] basepython = {env:SAGE_VENV}/bin/python3 diff --git a/pkgs/sagemath-standard/tox.ini b/pkgs/sagemath-standard/tox.ini index b80af350be4..75e72ae32bd 100644 --- a/pkgs/sagemath-standard/tox.ini +++ b/pkgs/sagemath-standard/tox.ini @@ -82,7 +82,7 @@ passenv = PKG_CONFIG_PATH # Parallel build SAGE_NUM_THREADS - # SAGE_VENV only for finding the wheels + # SAGE_VENV only for referring to the basepython or finding the wheels sagepython, sagewheels: SAGE_VENV # Location of the wheels (needs to include a PEP 503 compliant # Simple Repository index, i.e., a subdirectory "simple") diff --git a/src/bin/sage-update-version b/src/bin/sage-update-version index d074347438c..40df8926f74 100755 --- a/src/bin/sage-update-version +++ b/src/bin/sage-update-version @@ -43,6 +43,21 @@ for version_file in "$SAGE_ROOT"/pkgs/*/VERSION.txt; do fi done +# Update install-requires.txt for all distribution packages +( cd "$SAGE_ROOT"/build/pkgs/ && for spkg in sage*; do + if [ -f "$spkg"/install-requires.txt -a -d "$spkg"/src ]; then + ( echo "# This file is updated on every release by the sage-update-version script" + # Normalize the package name to PyPI convention (dashes, not underscores) + pkg=${spkg//_/-} + # Normalize the version (updated above as VERSION.txt) according to PEP440. + version=$(cat "$spkg"/package-version.txt) + version=${version//.beta/b} + version=${version//.rc/rc} + # ~= asks for a compatible release. https://peps.python.org/pep-0440/#compatible-release + echo "$pkg ~= $version" ) > "$spkg"/install-requires.txt + fi + done ) + # Update Sage version file for Python in SAGE_SRC/sage cat < "$SAGE_SRC/sage/version.py" # Sage version information for Python scripts @@ -85,6 +100,7 @@ git commit -m "Updated SageMath version to $SAGE_VERSION" -- \ "$SAGE_SRC/bin/sage-version.sh" \ "$SAGE_ROOT/build/pkgs/configure/checksums.ini" \ "$SAGE_ROOT/build/pkgs/configure/package-version.txt" \ + "$SAGE_ROOT/build/pkgs/*/install-requires.txt" \ "$SAGE_ROOT"/pkgs/*/VERSION.txt \ || die "Error committing to the repository."