I am using an environment collector plugin in order to populate an environment variable (here: GDAL_VERSION_SPECIFICATION):
env_dict = env_entry.setdefault("env-vars", {})
env_dict.setdefault("GDAL_VERSION_SPECIFICATION", some_value)
This environment variable is referenced in pyproject.toml:
dependencies = [
"gdal{env:GDAL_VERSION_SPECIFICATION}",
]
But currently only real environment variables are used for context substitution:
if env_var in os.environ:
(source)
Thus, I am currently setting a real environment in my environment collector plugin as a workaround:
os.environ.setdefault("GDAL_VERSION_SPECIFICATION", some_value)
But this approach is certainly not the intended way of using environment collector plugins.
And it is fragile, since it relies on the collector plugin and the context substitution being executed within the same process.
The obvious solution seems to be, to let the context substitution peek into the env-vars dictionary of the current environment.
But these information are not handed over to the context substitution at the moment (source).
Do you have an idea, how this could be solved? Or maybe the os.environ hack above is sufficient?