|
39 | 39 | ### Configuration
|
40 | 40 | #########################################################
|
41 | 41 |
|
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 |
46 | 44 |
|
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() |
52 | 47 |
|
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 |
55 | 51 |
|
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) |
64 | 56 |
|
65 | 57 | #########################################################
|
66 | 58 | ### Testing related stuff
|
|
75 | 67 | ### Discovering Sources
|
76 | 68 | #########################################################
|
77 | 69 |
|
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']): |
86 | 72 | log.info("Generating auto-generated sources")
|
87 | 73 | from sage_setup.autogen import autogen_all
|
88 | 74 | autogen_all()
|
89 | 75 |
|
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)) |
107 | 96 |
|
108 | 97 | #########################################################
|
109 | 98 | ### Distutils
|
110 | 99 | #########################################################
|
111 | 100 |
|
112 | 101 | 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