diff --git a/.gitignore b/.gitignore index cdb9c373c37..0c1c9086cf7 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ /confdefs.h /m4/sage_spkg_configures.m4 +/m4/sage_spkg_versions*.m4 # no longer generated, but may still be in user worktrees /src/lib/pkgconfig diff --git a/bootstrap b/bootstrap index 48c4801d4b5..aaf853d305c 100755 --- a/bootstrap +++ b/bootstrap @@ -35,10 +35,16 @@ CONFVERSION=$(cat $PKG/package-version.txt) bootstrap () { - if [ "${BOOTSTRAP_QUIET}" = "no" ]; then - echo "bootstrap:$LINENO: installing 'm4/sage_spkg_configures.m4'" - fi - rm -f m4/sage_spkg_configures.m4 + for a in m4/sage_spkg_configures.m4 m4/sage_spkg_versions.m4 m4/sage_spkg_versions_toml.m4; do + if [ "${BOOTSTRAP_QUIET}" = "no" ]; then + echo "bootstrap:$LINENO: installing '"$a"'" + fi + rm -f $a + echo "# Generated by SAGE_ROOT/bootstrap; do not edit" > $a + done + for a in m4/sage_spkg_versions.m4 m4/sage_spkg_versions_toml.m4; do + echo 'changequote(`>>>'"'"', `<<<'"')dnl" >> $a + done spkg_configures="" # initialize SAGE_ENABLE... options for standard packages for pkgname in $(sage-package list :standard: | sort); do @@ -92,12 +98,17 @@ SAGE_SPKG_CONFIGURE_$(echo ${pkgname} | tr '[a-z]' '[A-Z]')" if test -f "$DIR/requirements.txt" -o -f "$DIR/install-requires.txt"; then # A Python package SPKG_TREE_VAR=SAGE_VENV + 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 fi spkg_configures="$spkg_configures SAGE_SPKG_FINALIZE([$pkgname], [$pkgtype], [$SPKG_SOURCE], [$SPKG_TREE_VAR])" done echo "$spkg_configures" >> 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 for pkgname in $(sage-package list --has-file bootstrap); do (cd build/pkgs/$pkgname && ./bootstrap) || exit 1 diff --git a/build/bin/sage-get-system-packages b/build/bin/sage-get-system-packages index b5153c53694..c51c36ceab9 100755 --- a/build/bin/sage-get-system-packages +++ b/build/bin/sage-get-system-packages @@ -12,16 +12,16 @@ if [ -z "$SAGE_ROOT" ]; then fi case "$SYSTEM" in install-requires) - # Collect install-requires.txt and output it in the format + # Collect install-requires.txt (falling back to requirements.txt) and output it in the format # needed by setup.cfg [options] install_requires= - SYSTEM_PACKAGES_FILE_NAMES="install-requires.txt" + SYSTEM_PACKAGES_FILE_NAMES="install-requires.txt requirements.txt" STRIP_COMMENTS="sed s/#.*//;/^[[:space:]]*$/d;" COLLECT= ;; install-requires-toml) - # Collect install-requires.txt and output it in the format + # Collect install-requires.txt (falling back to requirements.txt) and output it in the format # needed by pyproject.toml [build-system] requires= - SYSTEM_PACKAGES_FILE_NAMES="install-requires.txt" + SYSTEM_PACKAGES_FILE_NAMES="install-requires.txt requirements.txt" STRIP_COMMENTS="sed s/#.*//;/^[[:space:]]*$/d;s/^/'/;s/$/',/;" COLLECT= ;; diff --git a/build/pkgs/sagelib/bootstrap b/build/pkgs/sagelib/bootstrap index 08f9002f8f5..2c9b3f78974 100755 --- a/build/pkgs/sagelib/bootstrap +++ b/build/pkgs/sagelib/bootstrap @@ -1,5 +1,7 @@ #! /bin/sh set -e +export M4PATH="$SAGE_ROOT/m4" +MACRO_PATTERN='SPKG_' for infile in src/*.m4; do if [ -f "$infile" ]; then outfile="src/$(basename $infile .m4)" @@ -7,5 +9,10 @@ for infile in src/*.m4; do echo "$0: installing $(pwd)/$outfile" fi m4 "$infile" > "$outfile" + if sed 's/#.*//' "$outfile" | grep -q -E "$MACRO_PATTERN"; then + echo >&2 "$(pwd)/$infile: error: Unrecognized SPKG_ macro:" + grep -E "$MACRO_PATTERN" "$outfile" >&2 + exit 1 + fi fi done diff --git a/m4/setup_cfg_metadata.m4 b/m4/setup_cfg_metadata.m4 new file mode 100644 index 00000000000..ca042345499 --- /dev/null +++ b/m4/setup_cfg_metadata.m4 @@ -0,0 +1,21 @@ +dnl Standard metadata of SageMath distribution packages +dnl +license = GNU General Public License (GPL) v2 or later +author = The Sage Developers +author_email = sage-support@googlegroups.com +url = https://www.sagemath.org + +classifiers = + Development Status :: 6 - Mature + Intended Audience :: Education + Intended Audience :: Science/Research + License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+) + Operating System :: POSIX + Operating System :: MacOS :: MacOS X + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 + Programming Language :: Python :: Implementation :: CPython + Topic :: Scientific/Engineering :: Mathematics diff --git a/pkgs/sagemath-categories/pyproject.toml.m4 b/pkgs/sagemath-categories/pyproject.toml.m4 index 0afd7849de5..6ce29ddcb71 100644 --- a/pkgs/sagemath-categories/pyproject.toml.m4 +++ b/pkgs/sagemath-categories/pyproject.toml.m4 @@ -1,14 +1,14 @@ +include(`sage_spkg_versions_toml.m4')dnl' -*- conf-toml -*- [build-system] # Minimum requirements for the build system to execute. requires = [ - esyscmd(`sage-get-system-packages install-requires-toml \ - setuptools \ - wheel \ - sage_setup \ - sagemath_environment \ - sagemath_objects \ - cython \ - gmpy2 \ - cysignals \ - ')] + SPKG_INSTALL_REQUIRES_setuptools + SPKG_INSTALL_REQUIRES_wheel + SPKG_INSTALL_REQUIRES_sage_setup + SPKG_INSTALL_REQUIRES_sagemath_environment + SPKG_INSTALL_REQUIRES_sagemath_objects + SPKG_INSTALL_REQUIRES_cython + SPKG_INSTALL_REQUIRES_gmpy2 + SPKG_INSTALL_REQUIRES_cysignals +] build-backend = "setuptools.build_meta" diff --git a/pkgs/sagemath-categories/setup.cfg.m4 b/pkgs/sagemath-categories/setup.cfg.m4 index 62aca5af44f..2539a8aafb5 100644 --- a/pkgs/sagemath-categories/setup.cfg.m4 +++ b/pkgs/sagemath-categories/setup.cfg.m4 @@ -1,36 +1,16 @@ -# -*- conf-unix -*- +include(`sage_spkg_versions.m4')dnl' -*- conf-unix -*- [metadata] name = sagemath-categories version = file: VERSION.txt description = Sage: Open Source Mathematics Software: Sage categories and basic rings long_description = file: README.rst long_description_content_type = text/x-rst -license = GNU General Public License (GPL) v2 or later -author = The Sage Developers -author_email = sage-support@googlegroups.com -url = https://www.sagemath.org - -classifiers = - Development Status :: 6 - Mature - Intended Audience :: Education - Intended Audience :: Science/Research - License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+) - Operating System :: POSIX - Operating System :: MacOS :: MacOS X - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: Implementation :: CPython - Topic :: Scientific/Engineering :: Mathematics +include(`setup_cfg_metadata.m4')dnl' [options] python_requires = >=3.8, <3.12 install_requires = - esyscmd(`sage-get-system-packages install-requires \ - sagemath_objects \ - | sed "2,\$s/^/ /;"')dnl + SPKG_INSTALL_REQUIRES_sagemath_objects [options.extras_require] -test = sagemath-repl +test = SPKG_INSTALL_REQUIRES_sagemath_repl diff --git a/pkgs/sagemath-environment/pyproject.toml.m4 b/pkgs/sagemath-environment/pyproject.toml.m4 index 686515673fc..7f62a86cd69 100644 --- a/pkgs/sagemath-environment/pyproject.toml.m4 +++ b/pkgs/sagemath-environment/pyproject.toml.m4 @@ -1,8 +1,8 @@ +include(`sage_spkg_versions_toml.m4')dnl' -*- conf-toml -*- [build-system] # Minimum requirements for the build system to execute. requires = [ - esyscmd(`sage-get-system-packages install-requires-toml \ - setuptools \ - wheel \ - ')] + SPKG_INSTALL_REQUIRES_setuptools + SPKG_INSTALL_REQUIRES_wheel +] build-backend = "setuptools.build_meta" diff --git a/pkgs/sagemath-environment/setup.cfg.m4 b/pkgs/sagemath-environment/setup.cfg.m4 index 919a5b576cd..deb74565b3b 100644 --- a/pkgs/sagemath-environment/setup.cfg.m4 +++ b/pkgs/sagemath-environment/setup.cfg.m4 @@ -1,35 +1,15 @@ -# -*- conf-unix -*- +include(`sage_spkg_versions.m4')dnl' -*- conf-unix -*- [metadata] name = sagemath-environment version = file: VERSION.txt description = Sage: Open Source Mathematics Software: System and software environment long_description = file: README.rst long_description_content_type = text/x-rst -license = GNU General Public License (GPL) v2 or later -author = The Sage Developers -author_email = sage-support@googlegroups.com -url = https://www.sagemath.org - -classifiers = - Development Status :: 6 - Mature - Intended Audience :: Education - Intended Audience :: Science/Research - License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+) - Operating System :: POSIX - Operating System :: MacOS :: MacOS X - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: Implementation :: CPython - Topic :: Scientific/Engineering :: Mathematics +include(`setup_cfg_metadata.m4')dnl' [options] python_requires = >=3.8, <3.12 install_requires = - esyscmd(`sage-get-system-packages install-requires \ - | sed "2,\$s/^/ /;"')dnl py_modules = sage.all__sagemath_environment @@ -61,16 +41,25 @@ scripts = [options.extras_require] # sage.env can optionally use sage_conf -conf = esyscmd(`sage-get-system-packages install-requires sage_conf') +conf = SPKG_INSTALL_REQUIRES_sage_conf + # For "sage --docbuild" -docbuild = esyscmd(`sage-get-system-packages install-requires sage_docbuild') +docbuild = SPKG_INSTALL_REQUIRES_sage_docbuild + # For "sage", "sage -t", ... -sage = esyscmd(`sage-get-system-packages install-requires sagelib') +sage = SPKG_INSTALL_REQUIRES_sagelib + # For "sage --cython" -cython = esyscmd(`sage-get-system-packages install-requires cython') +cython = SPKG_INSTALL_REQUIRES_cython + # For "sage --pytest" -pytest = esyscmd(`sage-get-system-packages install-requires pytest') +pytest = SPKG_INSTALL_REQUIRES_pytest + # For "sage --rst2ipynb" -rst2ipynb = esyscmd(`sage-get-system-packages install-requires rst2ipynb') +rst2ipynb = SPKG_INSTALL_REQUIRES_rst2ipynb + +# For "sage --tox" +tox = SPKG_INSTALL_REQUIRES_tox + # For "sage --sws2rst" -sws2rst = esyscmd(`sage-get-system-packages install-requires sage_sws2rst') +sws2rst = SPKG_INSTALL_REQUIRES_sage_sws2rst diff --git a/pkgs/sagemath-objects/pyproject.toml.m4 b/pkgs/sagemath-objects/pyproject.toml.m4 index c13665be51d..0c5558f3412 100644 --- a/pkgs/sagemath-objects/pyproject.toml.m4 +++ b/pkgs/sagemath-objects/pyproject.toml.m4 @@ -1,13 +1,13 @@ +include(`sage_spkg_versions_toml.m4')dnl' -*- conf-toml -*- [build-system] # Minimum requirements for the build system to execute. requires = [ - esyscmd(`sage-get-system-packages install-requires-toml \ - setuptools \ - wheel \ - sage_setup \ - sagemath_environment \ - cython \ - gmpy2 \ - cysignals \ - ')] + SPKG_INSTALL_REQUIRES_setuptools + SPKG_INSTALL_REQUIRES_wheel + SPKG_INSTALL_REQUIRES_sage_setup + SPKG_INSTALL_REQUIRES_sagemath_environment + SPKG_INSTALL_REQUIRES_cython + SPKG_INSTALL_REQUIRES_gmpy2 + SPKG_INSTALL_REQUIRES_cysignals +] build-backend = "setuptools.build_meta" diff --git a/pkgs/sagemath-objects/setup.cfg.m4 b/pkgs/sagemath-objects/setup.cfg.m4 index 88246c422f2..94ec7f63024 100644 --- a/pkgs/sagemath-objects/setup.cfg.m4 +++ b/pkgs/sagemath-objects/setup.cfg.m4 @@ -5,33 +5,14 @@ version = file: VERSION.txt description = Sage: Open Source Mathematics Software: Sage objects, elements, parents, categories, coercion, metaclasses long_description = file: README.rst long_description_content_type = text/x-rst -license = GNU General Public License (GPL) v2 or later -author = The Sage Developers -author_email = sage-support@googlegroups.com -url = https://www.sagemath.org - -classifiers = - Development Status :: 6 - Mature - Intended Audience :: Education - Intended Audience :: Science/Research - License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+) - Operating System :: POSIX - Operating System :: MacOS :: MacOS X - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: Implementation :: CPython - Topic :: Scientific/Engineering :: Mathematics +include(`setup_cfg_metadata.m4')dnl' [options] +include(`sage_spkg_versions.m4')dnl' python_requires = >=3.8, <3.12 install_requires = - esyscmd(`sage-get-system-packages install-requires \ - gmpy2 \ - cysignals \ - | sed "2,\$s/^/ /;"')dnl + SPKG_INSTALL_REQUIRES_gmpy2 + SPKG_INSTALL_REQUIRES_cysignals [options.extras_require] # Currently we do not use the sage doctester to test sagemath-objects, diff --git a/pkgs/sagemath-repl/pyproject.toml.m4 b/pkgs/sagemath-repl/pyproject.toml.m4 index 686515673fc..7f62a86cd69 100644 --- a/pkgs/sagemath-repl/pyproject.toml.m4 +++ b/pkgs/sagemath-repl/pyproject.toml.m4 @@ -1,8 +1,8 @@ +include(`sage_spkg_versions_toml.m4')dnl' -*- conf-toml -*- [build-system] # Minimum requirements for the build system to execute. requires = [ - esyscmd(`sage-get-system-packages install-requires-toml \ - setuptools \ - wheel \ - ')] + SPKG_INSTALL_REQUIRES_setuptools + SPKG_INSTALL_REQUIRES_wheel +] build-backend = "setuptools.build_meta" diff --git a/pkgs/sagemath-repl/setup.cfg.m4 b/pkgs/sagemath-repl/setup.cfg.m4 index 2367fda7b9a..8c7e11777b8 100644 --- a/pkgs/sagemath-repl/setup.cfg.m4 +++ b/pkgs/sagemath-repl/setup.cfg.m4 @@ -1,39 +1,19 @@ -# -*- conf-unix -*- +include(`sage_spkg_versions.m4')dnl' -*- conf-unix -*- [metadata] name = sagemath-repl version = file: VERSION.txt description = Sage: Open Source Mathematics Software: System and software environment long_description = file: README.rst long_description_content_type = text/x-rst -license = GNU General Public License (GPL) v2 or later -author = The Sage Developers -author_email = sage-support@googlegroups.com -url = https://www.sagemath.org - -classifiers = - Development Status :: 6 - Mature - Intended Audience :: Education - Intended Audience :: Science/Research - License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+) - Operating System :: POSIX - Operating System :: MacOS :: MacOS X - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: Implementation :: CPython - Topic :: Scientific/Engineering :: Mathematics +include(`setup_cfg_metadata.m4')dnl' [options] python_requires = >=3.8, <3.12 install_requires = - esyscmd(`sage-get-system-packages install-requires \ - sagemath_objects \ - sagemath_environment \ - ipython \ - ipywidgets \ - | sed "2,\$s/^/ /;"')dnl + SPKG_INSTALL_REQUIRES_sagemath_objects + SPKG_INSTALL_REQUIRES_sagemath_environment + SPKG_INSTALL_REQUIRES_ipython + SPKG_INSTALL_REQUIRES_ipywidgets py_modules = sage.all__sagemath_repl diff --git a/src/setup.cfg.m4 b/src/setup.cfg.m4 index bbd9133902e..b82631a5e4c 100644 --- a/src/setup.cfg.m4 +++ b/src/setup.cfg.m4 @@ -1,84 +1,53 @@ -# -*- conf-unix -*- +include(`sage_spkg_versions.m4')dnl' -*- conf-unix -*- [metadata] name = sagemath-standard version = file: VERSION.txt description = Sage: Open Source Mathematics Software: Standard Python Library long_description = file: README.rst long_description_content_type = text/x-rst -license = GNU General Public License (GPL) v2 or later license_files = LICENSE.txt -author = The Sage Developers -author_email = sage-support@googlegroups.com -url = https://www.sagemath.org - -classifiers = - Development Status :: 6 - Mature - Intended Audience :: Education - Intended Audience :: Science/Research - License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+) - Operating System :: POSIX - Operating System :: MacOS :: MacOS X - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: Implementation :: CPython - Topic :: Scientific/Engineering :: Mathematics +include(`setup_cfg_metadata.m4')dnl' [options] python_requires = >=3.8, <3.12 install_requires = - esyscmd(`sage-get-system-packages install-requires \ - sage_conf \ - six \ - | sed "2,\$s/^/ /;"')dnl' + SPKG_INSTALL_REQUIRES_sage_conf + SPKG_INSTALL_REQUIRES_six dnl From build/pkgs/sagelib/dependencies - esyscmd(`sage-get-system-packages install-requires \ - cypari \ - cysignals \ - cython \ - gmpy2 \ - importlib_metadata \ - importlib_resources \ - jinja2 \ - jupyter_core \ - lrcalc_python \ - memory_allocator \ - numpy \ - pkgconfig \ - pplpy \ - primecountpy \ - requests \ - typing_extensions \ - | sed "2,\$s/^/ /;"')dnl' + SPKG_INSTALL_REQUIRES_cypari + SPKG_INSTALL_REQUIRES_cysignals + SPKG_INSTALL_REQUIRES_cython + SPKG_INSTALL_REQUIRES_gmpy2 + SPKG_INSTALL_REQUIRES_importlib_metadata + SPKG_INSTALL_REQUIRES_importlib_resources + SPKG_INSTALL_REQUIRES_jinja2 + SPKG_INSTALL_REQUIRES_jupyter_core + SPKG_INSTALL_REQUIRES_lrcalc_python + SPKG_INSTALL_REQUIRES_memory_allocator + SPKG_INSTALL_REQUIRES_numpy + SPKG_INSTALL_REQUIRES_pkgconfig + SPKG_INSTALL_REQUIRES_pplpy + SPKG_INSTALL_REQUIRES_primecountpy + SPKG_INSTALL_REQUIRES_requests + SPKG_INSTALL_REQUIRES_typing_extensions dnl From Makefile.in: SAGERUNTIME - esyscmd(`sage-get-system-packages install-requires \ - ipython \ - pexpect \ - | sed "2,\$s/^/ /;"')dnl' + SPKG_INSTALL_REQUIRES_ipython + SPKG_INSTALL_REQUIRES_pexpect dnl From Makefile.in: DOC_DEPENDENCIES - esyscmd(`sage-get-system-packages install-requires \ - sphinx \ - networkx \ - scipy \ - sympy \ - matplotlib \ - pillow \ - mpmath \ - ipykernel \ - jupyter_client \ - ipywidgets \ - | sed "2,\$s/^/ /;"')dnl' -dnl Other Python packages that are standard spkg, used in doctests - esyscmd(`sage-get-system-packages install-requires \ - fpylll \ - | sed "2,\$s/^/ /;"')dnl' + SPKG_INSTALL_REQUIRES_sphinx + SPKG_INSTALL_REQUIRES_networkx + SPKG_INSTALL_REQUIRES_scipy + SPKG_INSTALL_REQUIRES_sympy + SPKG_INSTALL_REQUIRES_matplotlib + SPKG_INSTALL_REQUIRES_pillow + SPKG_INSTALL_REQUIRES_mpmath + SPKG_INSTALL_REQUIRES_ipykernel + SPKG_INSTALL_REQUIRES_jupyter_client + SPKG_INSTALL_REQUIRES_ipywidgets + SPKG_INSTALL_REQUIRES_fpylll dnl pycryptosat # Sage distribution installs it as part of cryptominisat. According to its README on https://pypi.org/project/pycryptosat/: "The pycryptosat python package compiles while compiling CryptoMiniSat. It cannot be compiled on its own, it must be compiled at the same time as CryptoMiniSat." dnl Packages with important upper version bounds - esyscmd(`sage-get-system-packages install-requires \ - ptyprocess \ - | sed "2,\$s/^/ /;"')dnl' + SPKG_INSTALL_REQUIRES_ptyprocess scripts = # The sage script @@ -165,6 +134,4 @@ sage = ext_data/threejs/* [options.extras_require] -R = esyscmd(`sage-get-system-packages install-requires \ - rpy2 \ - | sed "2,\$s/^/ /;"')dnl' +R = SPKG_INSTALL_REQUIRES_rpy2