Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Merge #34858
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Dec 19, 2022
2 parents 9151794 + e229436 commit 2b39b3d
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 83 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 @@ -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]
Expand Down
1 change: 0 additions & 1 deletion src/sage/dynamics/arithmetic_dynamics/projective_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2b39b3d

Please sign in to comment.