Skip to content

Commit

Permalink
Trac #33838: Refactoring run_autogen [to generate wrappers] to pkgs/s…
Browse files Browse the repository at this point in the history
…agemath-standard/setup.py

Recently some changes in the build tools for PEP517 python packages in
Gentoo lead to `python setup.py build` not being executed in favor of
`python setup.py build_ext` see https://github.com/cschwan/sage-on-
gentoo/issues/693 and https://bugs.gentoo.org/842534

The Gentoo maintainer reasoning for removing `build` is that it is
normally a meta target whose sole purpose is to start other phases like
`build_ext`. The over-ridding of the `build` command in sage is an
increasingly uncommon practice apparently.

The `build` target does only one thing, run `run_autogen` to generate
some cython code and `build` is explicitly only called by the sage build
system when it is configured without `--enable-editable`[https://github.
com/sagemath/sage/blob/develop/build/pkgs/sagelib/spkg-install#L55]. In
builds with that option enabled, autogeneration is called from
`setup.py`
[https://github.com/sagemath/sage/blob/develop/src/setup.py#L78] and
`build` is not called explicitly.

We take the opportunity to simplify the build system further and reduce
the differences editable and non-editable build by either fully moving
the autogeneration in `setup.py`.

(An alternative would have been to move it to `build_ext` the strategy I
followed as a quick fix in https://github.com/cschwan/sage-on-
gentoo/blob/master/sci-
mathematics/sage_setup/files/sage_setup-9.6-no_build.patch)

URL: https://trac.sagemath.org/33838
Reported by: fbissey
Ticket author(s): François Bissey
Reviewer(s): Matthias Koeppe
  • Loading branch information
Release Manager committed May 22, 2022
2 parents 2bb3b14 + 278cc0d commit f69c9b8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 40 deletions.
8 changes: 5 additions & 3 deletions pkgs/sagemath-standard/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,11 @@
from sage_setup.setenv import setenv
setenv()

from sage_setup.command.sage_build import sage_build
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=sage_build,
build_cython=sage_build_cython,
cmdclass = dict(build_cython=sage_build_cython,
build_ext=sage_build_ext,
develop=sage_develop,
install=sage_install_and_clean)
Expand All @@ -76,6 +74,10 @@
python_modules = []
cython_modules = []
else:
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()
Expand Down
37 changes: 0 additions & 37 deletions src/sage_setup/command/sage_build.py

This file was deleted.

0 comments on commit f69c9b8

Please sign in to comment.