Skip to content
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 poetry shell for zsh if space character in venv path #7245

Merged
merged 7 commits into from Jan 20, 2024

Conversation

dimstunt
Copy link
Contributor

@dimstunt dimstunt commented Dec 23, 2022

fix zsh: poetry shell doesn't work if space character in .venv path

Pull Request Check List

Resolves: #7244

Confirmed working on bash, zsh

fix zsh: poetry shell doesn't work if space character in .venv path

python-poetry#7244
PabloEmidio
PabloEmidio previously approved these changes Dec 25, 2022
Copy link
Contributor

@PabloEmidio PabloEmidio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On PEP 8, there is the following say about triple quote

For triple-quoted strings, always use double quote characters to be consistent with the docstring convention in PEP 257.

@jaklan
Copy link

jaklan commented Dec 25, 2022

Or even simpler:
c.sendline(f'emulate bash -c ". {shlex.quote(str(activate_path))}"')
(so we get emulate bash -c ". '/some path/activate'")

But the safest one would be:
c.sendline(f"emulate bash -c {shlex.quote(f'. {shlex.quote(str(activate_path))}')}")
(so we get emulate bash -c '. '"'"'/some path/activate'"'"'')

@DennisTheMenace780
Copy link

Any updates on whether this will get merged in the near future? I am running into the same issue on macOS unfortuantely.

@dimstunt
Copy link
Contributor Author

@PabloEmidio when you have a chance, please check this.

@PabloEmidio
Copy link
Contributor

@PabloEmidio when you have a chance, please check this.

For what I saw, it should do it. Could any test be added to validate this scenary?

@dimstunt
Copy link
Contributor Author

dimstunt commented Feb 9, 2023

@PabloEmidio when you have a chance, please check this.

For what I saw, it should do it. Could any test be added to validate this scenary?

Not fast because the executing bash script is moked, and I don't have enough expertise in pytest to change that.

@radoering
Copy link
Member

pre-commit.ci autofix

@radoering radoering changed the title fix poetry shell doesn't work if space character in .venv path fix poetry shell for zsh if space character in venv path Jan 20, 2024
@radoering radoering merged commit 47fe2ac into python-poetry:master Jan 20, 2024
20 checks passed
Copy link

github-actions bot commented Mar 3, 2024

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

zsh: poetry shell doesn't work if space character in .venv path
6 participants