Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Lib/venv/scripts/common/activate
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ deactivate nondestructive

# on Windows, a path can contain colons and backslashes and has to be converted:
case "$(uname)" in
CYGWIN*|MSYS*)
# transform D:\path\to\venv to /d/path/to/venv on MSYS
CYGWIN*|MSYS*|MINGW*)
# transform D:\path\to\venv to /d/path/to/venv on MSYS and MINGW
# and to /cygdrive/d/path/to/venv on Cygwin
VIRTUAL_ENV=$(cygpath "__VENV_DIR__")
export VIRTUAL_ENV
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix the conversion of the VIRTUAL_ENV path in the activate script in :mod:`venv` when running in Git Bash for Windows.
Copy link
Contributor

Choose a reason for hiding this comment

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

Recommend used this.

Suggested change
Fix the conversion of the VIRTUAL_ENV path in the activate script in :mod:`venv` when running in Git Bash for Windows.
Fix the conversion of the ``VIRTUAL_ENV`` path in the activate script in :mod:`venv` when running in Git Bash for Windows.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, the correct markup would be :envvar: :) See also the relevant parts of the devguide.

Copy link
Member

Choose a reason for hiding this comment

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

I edited the PR to use the :envvar: role, but it seems to fail documentation linting:

WARNING: 'envvar' reference target not found: VIRTUAL_ENV [ref.envvar]

Perhaps a nits file needs updating? @erlend-aasland, any ideas?

Copy link
Contributor

Choose a reason for hiding this comment

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

You can use :envvar:`!VIRTUAL_ENV` :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally though, VIRTUAL_ENV should be documented in Doc/library/venv.rst.

Copy link
Member

Choose a reason for hiding this comment

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

Pretty sure VIRTUAL_ENV is undocumented on purpose. It's sys.argv[0] that determines whether you're in a venv or not (and if argv[0] is a relative path, it's resolved using PATH, which makes that the other relevant environment variable).

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, but it's not undocumented; it is mentioned multiple places in our docs, but it lacks a "formal" .. envvar:: definition ;)

Copy link
Member

Choose a reason for hiding this comment

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

Looking at the documentation in the venv module for it, I'd be okay with adding the reference location to there (in short, it says "don't use or rely on this variable, but it might be set")

Copy link
Member

Choose a reason for hiding this comment

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

OK, I'm minded to commit this as it is currently (with !VIRTUAL_ENV), and that envvar definition can be added in a subsequent PR. Any objections?

Loading