diff --git a/Makefile b/Makefile index f542d42f0ef..257e3517bb1 100644 --- a/Makefile +++ b/Makefile @@ -80,46 +80,6 @@ download: dist: build/make/Makefile ./sage --sdist -pypi-sdists: sage_setup - ./sage --sh build/pkgs/sage_conf/spkg-src - ./sage --sh build/pkgs/sage_sws2rst/spkg-src - ./sage --sh build/pkgs/sage_docbuild/spkg-src - ./sage --sh build/pkgs/sage_setup/spkg-src - ./sage --sh build/pkgs/sagelib/spkg-src - ./sage --sh build/pkgs/sagemath_objects/spkg-src - ./sage --sh build/pkgs/sagemath_categories/spkg-src - ./sage --sh build/pkgs/sagemath_environment/spkg-src - ./sage --sh build/pkgs/sagemath_repl/spkg-src - ./sage --sh build/pkgs/sagemath_giac/spkg-src - ./sage --sh build/pkgs/sagemath_flint_arb/spkg-src - ./sage --sh build/pkgs/sagemath_gap/spkg-src - ./sage --sh build/pkgs/sagemath_homfly/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 sagemath_giac sagemath_flint_arb sagemath_gap sagemath_homfly -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 SAGE_WHEELS=yes $$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 SAGE_WHEELS=yes $$a; \ - done - @echo "Built wheels are in venv/var/lib/sage/wheels/" - ############################################################################### # Cleaning up ############################################################################### @@ -384,7 +344,6 @@ 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/make/Makefile.in b/build/make/Makefile.in index e971def2416..2429882aa49 100644 --- a/build/make/Makefile.in +++ b/build/make/Makefile.in @@ -128,7 +128,27 @@ PIP_PACKAGES = @SAGE_PIP_PACKAGES@ # Packages that use the 'script' package build rules SCRIPT_PACKAGES = @SAGE_SCRIPT_PACKAGES@ - +# Packages for which we build wheels for PyPI +PYPI_WHEEL_PACKAGES = \ + sage_sws2rst \ + sage_setup \ + sagemath_environment \ + sagemath_objects \ + sagemath_repl \ + sagemath_categories \ + sagemath_giac \ + sagemath_flint_arb \ + sagemath_gap \ + sagemath_homfly + +# sage_docbuild is here, not in PYPI_WHEEL_PACKAGES, because it depends on sagelib +WHEEL_PACKAGES = $(PYPI_WHEEL_PACKAGES) \ + sage_conf \ + sagelib \ + sage_docbuild + +# Packages for which build sdists for PyPI +PYPI_SDIST_PACKAGES = $(WHEEL_PACKAGES) # Generate the actual inst_ variables; for each package that is # actually built this generates a line like: @@ -198,6 +218,7 @@ SAGE_I_TARGETS = sagelib doc # Tell make not to look for files with these names: .PHONY: all all-sage all-toolchain all-build all-sageruntime \ all-start build-start base toolchain toolchain-deps base-toolchain \ + pypi-sdists pypi-wheels wheels \ sagelib \ doc doc-html doc-html-jsmath doc-html-mathjax doc-pdf \ doc-uninstall \ @@ -418,6 +439,26 @@ list-broken-packages: auditwheel_or_delocate echo >&2 "$$fix_broken_packages"; \ fi +pypi-sdists: $(PYPI_SDIST_PACKAGES:%=%-sdist) + @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 + $(MAKE_REC) SAGE_EDITABLE=no SAGE_WHEELS=yes $(PYPI_WHEEL_PACKAGES) + @echo "Built wheels are in venv/var/lib/sage/wheels/" + +wheels: + for a in $(WHEEL_PACKAGES); do \ + rm -f venv/var/lib/sage/installed/$$a-*; \ + done + $(MAKE_REC) SAGE_EDITABLE=no SAGE_WHEELS=yes $(WHEEL_PACKAGES) + @echo "Built wheels are in venv/var/lib/sage/wheels/" #============================================================================== # Setting SAGE_CHECK... variables @@ -711,6 +752,13 @@ $(1)-uninstall: $(1)-$(4)-uninstall $(1)-clean: $(1)-uninstall +$(1)-sdist: FORCE python_build sage_setup cython + $(AM_V_at) cd '$$(SAGE_ROOT)' && \ + . '$$(SAGE_ROOT)/src/bin/sage-src-env-config' && \ + . '$$(SAGE_ROOT)/src/bin/sage-env-config' && \ + . '$$(SAGE_ROOT)/src/bin/sage-env' && \ + '$$(SAGE_ROOT)/build/pkgs/$(1)/spkg-src' + # Recursive tox invocation (note - we do not set the environment here). # Setting SAGE_SPKG_WHEELS is for the benefit of sagelib's tox.ini $(1)-tox-%: FORCE diff --git a/build/pkgs/sage_conf/spkg-src b/build/pkgs/sage_conf/spkg-src index af6e8b16342..c2fa51df092 100755 --- a/build/pkgs/sage_conf/spkg-src +++ b/build/pkgs/sage_conf/spkg-src @@ -16,4 +16,7 @@ fi set -e cd pkgs/sage-conf_pypi -python3 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES" +# Get rid of old *.egg-info/SOURCES.txt +rm -Rf *.egg-info + +python3 -m build --sdist --no-isolation --skip-dependency-check --outdir "$SAGE_DISTFILES" diff --git a/build/pkgs/sage_docbuild/spkg-src b/build/pkgs/sage_docbuild/spkg-src index dc1ba829b3a..b21f8f015c8 100755 --- a/build/pkgs/sage_docbuild/spkg-src +++ b/build/pkgs/sage_docbuild/spkg-src @@ -18,4 +18,7 @@ set -e cd build/pkgs/sage_docbuild cd src -python3 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES" +# Get rid of old *.egg-info/SOURCES.txt +rm -Rf *.egg-info + +python3 -m build --sdist --no-isolation --skip-dependency-check --outdir "$SAGE_DISTFILES" diff --git a/build/pkgs/sage_setup/spkg-src b/build/pkgs/sage_setup/spkg-src index e1bcbdaabdb..1b137206a5c 100755 --- a/build/pkgs/sage_setup/spkg-src +++ b/build/pkgs/sage_setup/spkg-src @@ -18,4 +18,7 @@ set -e cd build/pkgs/sage_setup cd src -python3 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES" +# Get rid of old *.egg-info/SOURCES.txt +rm -Rf *.egg-info + +python3 -m build --sdist --no-isolation --skip-dependency-check --outdir "$SAGE_DISTFILES" diff --git a/build/pkgs/sage_sws2rst/spkg-src b/build/pkgs/sage_sws2rst/spkg-src index 0da7d0cd24c..5a2a6d464dd 100755 --- a/build/pkgs/sage_sws2rst/spkg-src +++ b/build/pkgs/sage_sws2rst/spkg-src @@ -18,4 +18,7 @@ set -e cd build/pkgs/sage_sws2rst cd src -python3 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES" +# Get rid of old *.egg-info/SOURCES.txt +rm -Rf *.egg-info + +python3 -m build --sdist --no-isolation --skip-dependency-check --outdir "$SAGE_DISTFILES" diff --git a/build/pkgs/sagelib/spkg-src b/build/pkgs/sagelib/spkg-src index db4e2682ba1..aa97a393b0b 100755 --- a/build/pkgs/sagelib/spkg-src +++ b/build/pkgs/sagelib/spkg-src @@ -4,7 +4,7 @@ # This script is not used during build. # # HOW TO MAKE THE TARBALL: -# ./sage --sh build/pkgs/sagelib/spkg-src +# make python_build && ./sage --sh build/pkgs/sagelib/spkg-src if [ -z "$SAGE_ROOT" ] ; then echo >&2 "Error - SAGE_ROOT undefined ... exiting" @@ -18,4 +18,8 @@ set -e cd "$SAGE_ROOT"/build/pkgs/sagelib cd src -python3 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES" + +# Get rid of old *.egg-info/SOURCES.txt +rm -Rf *.egg-info + +python3 -m build --sdist --no-isolation --skip-dependency-check --outdir "$SAGE_DISTFILES" diff --git a/build/pkgs/sagemath_categories/spkg-src b/build/pkgs/sagemath_categories/spkg-src index 327d51651b9..e7c48e54193 100755 --- a/build/pkgs/sagemath_categories/spkg-src +++ b/build/pkgs/sagemath_categories/spkg-src @@ -18,4 +18,7 @@ set -e cd build/pkgs/sagemath_categories cd src -python3 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES" +# Get rid of old *.egg-info/SOURCES.txt +rm -Rf *.egg-info + +python3 -m build --sdist --no-isolation --skip-dependency-check --outdir "$SAGE_DISTFILES" diff --git a/build/pkgs/sagemath_environment/spkg-src b/build/pkgs/sagemath_environment/spkg-src index 4e2b7503da2..2d5b3aafde7 100755 --- a/build/pkgs/sagemath_environment/spkg-src +++ b/build/pkgs/sagemath_environment/spkg-src @@ -18,4 +18,7 @@ set -e cd build/pkgs/sagemath_environment cd src -python3 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES" +# Get rid of old *.egg-info/SOURCES.txt +rm -Rf *.egg-info + +python3 -m build --sdist --no-isolation --skip-dependency-check --outdir "$SAGE_DISTFILES" diff --git a/build/pkgs/sagemath_objects/spkg-src b/build/pkgs/sagemath_objects/spkg-src index 68719fae1b6..f46ddc2bd3b 100755 --- a/build/pkgs/sagemath_objects/spkg-src +++ b/build/pkgs/sagemath_objects/spkg-src @@ -18,4 +18,8 @@ set -e cd build/pkgs/sagemath_objects cd src -python3 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES" + +# Get rid of old *.egg-info/SOURCES.txt +rm -Rf *.egg-info + +python3 -m build --sdist --no-isolation --skip-dependency-check --outdir "$SAGE_DISTFILES" diff --git a/build/pkgs/sagemath_repl/spkg-src b/build/pkgs/sagemath_repl/spkg-src index b20ea463784..2ef7b673696 100755 --- a/build/pkgs/sagemath_repl/spkg-src +++ b/build/pkgs/sagemath_repl/spkg-src @@ -18,4 +18,7 @@ set -e cd build/pkgs/sagemath_repl cd src -python3 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES" +# Get rid of old *.egg-info/SOURCES.txt +rm -Rf *.egg-info + +python3 -m build --sdist --no-isolation --skip-dependency-check --outdir "$SAGE_DISTFILES" diff --git a/pkgs/sagemath-objects/setup.py b/pkgs/sagemath-objects/setup.py index 907cabef839..ad114fa0de1 100644 --- a/pkgs/sagemath-objects/setup.py +++ b/pkgs/sagemath-objects/setup.py @@ -14,41 +14,28 @@ import sys sys.path.insert(0, os.path.dirname(__file__)) -if len(sys.argv) > 1 and (sys.argv[1] == "sdist" or sys.argv[1] == "egg_info"): - sdist = True -else: - sdist = False - -if sdist: - cmdclass = {} -else: - from sage_setup.excepthook import excepthook - sys.excepthook = excepthook - - from sage_setup.setenv import setenv - setenv() - - import sage.env - sage.env.default_required_modules = sage.env.default_optional_modules = () - - from sage_setup.command.sage_build_cython import sage_build_cython - from sage_setup.command.sage_build_ext import sage_build_ext - - cmdclass = dict(build_cython=sage_build_cython, - build_ext=sage_build_ext) - -if sdist: - python_packages = [] - python_modules = [] - cython_modules = [] -else: - from sage_setup.find import find_python_sources - python_packages, python_modules, cython_modules = find_python_sources( - '.', ['sage']) # for now, we do the filtering using MANIFEST - - log.warn('python_packages = {0}'.format(python_packages)) - log.warn('python_modules = {0}'.format(python_modules)) - log.warn('cython_modules = {0}'.format(cython_modules)) +from sage_setup.excepthook import excepthook +sys.excepthook = excepthook + +from sage_setup.setenv import setenv +setenv() + +import sage.env +sage.env.default_required_modules = sage.env.default_optional_modules = () + +from sage_setup.command.sage_build_cython import sage_build_cython +from sage_setup.command.sage_build_ext import sage_build_ext + +cmdclass = dict(build_cython=sage_build_cython, + build_ext=sage_build_ext) + +from sage_setup.find import find_python_sources +python_packages, python_modules, cython_modules = find_python_sources( + '.', ['sage']) # for now, we do the filtering using MANIFEST + +log.warn('python_packages = {0}'.format(python_packages)) +log.warn('python_modules = {0}'.format(python_modules)) +log.warn('cython_modules = {0}'.format(cython_modules)) setup( cmdclass = cmdclass, diff --git a/pkgs/sagemath-standard/setup.py b/pkgs/sagemath-standard/setup.py index 7e397ec685c..d77ea733c48 100755 --- a/pkgs/sagemath-standard/setup.py +++ b/pkgs/sagemath-standard/setup.py @@ -39,28 +39,20 @@ ### Configuration ######################################################### -if len(sys.argv) > 1 and (sys.argv[1] in ["sdist", "egg_info", "dist_info"]): - sdist = True -else: - sdist = False +from sage_setup.excepthook import excepthook +sys.excepthook = excepthook -if sdist: - cmdclass = {} -else: - from sage_setup.excepthook import excepthook - sys.excepthook = excepthook +from sage_setup.setenv import setenv +setenv() - from sage_setup.setenv import setenv - setenv() +from sage_setup.command.sage_build_cython import sage_build_cython +from sage_setup.command.sage_build_ext import sage_build_ext +from sage_setup.command.sage_install import sage_develop, sage_install_and_clean - from sage_setup.command.sage_build_cython import sage_build_cython - from sage_setup.command.sage_build_ext import sage_build_ext - from sage_setup.command.sage_install import sage_develop, sage_install_and_clean - - cmdclass = dict(build_cython=sage_build_cython, - build_ext=sage_build_ext, - develop=sage_develop, - install=sage_install_and_clean) +cmdclass = dict(build_cython=sage_build_cython, + build_ext=sage_build_ext, + develop=sage_develop, + install=sage_install_and_clean) ######################################################### ### Testing related stuff @@ -75,46 +67,44 @@ ### Discovering Sources ######################################################### -if sdist: - # No need to compute distributions. This avoids a dependency on Cython - # just to make an sdist. - distributions = None - python_packages = [] - python_modules = [] - cython_modules = [] -else: +if any(x in sys.argv + for x in ['build', 'bdist_wheel', 'install']): log.info("Generating auto-generated sources") from sage_setup.autogen import autogen_all autogen_all() - # TODO: This should be quiet by default - print("Discovering Python/Cython source code....") - t = time.time() - from sage.misc.package import is_package_installed_and_updated - distributions = ['', - 'sagemath-flint-arb', - 'sagemath-gap', - 'sagemath-giac', - 'sagemath-homfly', - ] - optional_packages_with_extensions = ['mcqd', 'bliss', 'tdlib', - 'coxeter3', 'sirocco', 'meataxe'] - distributions += ['sagemath-{}'.format(pkg) - for pkg in optional_packages_with_extensions - if is_package_installed_and_updated(pkg)] - log.warn('distributions = {0}'.format(distributions)) - from sage_setup.find import find_python_sources - python_packages, python_modules, cython_modules = find_python_sources( - SAGE_SRC, ['sage'], distributions=distributions) - - log.debug('python_packages = {0}'.format(python_packages)) - print("Discovered Python/Cython sources, time: %.2f seconds." % (time.time() - t)) +# TODO: This should be quiet by default +print("Discovering Python/Cython source code....") +t = time.time() +distributions = ['', + 'sagemath-flint-arb', + 'sagemath-gap', + 'sagemath-giac', + 'sagemath-homfly', + ] +from sage.misc.package import is_package_installed_and_updated +optional_packages_with_extensions = ['mcqd', 'bliss', 'tdlib', + 'coxeter3', 'sirocco', 'meataxe'] +distributions += ['sagemath-{}'.format(pkg) + for pkg in optional_packages_with_extensions + if is_package_installed_and_updated(pkg)] +log.warn('distributions = {0}'.format(distributions)) +from sage_setup.find import find_python_sources, find_extra_files +python_packages, python_modules, cython_modules = find_python_sources( + SAGE_SRC, ['sage'], distributions=distributions) + +log.debug('python_packages = {0}'.format(python_packages)) +log.debug('python_modules = {0}'.format(python_modules)) +log.debug('cython_modules = {0}'.format(cython_modules)) + +print("Discovered Python/Cython sources, time: %.2f seconds." % (time.time() - t)) ######################################################### ### Distutils ######################################################### code = setup( - packages = python_packages, - cmdclass = cmdclass, - ext_modules = cython_modules) + packages=python_packages, + cmdclass=cmdclass, + ext_modules=cython_modules, +) diff --git a/src/MANIFEST.in b/src/MANIFEST.in index 3a63d07fc32..cf90162a5ef 100644 --- a/src/MANIFEST.in +++ b/src/MANIFEST.in @@ -1,3 +1,7 @@ +include VERSION.txt + +global-include *.pxi *.pxd *.h *.hpp + prune sage/ext/interpreters # In particular, __init__.py must not be present in the distribution; or sage_setup.autogen.interpreters.rebuild will not generate the code prune sage_setup prune sage_docbuild @@ -36,6 +40,10 @@ include sage/stats/distributions/dgs_bern.c include sage/stats/distributions/dgs_gauss_dp.c include sage/stats/distributions/dgs_gauss_mp.c include sage/symbolic/ginac/*.cpp +# Also actual C++ source files. +include sage/geometry/triangulation/triangulations.cc +include sage/geometry/triangulation/data.cc +include sage/geometry/triangulation/functions.cc global-exclude __pycache__ global-exclude *.py[co] diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py index 79a4b06ebd6..a163383ebb1 100644 --- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py +++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py @@ -52,7 +52,6 @@ class initialization directly. # https://www.gnu.org/licenses/ # **************************************************************************** -from typing_extensions import final from sage.arith.misc import is_prime from sage.calculus.functions import jacobian from sage.categories.fields import Fields