@Patrick: Ah, I see (about the complexity). But I guess we need to handle
build_configs.py specially anyway (even if we stay with the current glob
pattern) to make sure it is processed first.
OK, so let's change the title of the issue to reflect the idea of going from a
glob to a single customization file. Florian, if you want to know more about the
discussion that we had on this, let's catch up on it in person. We discussed
various reasons why the glob is a bit problematic, also including the fact that
some customizations override build_configs.py and other don't, depending on the
filename, and that is not very obvious. Repeating the whole discussion in
email/writing would probably take an hour longer than in person. :-)
Regarding lowering implementation complexity, my preferred solution would be to
not merge the two files from within build.py, but rather to execute/include the
custom file from within build_configs.py.
This would simplify things from the perspective of build.py (though of course at
a complexity cost in build_config.py), and I think it would more nicely keep the
build configuration aspects in one place. Users like me are more likely to see
the code in build_configs.py rather than in build.py if they want to figure out
things related to the build configs, so for people like me that would make the
customization feature more easily discoverable. (I actually didn't know or
forgot that the customization feature existed previously, and I often check
build_configs.py.) Essentially, whenever you're tempted to misuse
build_configs.py for personal customization, you see right in front of you that
there is actually a special customization hook.
For example, getting the build configs in build.py could simply be:
import build_configs
and then using build_configs instead of CONFIGS later on. (This has an object
interface rather than a dict interface, so requires further changes, but they
tend to be equally easy/difficult in most cases. getattr(build_configs, x) is a
reasonable way to access something whose name is given in variable x.)
And the customization within build_configs could be implemented as something like:
try:
from .custom_build_configs import *
except ImportError:
pass
at the end of build_configs.py.
(All untested, of course.)
|