Skip to content

Commit

Permalink
Trac #34858: Fix sagemath-standard sdist
Browse files Browse the repository at this point in the history
`./bootstrap && ./sage -sh -c '(cd pkgs/sagemath-standard && tox -v -v
-v -e sagepython-sagewheels-nopypi-norequirements)'` fails in 9.8.beta5
because the sdist is broken
{{{

  cimport cython
  from sage.algebras.fusion_rings.poly_tup_engine cimport (
  ^
  ------------------------------------------------------------

  sage/algebras/fusion_rings/fast_parallel_fmats_methods.pyx:12:0:
'sage/algebras/fusion_rings/poly_tup_engine.pxd' not found

}}}

We fix this by
- updating MANIFEST
- unconditionally running the module finder in pkgs/sagemath-
standard/setup.py

We make the same change also in pkgs/sagemath-objects/setup.py (by
symlink, this also affects sagemath-categories).

URL: https://trac.sagemath.org/34858
Reported by: mkoeppe
Ticket author(s): Matthias Koeppe
Reviewer(s): François Bissey
  • Loading branch information
Release Manager committed Jan 21, 2023
2 parents 83b0cab + e229436 commit 62670bd
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 82 deletions.
57 changes: 22 additions & 35 deletions pkgs/sagemath-objects/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
84 changes: 37 additions & 47 deletions pkgs/sagemath-standard/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -75,41 +67,39 @@
### 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 = ['']
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 = ['']
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,
)
8 changes: 8 additions & 0 deletions src/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -35,6 +39,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]
Expand Down

0 comments on commit 62670bd

Please sign in to comment.