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
Fix activate for windows and updated docs for Azure #2854
Fix activate for windows and updated docs for Azure #2854
Conversation
for more information, see https://pre-commit.ci
…thub.com/pluttodk/pdm into fix-activate-for-windows-and-update-docs
@@ -55,6 +56,8 @@ def get_activate_command(self, venv: VirtualEnv) -> str: # pragma: no cover | |||
command, filename = "source", "activate" | |||
activate_script = venv.interpreter.with_name(filename) | |||
if activate_script.exists(): | |||
if platform.system() == "Windows": | |||
return f"{shlex.quote(str(activate_script))}" |
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.
look above several lines, we have a case for powershell. this will completely bypass it.
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.
This only works for powershell 7 and not 5.1. Neither does the old solution work for Batch.
I did not want to remove the previous check with powershell, since you can install powershell on linux (not sure why you would want that but you can) and that supports the dot command.
Output from powershell 5.1
> Invoke-Expression (pdm venv activate)
C:\Code\data_indhentning\.venv\Scripts\Activate.ps1 : Cannot dot-source this command because it was defined in a differ
ent language mode. To invoke this command without importing its contents, omit the '.' operator.
At line:1 char:1
+ . 'C:\Code\.venv\Scripts\Activate.ps1'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Activate.ps1], NotSupportedException
+ FullyQualifiedErrorId : DotSourceNotSupported,Activate.ps1
Pull Request Checklist
news/
describing what is new.Describe what you have changed in this PR.
Altered the
pdm venv activate
to not include"."
on windows, since this causes an error. This also ensures, that for non Powershell users on windows, the outputted command can be directly pasted into shell.Additionally added documentation as to how to add authentication to Azure Artifacts, since this seems to be a common question asked. Such as: #2760