Skip to content

Don't use make for autogenerated modules in sagelib #21613

@embray

Description

@embray

Currently there is a src/Makefile at the root of the sagelib sources that is required to be invoked in order to make sure the packages in sage_setup.autogen and that autogenerated sources are placed in the sage sources before running its setup.py install.

#21480 inverts things somewhat by removing the old Makefile (really making it into a no-op for now), but pulling out the sage_setup.autogen stuff into a separate makefile that is still invoked by calling make from the setup.py (in the current version of that ticket it is even called unconditionally). This is pretty non-standard.

The appropriate time to do this would be either just before the build_py command is run, or the build_ext command is run (in the case of autogenerated sources for extension modules).

In the current cases we have its very trivial to check whether or not any of the sources actually need to be regenerated, and this is a pretty normal thing to do in some other complex Python packages. For example, the package responsible for generating the source files (e.g. currently the sage_setup.autogen sub-packages) simply needs to be responsible for knowing what its own source code files are, and knowing the paths for its generated sources--then just compare modtimes. Invoking make is not required at all.

One can do even better by having one of the generated files be a hash of the source files, and compare the hashes instead (this avoids rebuilds when switching between git branches but where the files didn't otherwise change).

CC: @mkoeppe @jdemeyer

Component: build

Author: Erik Bray

Branch: 34ca46c

Reviewer: Matthias Koeppe

Issue created by migration from https://trac.sagemath.org/ticket/21613

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions