From 77cb984f6eb0869504825f6e66159d8fb16d9b31 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 18 Nov 2023 18:37:18 -0800 Subject: [PATCH 01/17] m4/sage_spkg_collect.m4: Handle wheel packages like normal packages --- bootstrap | 3 +++ m4/sage_spkg_collect.m4 | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/bootstrap b/bootstrap index eb5bcd732b6..ba957001977 100755 --- a/bootstrap +++ b/bootstrap @@ -80,6 +80,9 @@ SAGE_SPKG_ENABLE([$pkgname], [$pkgtype], [$(grep -v ^= build/pkgs/$pkgname/SPKG. esac fi done + cat >> m4/sage_spkg_configures.m4 < Date: Thu, 22 Feb 2024 09:16:16 -0800 Subject: [PATCH 02/17] m4/sage_spkg_collect.m4: Use 'sage-package properties' to get versions --- m4/sage_spkg_collect.m4 | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/m4/sage_spkg_collect.m4 b/m4/sage_spkg_collect.m4 index 6dd280695b2..6a9a5fdc871 100644 --- a/m4/sage_spkg_collect.m4 +++ b/m4/sage_spkg_collect.m4 @@ -76,6 +76,12 @@ m4_include([m4/sage_spkg_configures.m4]) dnl ========================================================================== AC_DEFUN([SAGE_SPKG_COLLECT_INIT], [ dnl Intialize the collection variables. +SPKGS="$1" +dnl Obtain versions at configure time. +AS_IF([eval $($SAGE_BOOTSTRAP_PYTHON build/bin/sage-package properties --format=shell $SPKGS)], [], [ + AC_MSG_ERROR([Package directory missing. Re-run bootstrap.])dnl +]) + # To deal with ABI incompatibilities when gcc is upgraded, every package # (except gcc) should depend on gcc if gcc is already installed. # See https://github.com/sagemath/sage/issues/24703 @@ -89,17 +95,6 @@ AC_SUBST([SAGE_GCC_DEP]) AS_BOX([Build status for each package: ]) >& AS_MESSAGE_FD AS_BOX([Build status for each package: ]) >& AS_MESSAGE_LOG_FD -# Usage: newest_version $pkg -# Print version number of latest package $pkg -newest_version() { - SPKG=$[1] - if test -f "$SAGE_ROOT/build/pkgs/$SPKG/package-version.txt" ; then - cat "$SAGE_ROOT/build/pkgs/$SPKG/package-version.txt" - else - echo none - fi -} - # Packages that are actually built/installed as opposed to packages that are # not required on this platform or that can be taken from the underlying system # installation. Note that this contains packages that are not actually going to @@ -157,12 +152,7 @@ AC_DEFUN([SAGE_SPKG_FINALIZE], [dnl dnl depending on the package type and other criteria (such as whether or not it dnl needs to be installed) dnl - DIR="$SAGE_ROOT"/build/pkgs/SPKG_NAME - AS_IF([test ! -d "$DIR"], [dnl - AC_MSG_ERROR([Directory $DIR is missing. Re-run bootstrap.])dnl - ]) - dnl - SPKG_VERSION=$(newest_version SPKG_NAME) + SPKG_VERSION=$[version_with_patchlevel_]SPKG_NAME dnl dnl Determine package source dnl From 4a4ada7e5888c22d55e4eb16b25d8cafe0aea4b6 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 8 Apr 2024 17:11:53 -0700 Subject: [PATCH 03/17] bootstrap: Simplify by using 'sage-package properties' bootstrap: Remove last direct use of 'build/pkgs' bootstrap-conda: Use 'sage-package properties' and 'sage-package dependencies' Update shell uses of 'sage-package properties' --- bootstrap | 75 +++++++++++++++++++++---------------------------- bootstrap-conda | 8 +++--- 2 files changed, 36 insertions(+), 47 deletions(-) diff --git a/bootstrap b/bootstrap index ba957001977..8a75cca7503 100755 --- a/bootstrap +++ b/bootstrap @@ -29,9 +29,10 @@ cd "$SAGE_ROOT" export PATH="$SAGE_ROOT/build/bin:$PATH" -PKG=build/pkgs/configure +eval $(sage-package properties --format=shell configure) +PKG=$path_configure MAKE="${MAKE:-make}" -CONFVERSION=$(cat $PKG/package-version.txt) +CONFVERSION=$version_configure bootstrap () { @@ -54,6 +55,7 @@ bootstrap () { for a in m4/sage_spkg_versions.m4 m4/sage_spkg_versions_toml.m4; do echo 'changequote(`>>>'"'"', `<<<'"')dnl" >> $a done + eval $(sage-package properties --format=shell :all:) spkg_configures="" # initialize SAGE_ENABLE... options for standard packages for pkgname in $(sage-package list :standard:); do @@ -62,31 +64,36 @@ AS_VAR_SET_IF([SAGE_ENABLE_$pkgname], [], [AS_VAR_SET([SAGE_ENABLE_$pkgname], [y done # --enable-SPKG options for pkgname in $(sage-package list :optional: :experimental:); do + eval DIR=\$path_$pkgname pkgtype=\$type_$pkgname pkgsource=\$source_$pkgname + case "$pkgname:$pkgsource" in + *:pip) # Issue #29629: Temporary solution for Sage 9.1: Do not provide # --enable-SPKG options for installing pip packages - if [ ! -f build/pkgs/$pkgname/requirements.txt ]; then - pkgtype="$(cat build/pkgs/$pkgname/type)" - # Issue #29124: Do not provide --enable-_recommended and similar - case "$pkgname" in - _*) ;; - *) spkg_configures="$spkg_configures + ;; + _*:*) + # Issue #29124: Do not provide --enable-_recommended and similar + ;; + *:none) + # Issue #31163: Just an optional dummy package + spkg_configures="$spkg_configures + AC_SUBST(SAGE_ENABLE_$pkgname, [if_installed])" + ;; + *:*) + spkg_configures="$spkg_configures AC_SUBST(SAGE_ENABLE_$pkgname, [if_installed])" - if [ -f build/pkgs/$pkgname/spkg-install -o -f build/pkgs/$pkgname/spkg-install.in ]; then - # Issue #31163: Not just an optional dummy package - spkg_configures="$spkg_configures -SAGE_SPKG_ENABLE([$pkgname], [$pkgtype], [$(grep -v ^= build/pkgs/$pkgname/SPKG.rst | head -n1 2>/dev/null || echo $pkgname)])" - fi - ;; - esac - fi + spkg_configures="$spkg_configures +SAGE_SPKG_ENABLE([$pkgname], [$pkgtype], [$(grep -v ^= "$DIR/SPKG.rst" | head -n1 2>/dev/null || echo $pkgname)])" + ;; + esac done cat >> m4/sage_spkg_configures.m4 <>>SPKG_INSTALL_REQUIRES_${pkgname}<<<, >>>$(echo $(sage-get-system-packages install-requires ${pkgname}))<<<)dnl" >> m4/sage_spkg_versions.m4 - echo "define(>>>SPKG_INSTALL_REQUIRES_${pkgname}<<<, >>>$(echo $(sage-get-system-packages install-requires-toml ${pkgname}))<<<)dnl" >> m4/sage_spkg_versions_toml.m4 - fi + eval DIR=\$path_$pkgname pkgtype=\$type_$pkgname SPKG_SOURCE=\$source_$pkgname SPKG_TREE_VAR=\$trees_$pkgname + if test -f "$DIR/requirements.txt" -o -f "$DIR/version_requirements.txt"; then + # A Python package + echo "define(>>>SPKG_INSTALL_REQUIRES_${pkgname}<<<, >>>$(echo $(sage-get-system-packages install-requires ${pkgname}))<<<)dnl" >> m4/sage_spkg_versions.m4 + echo "define(>>>SPKG_INSTALL_REQUIRES_${pkgname}<<<, >>>$(echo $(sage-get-system-packages install-requires-toml ${pkgname}))<<<)dnl" >> m4/sage_spkg_versions_toml.m4 fi spkg_finalizes="$spkg_finalizes SAGE_SPKG_FINALIZE([$pkgname], [$pkgtype], [$SPKG_SOURCE], [$SPKG_TREE_VAR])" @@ -133,7 +121,8 @@ SAGE_SPKG_FINALIZE([$pkgname], [$pkgtype], [$SPKG_SOURCE], [$SPKG_TREE_VAR])" done for pkgname in $(sage-package list --has-file bootstrap "$@"); do - (cd build/pkgs/$pkgname && if [ -x bootstrap ]; then ./bootstrap; else echo >&2 "bootstrap:$LINENO: Nothing to do for $pkgname"; fi) || exit 1 + eval DIR=\$path_$pkgname + (cd "$DIR" && if [ -x bootstrap ]; then ./bootstrap; else echo >&2 "bootstrap:$LINENO: Nothing to do for $pkgname"; fi) || exit 1 done if [ $# != 0 ]; then diff --git a/bootstrap-conda b/bootstrap-conda index 62d7557a9b5..c64e2a72b6c 100755 --- a/bootstrap-conda +++ b/bootstrap-conda @@ -18,10 +18,11 @@ SAGELIB_PACKAGES= SAGELIB_OPTIONAL_PACKAGES= DEVELOP_PACKAGES= +eval $(sage-package properties --format=shell :all:) + for PKG_BASE in $(sage-package list --has-file distros/conda.txt --exclude _sagemath); do - PKG_SCRIPTS=build/pkgs/$PKG_BASE + eval PKG_SCRIPTS=\$path_$PKG_BASE PKG_TYPE=\$type_$PKG_BASE SYSTEM_PACKAGES_FILE=$PKG_SCRIPTS/distros/conda.txt - PKG_TYPE=$(cat $PKG_SCRIPTS/type) PKG_SYSTEM_PACKAGES=$(echo $(${STRIP_COMMENTS} $SYSTEM_PACKAGES_FILE)) if [ -n "$PKG_SYSTEM_PACKAGES" ]; then if [ -f $PKG_SCRIPTS/spkg-configure.m4 ]; then @@ -133,12 +134,11 @@ echo >&2 $0:$LINENO: generate conda environment files echo >&4 " - pip:" echo >&5 " - pip:" for PKG_BASE in $(sage-package list :standard: :optional: --has-file requirements.txt --no-file distros/conda.txt --no-file src; sage-package list :standard: :optional: --has-file version_requirements.txt --no-file requirements.txt --no-file distros/conda.txt --no-file src); do - PKG_SCRIPTS=build/pkgs/$PKG_BASE + eval PKG_SCRIPTS=\$path_$PKG_BASE PKG_TYPE=\$type_$PKG_BASE SYSTEM_PACKAGES_FILE=$PKG_SCRIPTS/requirements.txt if [ ! -f $SYSTEM_PACKAGES_FILE ]; then SYSTEM_PACKAGES_FILE=$PKG_SCRIPTS/version_requirements.txt fi - PKG_TYPE=$(cat $PKG_SCRIPTS/type) if grep -q SAGERUNTIME $PKG_SCRIPTS/dependencies $PKG_SCRIPTS/dependencies_order_only 2>/dev/null; then : # cannot install packages that depend on the Sage library else From 39e7f76a99b9631bb7959ce13410275bf77b1b85 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 22 Feb 2024 09:58:03 -0800 Subject: [PATCH 04/17] m4/sage_spkg_collect.m4: Fix handling of missing package dirs (test: './bootstrap && rm -rf build/pkgs/cachetools; ./configure') --- m4/sage_spkg_collect.m4 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/m4/sage_spkg_collect.m4 b/m4/sage_spkg_collect.m4 index 6a9a5fdc871..dce0590606c 100644 --- a/m4/sage_spkg_collect.m4 +++ b/m4/sage_spkg_collect.m4 @@ -75,10 +75,12 @@ m4_include([m4/sage_spkg_configures.m4]) dnl ========================================================================== AC_DEFUN([SAGE_SPKG_COLLECT_INIT], [ +AS_BOX([Build status for each package: ]) >& AS_MESSAGE_FD +AS_BOX([Build status for each package: ]) >& AS_MESSAGE_LOG_FD dnl Intialize the collection variables. SPKGS="$1" dnl Obtain versions at configure time. -AS_IF([eval $($SAGE_BOOTSTRAP_PYTHON build/bin/sage-package properties --format=shell $SPKGS)], [], [ +AS_IF([properties=$($SAGE_BOOTSTRAP_PYTHON build/bin/sage-package properties --format=shell $SPKGS 2>& AS_MESSAGE_LOG_FD) && eval $properties], [], [ AC_MSG_ERROR([Package directory missing. Re-run bootstrap.])dnl ]) @@ -92,9 +94,6 @@ else fi AC_SUBST([SAGE_GCC_DEP]) -AS_BOX([Build status for each package: ]) >& AS_MESSAGE_FD -AS_BOX([Build status for each package: ]) >& AS_MESSAGE_LOG_FD - # Packages that are actually built/installed as opposed to packages that are # not required on this platform or that can be taken from the underlying system # installation. Note that this contains packages that are not actually going to From 9f070b77e78be241ba7378be0c794e10557e9143 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 22 Feb 2024 10:17:36 -0800 Subject: [PATCH 05/17] Repair 'bootstrap -D' --- bootstrap | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bootstrap b/bootstrap index 8a75cca7503..dec290095bd 100755 --- a/bootstrap +++ b/bootstrap @@ -29,10 +29,11 @@ cd "$SAGE_ROOT" export PATH="$SAGE_ROOT/build/bin:$PATH" -eval $(sage-package properties --format=shell configure) +properties=$(sage-package properties --format=shell configure) || echo >&2 "Error: looking up version of 'configure' failed" +eval $properties PKG=$path_configure MAKE="${MAKE:-make}" -CONFVERSION=$version_configure +CONFVERSION=$version_with_patchlevel_configure bootstrap () { From 4ea08d1d0c6d6aebeaa56d470d63c0497839fb52 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 22 Feb 2024 10:27:05 -0800 Subject: [PATCH 06/17] bootstrap: Use 'sage -package update' to update the configure tarball version/checksums --- bootstrap | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/bootstrap b/bootstrap index dec290095bd..fbeb1724f60 100755 --- a/bootstrap +++ b/bootstrap @@ -31,7 +31,6 @@ export PATH="$SAGE_ROOT/build/bin:$PATH" properties=$(sage-package properties --format=shell configure) || echo >&2 "Error: looking up version of 'configure' failed" eval $properties -PKG=$path_configure MAKE="${MAKE:-make}" CONFVERSION=$version_with_patchlevel_configure @@ -248,16 +247,8 @@ save () { build/pkgs/setuptools/version_requirements.txt \ build/pkgs/wheel/version_requirements.txt - # Update version - echo "$NEWCONFVERSION" >$PKG/package-version.txt - - # Compute checksum - if [ "${BOOTSTRAP_QUIET}" = "no" ]; then - sage-package fix-checksum configure - else - # Hide the "Updating checksum..." message - sage-package fix-checksum configure > /dev/null - fi + # Update version; this re-computes the checksum + sage-package update configure "$NEWCONFVERSION" } From 8899b28fc711b6e085defe660a514a3ee74eb5ce Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 22 Feb 2024 10:34:17 -0800 Subject: [PATCH 07/17] bootstrap -D: Simplify using 'sage-package download' --- bootstrap | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/bootstrap b/bootstrap index fbeb1724f60..518b7aa446b 100755 --- a/bootstrap +++ b/bootstrap @@ -29,10 +29,7 @@ cd "$SAGE_ROOT" export PATH="$SAGE_ROOT/build/bin:$PATH" -properties=$(sage-package properties --format=shell configure) || echo >&2 "Error: looking up version of 'configure' failed" -eval $properties MAKE="${MAKE:-make}" -CONFVERSION=$version_with_patchlevel_configure bootstrap () { @@ -188,8 +185,8 @@ SAGE_SPKG_FINALIZE([$pkgname], [$pkgtype], [$SPKG_SOURCE], [$SPKG_TREE_VAR])" bootstrap_download () { SAGE_DL_LOGLEVEL="" [ "${BOOTSTRAP_QUIET}" = "yes" ] && SAGE_DL_LOGLEVEL="--log=WARNING" - sage-download-file ${SAGE_DL_LOGLEVEL} configure-$CONFVERSION.tar.gz + CONFBALL=$(sage-package download $SAGE_DL_LOGLEVEL configure) if [ $? -ne 0 ]; then echo >&2 "Error: downloading configure-$CONFVERSION.tar.gz failed" exit 1 @@ -288,7 +285,6 @@ do done shift $(($OPTIND - 1)) export BOOTSTRAP_QUIET -CONFBALL="upstream/configure-$CONFVERSION.tar.gz" if [ $DOWNLOAD$SAVE = yesyes ]; then echo >&2 "$0: refusing to download and save." From d3a655cedcf7aa8b764d3ec15bad5c8af733e453 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 7 Mar 2024 20:59:18 -0800 Subject: [PATCH 08/17] bootstrap: Remove use of CONFVERSION --- bootstrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap b/bootstrap index 518b7aa446b..c4c50ad9e37 100755 --- a/bootstrap +++ b/bootstrap @@ -188,7 +188,7 @@ bootstrap_download () { CONFBALL=$(sage-package download $SAGE_DL_LOGLEVEL configure) if [ $? -ne 0 ]; then - echo >&2 "Error: downloading configure-$CONFVERSION.tar.gz failed" + echo >&2 "Error: downloading configure tarball failed" exit 1 fi From de356d3b1dad373c166a1f78c715e8ea0ae3e032 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 13 May 2024 19:17:25 -0700 Subject: [PATCH 09/17] m4/sage_python_package_check.m4: Replace direct access to version_requirements.txt --- bootstrap | 14 ++++++++------ build/bin/sage-get-system-packages | 6 ++++-- m4/sage_python_package_check.m4 | 28 ++++++++-------------------- 3 files changed, 20 insertions(+), 28 deletions(-) diff --git a/bootstrap b/bootstrap index c4c50ad9e37..22a1b295930 100755 --- a/bootstrap +++ b/bootstrap @@ -73,7 +73,7 @@ AS_VAR_SET_IF([SAGE_ENABLE_$pkgname], [], [AS_VAR_SET([SAGE_ENABLE_$pkgname], [y *:none) # Issue #31163: Just an optional dummy package spkg_configures="$spkg_configures - AC_SUBST(SAGE_ENABLE_$pkgname, [if_installed])" +AC_SUBST(SAGE_ENABLE_$pkgname, [if_installed])" ;; *:*) spkg_configures="$spkg_configures @@ -98,24 +98,26 @@ $config" $config" fi done >> m4/sage_spkg_configures.m4 - cat >> m4/sage_spkg_configures.m4 <>>SPKG_INSTALL_REQUIRES_${pkgname}<<<, >>>$(echo $(sage-get-system-packages install-requires ${pkgname}))<<<)dnl" >> m4/sage_spkg_versions.m4 + INSTALL_REQUIRES_TOML= echo "define(>>>SPKG_INSTALL_REQUIRES_${pkgname}<<<, >>>$(echo $(sage-get-system-packages install-requires-toml ${pkgname}))<<<)dnl" >> m4/sage_spkg_versions_toml.m4 + echo "m4_define([SPKG_INSTALL_REQUIRES_${pkgname}], [[$(echo $(sage-get-system-packages install-requires-toml ${pkgname} | sed 's/"/\\"/g'))]])dnl" >> m4/sage_spkg_configures.m4 fi spkg_finalizes="$spkg_finalizes SAGE_SPKG_FINALIZE([$pkgname], [$pkgtype], [$SPKG_SOURCE], [$SPKG_TREE_VAR])" done - echo "$spkg_finalizes" >> m4/sage_spkg_configures.m4 for a in m4/sage_spkg_versions.m4 m4/sage_spkg_versions_toml.m4; do echo 'changequote(>>>`<<<, >>>'"'"'<<<)dnl' >> $a done + cat >> m4/sage_spkg_configures.m4 <&AS_MESSAGE_LOG_FD], [ AC_MSG_RESULT(yes) - dnl strip all comments from version_requirements.txt; this should leave - dnl only a single line containing the version specification for this - dnl package. Afterwards, convert all double-quotes to single quotes. - dnl Both work, but only single quotes are documented. However, at the - dnl time of writing, double quotes are more compatible with our toml - dnl generation in ./bootstrap. Converting them from double- to single- - dnl quotes on-the-fly here lets us support both (in this macro, at - dnl least). - SAGE_PKG_VERSPEC=$(sed \ - -e '/^#/d' \ - -e "s/\"/'/g" \ - "./build/pkgs/$1/version_requirements.txt" - ) - AC_MSG_CHECKING([for python package $1 ("${SAGE_PKG_VERSPEC}")]) + dnl SAGE_PKG_VERSPEC is in the format of a toml list, but + dnl without surrounding brackets, of single-quoted strings, + dnl with any double-quotes escaped by backslash. + AS_VAR_SET([SAGE_PKG_VERSPEC], ["SPKG_INSTALL_REQUIRES_]$1["]) + AC_MSG_CHECKING([for python package $1 (${SAGE_PKG_VERSPEC%,})]) WITH_SAGE_PYTHONUSERBASE([dnl - dnl double-quote SAGE_PKG_VERSPEC because platform-specific - dnl dependencies like python_version<'3.11' will have single - dnl quotes in them. (We normalized the quotes earlier with sed.) AS_IF( - [config.venv/bin/python3 -c dnl - "import pkg_resources; dnl - pkg_resources.require(\"${SAGE_PKG_VERSPEC}\".splitlines())" dnl + [config.venv/bin/python3 -c dnl + "import pkg_resources; dnl + pkg_resources.require((${SAGE_PKG_VERSPEC}))" dnl 2>&AS_MESSAGE_LOG_FD], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no); sage_spkg_install_$1=yes] From 8f43af82f34f370c2c14b48272510484567e9f20 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 13 May 2024 21:49:28 -0700 Subject: [PATCH 10/17] build/bin/sage-get-system-packages: Restore correct search order for 'SYSTEM=pip' --- build/bin/sage-get-system-packages | 58 +++++++++++++++--------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/build/bin/sage-get-system-packages b/build/bin/sage-get-system-packages index 50089353c8a..833665431bf 100755 --- a/build/bin/sage-get-system-packages +++ b/build/bin/sage-get-system-packages @@ -15,26 +15,23 @@ fi case "$SYSTEM" in install-requires) # Collect from src/pyproject.toml or from version_requirements.txt (falling back to requirements.txt) and output it in the format - # needed by setup.cfg [options] version_requirements= - SYSTEM_PACKAGES_FILE_NAMES="version_requirements.txt requirements.txt" + # needed by setup.cfg [options] install_requires= + SYSTEM_PACKAGES_FILE_NAMES="src/pyproject.toml version_requirements.txt requirements.txt" # also normalizes quotes from "" to ''. STRIP_COMMENTS="sed s/#.*//;/^[[:space:]]*$/d;s/\"/'/g;" - FROM_PYPROJECT_TOML=1 COLLECT= ;; install-requires-toml) # Collect from src/pyproject.toml or from version_requirements.txt (falling back to requirements.txt) and output it in the format # needed by pyproject.toml [build-system] requires= - SYSTEM_PACKAGES_FILE_NAMES="version_requirements.txt requirements.txt" + SYSTEM_PACKAGES_FILE_NAMES="src/pyproject.toml version_requirements.txt requirements.txt" # also normalizes quotes from '' to "". STRIP_COMMENTS="sed s/#.*//;/^[[:space:]]*$/d;s/'/\"/g;s/^/'/;s/$/',/;" - FROM_PYPROJECT_TOML=1 COLLECT= ;; pip) - SYSTEM_PACKAGES_FILE_NAMES="requirements.txt version_requirements.txt" + SYSTEM_PACKAGES_FILE_NAMES="requirements.txt src/pyproject.toml version_requirements.txt" STRIP_COMMENTS='sed s/#.*//;s/[[:space:]]//g;' - FROM_PYPROJECT_TOML=1 COLLECT=echo ;; *) @@ -47,7 +44,6 @@ case "$SYSTEM" in fi SYSTEM_PACKAGES_FILE_NAMES="distros/$SYSTEM.txt" STRIP_COMMENTS="sed s/#.*//;s/\${PYTHON_MINOR}/${PYTHON_MINOR}/g" - FROM_PYPROJECT_TOML=0 COLLECT=echo ;; esac @@ -59,18 +55,6 @@ case "$SPKGS" in esac for PKG_BASE in $SPKGS; do - if [ $FROM_PYPROJECT_TOML -eq 1 ]; then - if [ -f "$SAGE_ROOT/src/pyproject.toml" ]; then - # Extract from the "requires" block in src/pyproject.toml - # Packages are in the format "'sage-conf ~= 10.3b3'," - PACKAGE_INFO=$(sed -n '/requires *= *\[/,/^\]/s/^ *'\''\('$PKG_BASE'.*\)'\'',/\1/p' "$SAGE_ROOT/src/pyproject.toml") - if [ -n "$PACKAGE_INFO" ]; then - echo "$PACKAGE_INFO" | ${STRIP_COMMENTS} - continue - fi - fi - fi - case "$SYSTEM:$ENABLE_SYSTEM_SITE_PACKAGES" in install-requires*|pip*) # This is output for installation of packages into a Python environment. @@ -95,14 +79,30 @@ for PKG_BASE in $SPKGS; do esac for NAME in $SYSTEM_PACKAGES_FILE_NAMES; do - SYSTEM_PACKAGES_FILE="$SAGE_ROOT"/build/pkgs/$PKG_BASE/$NAME - if [ -f $SYSTEM_PACKAGES_FILE ]; then - if [ -z "$COLLECT" ]; then - ${STRIP_COMMENTS} $SYSTEM_PACKAGES_FILE - else - $COLLECT $(${STRIP_COMMENTS} $SYSTEM_PACKAGES_FILE) - fi - break - fi + case $NAME in + *pyproject.toml) + SYSTEM_PACKAGES_FILE="$SAGE_ROOT"/$NAME + if [ -f "$SYSTEM_PACKAGES_FILE" ]; then + # Extract from the "requires" block in src/pyproject.toml + # Packages are in the format "'sage-conf ~= 10.3b3'," + PACKAGE_INFO=$(sed -n '/requires *= *\[/,/^\]/s/^ *'\''\('$PKG_BASE'.*\)'\'',/\1/p' "$SAGE_ROOT/src/pyproject.toml") + if [ -n "$PACKAGE_INFO" ]; then + echo "$PACKAGE_INFO" | ${STRIP_COMMENTS} + break + fi + fi + ;; + *) + SYSTEM_PACKAGES_FILE="$SAGE_ROOT"/build/pkgs/$PKG_BASE/$NAME + if [ -f $SYSTEM_PACKAGES_FILE ]; then + if [ -z "$COLLECT" ]; then + ${STRIP_COMMENTS} $SYSTEM_PACKAGES_FILE + else + $COLLECT $(${STRIP_COMMENTS} $SYSTEM_PACKAGES_FILE) + fi + break + fi + ;; + esac done done From 4a08dbcd883cf05906e6142f6d9c15ea7bcc2e80 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 13 May 2024 21:53:21 -0700 Subject: [PATCH 11/17] build/bin/sage-spkg-info: Show versions using new command 'sage-get-system-packages versions' --- build/bin/sage-get-system-packages | 19 +++++++++++++++++-- build/bin/sage-spkg-info | 10 +--------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/build/bin/sage-get-system-packages b/build/bin/sage-get-system-packages index 833665431bf..d7de9f3741f 100755 --- a/build/bin/sage-get-system-packages +++ b/build/bin/sage-get-system-packages @@ -34,6 +34,18 @@ case "$SYSTEM" in STRIP_COMMENTS='sed s/#.*//;s/[[:space:]]//g;' COLLECT=echo ;; + versions) + # For use in sage-spkg-info + SYSTEM_PACKAGES_FILE_NAMES="package-version.txt requirements.txt src/pyproject.toml version_requirements.txt" + strip_comments () { + echo "$NAME::" + echo + sed "s/#.*//;/^[[:space:]]*$/d;s/\"/'/g;s/^/ /;" "$@" + echo + } + STRIP_COMMENTS=strip_comments + COLLECT= + ;; *) if [ "$SYSTEM" = auto ]; then SYSTEM=$(sage-guess-package-system 2>/dev/null) @@ -56,6 +68,9 @@ esac for PKG_BASE in $SPKGS; do case "$SYSTEM:$ENABLE_SYSTEM_SITE_PACKAGES" in + versions*) + # Show everything. + ;; install-requires*|pip*) # This is output for installation of packages into a Python environment. # So it's OK to use any Python packages. @@ -88,7 +103,7 @@ for PKG_BASE in $SPKGS; do PACKAGE_INFO=$(sed -n '/requires *= *\[/,/^\]/s/^ *'\''\('$PKG_BASE'.*\)'\'',/\1/p' "$SAGE_ROOT/src/pyproject.toml") if [ -n "$PACKAGE_INFO" ]; then echo "$PACKAGE_INFO" | ${STRIP_COMMENTS} - break + [ $SYSTEM = versions ] || break fi fi ;; @@ -100,7 +115,7 @@ for PKG_BASE in $SPKGS; do else $COLLECT $(${STRIP_COMMENTS} $SYSTEM_PACKAGES_FILE) fi - break + [ $SYSTEM = versions ] || break fi ;; esac diff --git a/build/bin/sage-spkg-info b/build/bin/sage-spkg-info index dd289fee4d3..0d71172d020 100755 --- a/build/bin/sage-spkg-info +++ b/build/bin/sage-spkg-info @@ -54,15 +54,7 @@ echo echo "Version Information" echo "-------------------" echo -for a in package-version.txt requirements.txt version_requirements.txt; do - if [ -f "$PKG_SCRIPTS"/"$a" ]; then - echo "$a::" - echo - sed 's/^/ /' "$PKG_SCRIPTS/$a" - echo - fi -done -echo +sage-get-system-packages versions $PKG_BASE echo "Equivalent System Packages" echo "--------------------------" echo From 6d96302c69c6f7aed73acb2a6dde14dec3a716ec Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 13 May 2024 22:38:44 -0700 Subject: [PATCH 12/17] m4/sage_python_package_check.m4: Update doc to mention src/pyproject.toml --- m4/sage_python_package_check.m4 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/m4/sage_python_package_check.m4 b/m4/sage_python_package_check.m4 index 315bc621a57..423e68352c5 100644 --- a/m4/sage_python_package_check.m4 +++ b/m4/sage_python_package_check.m4 @@ -8,8 +8,8 @@ # Determine if the system copy of a python package can be used by sage. # # This macro uses setuptools.version's pkg_resources to check that the -# "version_requirements.txt" file for the named package is satisfied, and -# it can typically fail in four ways: +# "version_requirements.txt" file (or entry in "src/pyproject.toml") for +# the named package is satisfied, and it can typically fail in four ways: # # 1. If --enable-system-site-packages was not passed to ./configure, # @@ -19,8 +19,9 @@ # # 4. If setuptools is not available to the system python, # -# 5. If the contents of version_requirements.txt are not met (wrong -# version, no version, etc.) by the system python. +# 5. If the contents of version_requirements.txt (or entry in +# "src/pyproject.toml")are not met (wrong version, no version, +# etc.) by the system python. # # In any of those cases, we set sage_spkg_install_$package to "yes" # so that the corresponding SPKG is installed. Otherwise, we do From 642cb0deb210f2b7cefac62e6d484d531833c30d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 12 Jun 2024 11:04:56 -0700 Subject: [PATCH 13/17] m4/sage_spkg_collect.m4: Repair dependencies --- m4/sage_spkg_collect.m4 | 1 + 1 file changed, 1 insertion(+) diff --git a/m4/sage_spkg_collect.m4 b/m4/sage_spkg_collect.m4 index dce0590606c..231193ce8fb 100644 --- a/m4/sage_spkg_collect.m4 +++ b/m4/sage_spkg_collect.m4 @@ -339,6 +339,7 @@ AC_DEFUN([SAGE_SPKG_FINALIZE], [dnl dnl dnl Determine package dependencies dnl + DIR=$[path_]SPKG_NAME AS_IF([test -f "$DIR/dependencies"], [dnl dnl - the # symbol is treated as comment which is removed AS_VAR_SET([DEPS], [`sed 's/^ *//; s/ *#.*//; q' $DIR/dependencies`]) From ceed17e87414040c33edbf1174a3dc4f9944be81 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 12 Jun 2024 12:00:12 -0700 Subject: [PATCH 14/17] build/bin/sage-spkg-info: Fix rst format --- build/bin/sage-spkg-info | 1 + 1 file changed, 1 insertion(+) diff --git a/build/bin/sage-spkg-info b/build/bin/sage-spkg-info index 0d71172d020..29d833a29bf 100755 --- a/build/bin/sage-spkg-info +++ b/build/bin/sage-spkg-info @@ -55,6 +55,7 @@ echo "Version Information" echo "-------------------" echo sage-get-system-packages versions $PKG_BASE +echo echo "Equivalent System Packages" echo "--------------------------" echo From c13b3dbe97326544baefed7125b165fab317751f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 12 Jun 2024 12:50:06 -0700 Subject: [PATCH 15/17] build/bin/sage-get-system-packages versions: Fix for jupyter_core, broken in #36982 + #37894 --- build/bin/sage-get-system-packages | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/build/bin/sage-get-system-packages b/build/bin/sage-get-system-packages index d7de9f3741f..f28e0356375 100755 --- a/build/bin/sage-get-system-packages +++ b/build/bin/sage-get-system-packages @@ -38,10 +38,13 @@ case "$SYSTEM" in # For use in sage-spkg-info SYSTEM_PACKAGES_FILE_NAMES="package-version.txt requirements.txt src/pyproject.toml version_requirements.txt" strip_comments () { - echo "$NAME::" - echo - sed "s/#.*//;/^[[:space:]]*$/d;s/\"/'/g;s/^/ /;" "$@" - echo + TEXT=$(sed "s/#.*//;/^[[:space:]]*$/d;s/\"/'/g;s/^/ /;" "$@") + if [ -n "$(echo $TEXT)" ]; then + echo "$NAME::" + echo + echo "$TEXT" + echo + fi } STRIP_COMMENTS=strip_comments COLLECT= From ef04f80bb89379a9191b2dc3e4d8e343af18a5fb Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 12 Jun 2024 21:03:00 -0700 Subject: [PATCH 16/17] m4/sage_python_package_check.m4: Fix typo in comment --- m4/sage_python_package_check.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/m4/sage_python_package_check.m4 b/m4/sage_python_package_check.m4 index 423e68352c5..921639e3735 100644 --- a/m4/sage_python_package_check.m4 +++ b/m4/sage_python_package_check.m4 @@ -20,7 +20,7 @@ # 4. If setuptools is not available to the system python, # # 5. If the contents of version_requirements.txt (or entry in -# "src/pyproject.toml")are not met (wrong version, no version, +# "src/pyproject.toml") are not met (wrong version, no version, # etc.) by the system python. # # In any of those cases, we set sage_spkg_install_$package to "yes" From 2dcb36926ca513c6446ec85480a5fa7234627148 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 16 Jun 2024 10:16:32 -0700 Subject: [PATCH 17/17] bootstrap: Fix -u --- bootstrap | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bootstrap b/bootstrap index 22a1b295930..3a3d7fd1ec3 100755 --- a/bootstrap +++ b/bootstrap @@ -313,15 +313,16 @@ mkdir -p config 2>/dev/null if [ $ALWAYSDOWNLOAD = yes ]; then if [ -n "$CONFTARBALL_URL" ]; then - URL="$CONFTARBALL_URL"/configure-$CONFVERSION.tar.gz + CONFTARBALL=$(sage-package tarball configure) + URL="$CONFTARBALL_URL"/"$CONFTARBALL" SAGE_DL_LOGLEVEL="" [ "${BOOTSTRAP_QUIET}" = "yes" ] && SAGE_DL_LOGLEVEL="--log=WARNING" - sage-download-file ${SAGE_DL_LOGLEVEL} "$URL" upstream/configure-$CONFVERSION.tar.gz + sage-download-file ${SAGE_DL_LOGLEVEL} "$URL" upstream/"$CONFTARBALL" if [ $? -ne 0 ]; then - echo >&2 "Error: downloading configure-$CONFVERSION.tar.gz from $CONFTARBALL_URL failed" + echo >&2 "Error: downloading $CONFTARBALL from $CONFTARBALL_URL failed" exit 1 fi - echo >&2 "Downloaded configure-$CONFVERSION.tar.gz from $CONFTARBALL_URL " + echo >&2 "Downloaded $CONFTARBALL from $CONFTARBALL_URL " else bootstrap_download || exit $? fi