Skip to content

Commit

Permalink
Use {env}/bin instead of {env}/Scripts when Python is from MSYS2 …
Browse files Browse the repository at this point in the history
…on Windows.

MSYS2 prefers a Linux filesystem layout, but is otherwise a native
Windows interpreter.

Fixes tox-dev#1982
  • Loading branch information
jschwartzentruber committed Mar 29, 2021
1 parent 5e9a697 commit 8d88256
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions CONTRIBUTORS
Expand Up @@ -48,6 +48,7 @@ Ionel Maries Cristian
Itxaka Serrano
Jake Windle
Jannis Leidel
Jesse Schwartzentruber
Joachim Brandon LeBlanc
Johannes Christ
John Mark Vandenberg
Expand Down
3 changes: 3 additions & 0 deletions docs/changelog/1982.bugfix.rst
@@ -0,0 +1,3 @@
Distinguish between normal Windows Python and MSYS2 Python when looking for
virtualenv executable path. Adds os.sep to :class:`InterpreterInfo`.
- by :user:`jschwartzentruber`
5 changes: 5 additions & 0 deletions src/tox/config/__init__.py
Expand Up @@ -1053,6 +1053,11 @@ def get_envbindir(self):
isinstance(self.python_info, NoInterpreterInfo)
or tox.INFO.IS_WIN is False
or self.python_info.implementation == "Jython"
or (
# this combination is MSYS2
tox.INFO.IS_WIN
and self.python_info.pathsep == "/"
)
or (
tox.INFO.IS_WIN
and self.python_info.implementation == "PyPy"
Expand Down
2 changes: 2 additions & 0 deletions src/tox/helper/get_version.py
@@ -1,6 +1,7 @@
from __future__ import unicode_literals

import json
import os
import platform
import sys

Expand All @@ -11,6 +12,7 @@
"version": sys.version,
"is_64": sys.maxsize > 2 ** 32,
"sysplatform": sys.platform,
"pathsep": os.sep,
"extra_version_info": getattr(sys, "pypy_version_info", None),
}
info_as_dump = json.dumps(info)
Expand Down
2 changes: 2 additions & 0 deletions src/tox/interpreters/__init__.py
Expand Up @@ -103,6 +103,7 @@ def __init__(
version_info,
sysplatform,
is_64,
pathsep,
extra_version_info,
):
self.implementation = implementation
Expand All @@ -111,6 +112,7 @@ def __init__(
self.version_info = version_info
self.sysplatform = sysplatform
self.is_64 = is_64
self.pathsep = pathsep
self.extra_version_info = extra_version_info

def __str__(self):
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/interpreters/test_interpreters.py
Expand Up @@ -192,7 +192,9 @@ def info(
version_info="my-version-info",
sysplatform="my-sys-platform",
):
return InterpreterInfo(implementation, executable, version_info, sysplatform, True, None)
return InterpreterInfo(
implementation, executable, version_info, sysplatform, True, "/", None
)

def test_data(self):
x = self.info("larry", "moe", "shemp", "curly")
Expand Down

0 comments on commit 8d88256

Please sign in to comment.