Skip to content

Commit

Permalink
Support double-digit minor version in python keyword (#367)
Browse files Browse the repository at this point in the history
* Add test for resolving python3.10

* Support double-digit minor version in `python` keyword

This fixes an issue where "3.10" is resolved as "python3".
  • Loading branch information
cjolowicz committed Nov 30, 2020
1 parent 6dc712a commit bbe2cd8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nox/virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def _resolved_interpreter(self) -> str:

# If this is just a X, X.Y, or X.Y.Z string, extract just the X / X.Y
# part and add Python to the front of it.
match = re.match(r"^(?P<xy_ver>\d(\.\d)?)(\.\d+)?$", self.interpreter)
match = re.match(r"^(?P<xy_ver>\d(\.\d+)?)(\.\d+)?$", self.interpreter)
if match:
xy_version = match.group("xy_ver")
cleaned_interpreter = "python{}".format(xy_version)
Expand All @@ -347,7 +347,7 @@ def _resolved_interpreter(self) -> str:
raise self._resolved

# Allow versions of the form ``X.Y-32`` for Windows.
match = re.match(r"^\d\.\d-32?$", cleaned_interpreter)
match = re.match(r"^\d\.\d+-32?$", cleaned_interpreter)
if match:
# preserve the "-32" suffix, as the Python launcher expects
# it.
Expand Down
1 change: 1 addition & 0 deletions tests/test_virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ def test__resolved_interpreter_none(make_one):
("3", "python3"),
("3.6", "python3.6"),
("3.6.2", "python3.6"),
("3.10", "python3.10"),
("2.7.15", "python2.7"),
],
)
Expand Down

0 comments on commit bbe2cd8

Please sign in to comment.