-
-
Notifications
You must be signed in to change notification settings - Fork 655
Description
The proposal is to have a configure
script specific to sagelib itself. This can reuse most of the work already done and to be done for #27330 in order to detect sagelib's non-Python compilation dependencies at build time (spkg-configure.m4
). src/configure.ac
would be simpler than the configure.ac
for sage-the-distribution, as it would not need to do anything related to SAGE_LOCAL
, and (possibly) only needs to detect sagelib's direct dependencies.
This configure
script can easily be included in source tarballs for sagelib, and can be called automatically by the setup.py
.
For prior art on this, see cysignals which also runs a configure
script to detect dependencies for its C sources. While I was at one time skeptical of cysignals' approach to this (it is unusual to make configure
part of the build system for a Python package), over time I've found that it works very well in practice.
It uses standard tools that would already be available on systems capable of building sagelib in the first place, and does not introduce any new or out-of-the-ordinary concepts for packagers (aside from having a configure
alongside setup.py
).
It would explicitly check for sagelib's dependencies in a manner that can be used completely independently of sage-the-distribution.
-
Q: What files would be generated by this
configure
script?- A: This proposal remains agnostic to that question. It could be anything from header files, plain-text config files (as proposed in Add a plain-text config file that feeds into sage.env #22652 in 2017), shell scripts (such as
src/bin/sage-env-config
implemented in ./configure --prefix=SAGE_LOCAL #21479 in 2016/17, currently written bySAGE_ROOT/configure
) or Python modules under thesage
package (such assage.env_config
, like Make sagelib installation directory more flexible by creating a module src/sage/env_config.py from src/sage/env_config.py.in, defining variables for use in sage.env #29022 had proposed), or the Python modulesage_conf
next to thesage
module (as Python package sage_conf: Provides optional configuration information for sagelib #29038 implemented).
- A: This proposal remains agnostic to that question. It could be anything from header files, plain-text config files (as proposed in Add a plain-text config file that feeds into sage.env #22652 in 2017), shell scripts (such as
-
Q: How does this impact pip install of sagelib?
- A: In the default case it would "just work": If all of sagelib's dependencies are met by the system then they will be detected on the default paths. If any dependencies are missing that will be reported (hopefully clearly) and the build will fail. When pip-installing setuptools-based packages, it is possible to pass additional command-line flags to the underlying
setup.py
call (see e.g. the--global-option
and--install-option
flags topip install
). We could easily allow passing passing through additional flags to the underlyingconfigure
script if/when special customization is needed.
- A: In the default case it would "just work": If all of sagelib's dependencies are met by the system then they will be detected on the default paths. If any dependencies are missing that will be reported (hopefully clearly) and the build will fail. When pip-installing setuptools-based packages, it is possible to pass additional command-line flags to the underlying
-
Q: How does this impact installing sagelib in a virtualenv/venv?
- A: Basically not at all/trivially: If the dependencies are already met by the system then this proceeds just as installing directly into the system site-packages. If some of the dependencies are installed in the virtualenv itself, and we want to use them, it is necessary to pass additional
C(PP)FLAGS
andLDFLAGS
so that the virtualenv is used as a header/library search path. This is true of any package that has dependencies in a non-standard prefix.- In the virtualenv case we could in principle handle
CFLAGS
andLDFLAGS
automatically by checking for theVIRTUALENV
environment variable, but this is a separate enhancement.
- In the virtualenv case we could in principle handle
- A: Basically not at all/trivially: If the dependencies are already met by the system then this proceeds just as installing directly into the system site-packages. If some of the dependencies are installed in the virtualenv itself, and we want to use them, it is necessary to pass additional
Related:
- Meta-ticket: Split sage-env into 5 to clean up sage configuration #21707: Meta-ticket: Split sage-env into 5 to clean up sage configuration
- Meta-ticket: Make sagelib a pip-installable Python source package, listed on PyPI #21507: Task ticket: Make sagelib a pip-installable Python source package, listed on PyPI
Depends on #29039
CC: @dimpase @mkoeppe @jdemeyer @orlitzky
Component: build: configure
Reviewer: Dima Pasechnik
Issue created by migration from https://trac.sagemath.org/ticket/29119