sage.env._add_variable_or_fallback: Get rid of $variable substitution feature
mkoeppe opened this issue · 10 comments
As discussed in #23758, the feature of _add_variable_or_fallback to do variable substitution seems unnecessarily complex.
All uses later in that module such as
_add_variable_or_fallback('SAGE_ETC', opj('$SAGE_LOCAL', 'etc'))
can be replaced by simple use of Python variables (which all exist in the sage.env module)
_add_variable_or_fallback('SAGE_ETC', opj(SAGE_LOCAL, 'etc'))
This also will have a clearer failure mode -- instead of leaving an unsubstituted $SAGE_LOCAL in a string if that variable is not set for some reason, an error will be raised.
Depends on #23758
Depends on #21535
CC: @jhpalmieri
Component: build
Branch/Commit: u/jhpalmieri/env @ c7cff80
Issue created by migration from https://trac.sagemath.org/ticket/23762
I think the variable substitution scheme was introduced in #13432. I've asked there about its rationale: I don't want to remove this without trying to understand why it was introduced in the first place.
In the mean time, I have a branch which makes the change from strings to variables: '$VAR' --> VAR.
Branch: u/jhpalmieri/env
Dependencies: #23758
Commit: c7cff80
This branch passes doctests for me, but I want to wait to set it to "needs_review" for some feedback from the participants at #13432.