Skip to content

mach fails to activate virtualenv if cwd needs quoting #10595

Closed

Description

@zbynekwinkler

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).

Activity

  1. added
    P-windows
    on Apr 14, 2016
  2. changed the title [-]mach fails to activate virtualenv on Windows[/-] [+]mach fails to activate virtualenv if cwd needs quoting[/+] on Apr 20, 2016
  3. zbynekwinkler commented on Apr 20, 2016

    @zbynekwinkler
    ContributorAuthor

    @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.

  4. added a commit that references this issue on May 3, 2016
    306dd55
  5. added a commit that references this issue on Jul 17, 2016
    e7a55ae
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-machP-windows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions