-
Notifications
You must be signed in to change notification settings - Fork 991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CLI arg to make virtualenvs not autogenerate if needed #16935
Add CLI arg to make virtualenvs not autogenerate if needed #16935
Conversation
env = VirtualRunEnv(conanfile) | ||
env.generate() | ||
if envs_generation is None: | ||
envs_generation = "auto" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this line. This might simplify chekcing when we add a new not_empty function, but maybe for now it's cleaner to have the following check also check for none instead?
I have allowed for auto
to be the same as the default None
so that it shows up nicely in the command help
--envs-generation {auto,never}
Generation strategy for virtual environment files for the root
And it being None by default would be the same as typing "auto", as mentioned in #16935 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still not very clear why a --envs-generatior=auto
that is equal to doing nothing is needed, maybe the auto
value can be dropped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great, just minor question.
env = VirtualRunEnv(conanfile) | ||
env.generate() | ||
if envs_generation is None: | ||
envs_generation = "auto" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still not very clear why a --envs-generatior=auto
that is equal to doing nothing is needed, maybe the auto
value can be dropped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current issue in Windows(im able to reproduce) comes because when virtualrunenv = True
in the conanfile, and the CLI is None, for some reason I'm seeing Generated aggregated env files: ['conanbuild.bat', 'conanrun.sh']
instead of .bat. Trying to investigate why
with chdir(new_gen_folder): | ||
from conan.tools.env import VirtualRunEnv | ||
env = VirtualRunEnv(conanfile) | ||
env.generate() | ||
|
||
_generate_aggregated_env(conanfile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is one scenario that this will still produce env-files: if the build system is for example msvc+ninja, the conanvcvars
to activate the Visual prompt will be there, and conanbuild.bat
will be generated. is this expected? It is true that in certain conditions like using VSCode, the IDE can also manage vcvars, so this might be included in the if envs_generation is None
?
…onan into ar/deactivate-virtualenvs-cli
Changelog: Feature: Add
--envs-generation={false}
toconan install
andconan build
to disable the generation of virtualenvs (conanbuildenv.sh|bat
andconanrunenv.sh|bat
).Docs: conan-io/docs#3855