Update powershell conf to select from powershell and pwsh - #17416
Conversation
Co-authored-by: Abril Rincón Blanco <git@rinconblanco.es>
memsharded
left a comment
There was a problem hiding this comment.
We have this ticket in #17434, that the user was affected by their powershell profile changing the cwd. This could be avoided by -noProfile, but as @Todiq points out in #17434 (comment), this might break users that rely on this.
We could add yet another conf, or maybe allow users to do tools.env.virtualenv:powershell="powershell -noProfile" or any other arguments they might want to provide?
I can think of two alternatives:
or
What do you think? @memsharded @AbrilRBS |
|
I'd probably go for the 1 configuration if we still support the basic string simple case, good for vast majority of users: |
Let's try with the simpler version of using a string like |
|
I agree - we just might want to make sure the docs mention that you're only ever supposed to use powershell.exe/pwsh.exe |
| powershell = "powershell.exe" if conanfile.conf.get( | ||
| "tools.env.virtualenv:powershell") is True else conanfile.conf.get("tools.env.virtualenv:powershell") | ||
|
|
There was a problem hiding this comment.
We have to check if this is True to provide compatibility with the deprecated syntax.
The problem is that conanfile.conf.get("tools.env.virtualenv:powershell", check_type=str) does not work because it will evaluate True or False as strings and not raise any exceptions.
Changelog: Feature: Updated
tools.env.virtualenv:powershellconf to allow specifying the PowerShell executable (e.g., powershell.exe or pwsh) and passing additional arguments.Changelog: Feature: Deprecate use of
tools.env.virtualenv:powershell=True/False.Docs: conan-io/docs#3947
This will change how our powershell scripts are executed from:
to
Depending if we select to use
pwsh(version 7) orpowershell.exeNot exactly meant to close this: #17339 but related to that.