gh-37024: Access database and other files through features, for simpler configuration
This PR reworks the way sagemath access database files, and some other
external files. The end result is that the runtime detection of
databases as features matches exactly what will be used. Moreover, this
leads to an easy implementation of search paths, meaning we don't need
configuration as long as the files are in a few standard system
locations.
Notes on implementation:
- First every user of these files access them via features, and never
directly through `sage.env`, since the former is dynamic and the latter
is static.
- Then we add a variable `SAGE_DATA_PATH` which is a colon separated
search path for databases. The default should work for sage-the-distro
and most distros (think `/usr/share/sagemath:/usr/share` for a system
install on `/usr`).
- Now a database, say `cremona` is searched on `$p/cremona` for each
`$p` in `SAGE_DATA_PATH`.
- I also added `$DOT_SAGE/db` first in the search path, this makes it
easy for a user to install a missing database (or update an old one).
- Finally, as an example I did something similar to find `JmolData.jar`
and `three.min.js`. The former is searched in
`$SAGE_SHARE/sagemath/jmol` and `$SAGE_SHARE/jmol` and the latter also
in `$SAGE_SHARE/jupyter/nbextensions/threejs-sage` which seems to make
sense.
Other files can be done later (e.g. mathjax). In principle anything that
has a default value in `sage.env` or `sage_conf` should benefit from
using a search path and removing the default value.
With this PR, I can run stock sagemath without any `sage_conf.py`.
### :memo: Checklist
- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [x] I have created tests covering the changes.
### :hourglass: Dependencies
URL: https://github.com/sagemath/sage/pull/37024
Reported by: Gonzalo Tornaría
Reviewer(s): François Bissey, Gonzalo Tornaría, Matthias Köppe, Michael Orlitzky