Use a file to store environment variables to activate for virtualenv generators #5989
…n be added after generating the virutalenv files
Hi, @ytimenkov . Never is too late, and your considerations are very valuable. Let me try to comment some of your points (I'm moving from the comment inline in the code to the main conversation in the PR).
I agree with you, and I thought about how to make it more consistent. In the file there are only the new or modified variables, while we want to remember only the modified ones... I probably could do some kind of
Concatenation is done if the variable is a list, as it was before: https://github.com/conan-io/conan/pull/5989/files/a65f89468ce0e9f10c0b664d6e3b1ea8bad1f0ea. Thanks to you there are tests that are actually checking that.
Yes, this is a problem and the next step to consider is this one #6175 (probably for 2.0 as it might break someone). With this new implementation the old values are remembered when the environment is activated not when
Also, as you mention, right now it is not possible to activate nested environments (remembered values will be overridden), but, if we use unique keys for each environment (
I've got a crazy idea yesterday :)
You've already introduced Jijna templates (which I think is really good), so why not to make a step further and move generation of activation / deactivation files altogether to Jinja Templates?
I mean, all that logic for generating files could be done completely in Jinja. virtualenv generator just prepares variables, sets them into some Jinja context or environment and then just renders the template. If needed some helper functions could be also provided as some
Then we do one more step and allow overriding it by user, like now with hooks or layouts.
This way we have 100% compatibility (if default template produces the same scripts as today) while users getting good control for overriding this behavior.