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

mach fails to activate virtualenv if cwd needs quoting #10595

Closed
zbynekwinkler opened this issue Apr 14, 2016 · 1 comment
Closed

mach fails to activate virtualenv if cwd needs quoting #10595

zbynekwinkler opened this issue Apr 14, 2016 · 1 comment
Labels
A-mach P-windows Any version of Windows capable of running Servo

Comments

@zbynekwinkler
Copy link
Contributor

zbynekwinkler commented Apr 14, 2016

If the quoting added in the fix in #8394 (4ff8d3a) kicks in, it causes virtualenv to fail to activate.

For the common case it is no op:

>>> from pipes import quote
>>> print quote('common/case')
common/case

When the path actually needs quoting, this is what happens:

>>> print quote('test spaces')
'test spaces'
>>> print quote('windows\\path')
'windows\\path'

Please note the embedded quotes.

Virtualenv in activate_this.py uses __file__ to build the path that should be added to PATH:

>>> print os.getcwd()
C:\software\git
>>> print os.path.abspath(quote('windows\\path'))
C:\software\git\'windows\path'
>>>

As you can see the constructed path is not valid. Adding it at the beginning of PATH has no effect. This issue affects any case when the call to quote needs to kick in (not only on Windows as previously reported).

@jdm jdm added P-windows Any version of Windows capable of running Servo A-mach labels Apr 14, 2016
@zbynekwinkler zbynekwinkler changed the title mach fails to activate virtualenv on Windows mach fails to activate virtualenv if cwd needs quoting Apr 20, 2016
@zbynekwinkler
Copy link
Contributor Author

@jdm I have updated the title and description of this issue to cover also the case with space in path. Feel free to further tweak it and/or relabel.

bors-servo pushed a commit that referenced this issue May 3, 2016
Ensure virtualenv activates

Fixes #10595. For more info see #10595 or the commit message.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10618)
<!-- Reviewable:end -->
bors-servo pushed a commit that referenced this issue Jul 17, 2016
Ensure virtualenv activates

Fixes #10595. For more info see #10595 or the commit message.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10618)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mach P-windows Any version of Windows capable of running Servo
Projects
None yet
Development

No branches or pull requests

2 participants