Skip to content

Commit 2f4b053

Browse files
author
Matthias Koeppe
committed
pkgs/sagemath-standard/setup.py: Run finder also for sdist, egg_info, dist_info
1 parent ef75d6a commit 2f4b053

File tree

1 file changed

+37
-47
lines changed

1 file changed

+37
-47
lines changed

pkgs/sagemath-standard/setup.py

Lines changed: 37 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -39,28 +39,20 @@
3939
### Configuration
4040
#########################################################
4141

42-
if len(sys.argv) > 1 and (sys.argv[1] in ["sdist", "egg_info", "dist_info"]):
43-
sdist = True
44-
else:
45-
sdist = False
42+
from sage_setup.excepthook import excepthook
43+
sys.excepthook = excepthook
4644

47-
if sdist:
48-
cmdclass = {}
49-
else:
50-
from sage_setup.excepthook import excepthook
51-
sys.excepthook = excepthook
45+
from sage_setup.setenv import setenv
46+
setenv()
5247

53-
from sage_setup.setenv import setenv
54-
setenv()
48+
from sage_setup.command.sage_build_cython import sage_build_cython
49+
from sage_setup.command.sage_build_ext import sage_build_ext
50+
from sage_setup.command.sage_install import sage_develop, sage_install_and_clean
5551

56-
from sage_setup.command.sage_build_cython import sage_build_cython
57-
from sage_setup.command.sage_build_ext import sage_build_ext
58-
from sage_setup.command.sage_install import sage_develop, sage_install_and_clean
59-
60-
cmdclass = dict(build_cython=sage_build_cython,
61-
build_ext=sage_build_ext,
62-
develop=sage_develop,
63-
install=sage_install_and_clean)
52+
cmdclass = dict(build_cython=sage_build_cython,
53+
build_ext=sage_build_ext,
54+
develop=sage_develop,
55+
install=sage_install_and_clean)
6456

6557
#########################################################
6658
### Testing related stuff
@@ -75,41 +67,39 @@
7567
### Discovering Sources
7668
#########################################################
7769

78-
if sdist:
79-
# No need to compute distributions. This avoids a dependency on Cython
80-
# just to make an sdist.
81-
distributions = None
82-
python_packages = []
83-
python_modules = []
84-
cython_modules = []
85-
else:
70+
if any(x in sys.argv
71+
for x in ['build', 'bdist_wheel', 'install']):
8672
log.info("Generating auto-generated sources")
8773
from sage_setup.autogen import autogen_all
8874
autogen_all()
8975

90-
# TODO: This should be quiet by default
91-
print("Discovering Python/Cython source code....")
92-
t = time.time()
93-
from sage.misc.package import is_package_installed_and_updated
94-
distributions = ['']
95-
optional_packages_with_extensions = ['mcqd', 'bliss', 'tdlib',
96-
'coxeter3', 'sirocco', 'meataxe']
97-
distributions += ['sagemath-{}'.format(pkg)
98-
for pkg in optional_packages_with_extensions
99-
if is_package_installed_and_updated(pkg)]
100-
log.warn('distributions = {0}'.format(distributions))
101-
from sage_setup.find import find_python_sources
102-
python_packages, python_modules, cython_modules = find_python_sources(
103-
SAGE_SRC, ['sage'], distributions=distributions)
104-
105-
log.debug('python_packages = {0}'.format(python_packages))
106-
print("Discovered Python/Cython sources, time: %.2f seconds." % (time.time() - t))
76+
# TODO: This should be quiet by default
77+
print("Discovering Python/Cython source code....")
78+
t = time.time()
79+
distributions = ['']
80+
from sage.misc.package import is_package_installed_and_updated
81+
optional_packages_with_extensions = ['mcqd', 'bliss', 'tdlib',
82+
'coxeter3', 'sirocco', 'meataxe']
83+
distributions += ['sagemath-{}'.format(pkg)
84+
for pkg in optional_packages_with_extensions
85+
if is_package_installed_and_updated(pkg)]
86+
log.warn('distributions = {0}'.format(distributions))
87+
from sage_setup.find import find_python_sources, find_extra_files
88+
python_packages, python_modules, cython_modules = find_python_sources(
89+
SAGE_SRC, ['sage'], distributions=distributions)
90+
91+
log.debug('python_packages = {0}'.format(python_packages))
92+
log.debug('python_modules = {0}'.format(python_modules))
93+
log.debug('cython_modules = {0}'.format(cython_modules))
94+
95+
print("Discovered Python/Cython sources, time: %.2f seconds." % (time.time() - t))
10796

10897
#########################################################
10998
### Distutils
11099
#########################################################
111100

112101
code = setup(
113-
packages = python_packages,
114-
cmdclass = cmdclass,
115-
ext_modules = cython_modules)
102+
packages=python_packages,
103+
cmdclass=cmdclass,
104+
ext_modules=cython_modules,
105+
)

0 commit comments

Comments
 (0)