Skip to content

Commit

Permalink
feat: drop support for 2.7 virtual environments
Browse files Browse the repository at this point in the history
  • Loading branch information
majorgreys committed Aug 9, 2023
1 parent b29631f commit f919c6b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 14 deletions.
4 changes: 4 additions & 0 deletions releasenotes/notes/drop-27-virtualenv-0fa3b60b14045781.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
features:
- |
In order to support Python 3.12, we are bumping the ``virtualenv`` dependency and thus dropping support for Python 2.7.
8 changes: 0 additions & 8 deletions riot/riot.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,14 +631,6 @@ def prepare(
deps_venv_path = venv_path + "_deps"
if not Path(deps_venv_path).exists():
py.create_venv(recreate=False, path=deps_venv_path)
if py.version_info() < (3,):
# Use the same binary. This is necessary for Python 2.7
deps_bin = (
Path(deps_venv_path) / "bin" / "python"
).resolve()
venv_bin = (Path(venv_path) / "bin" / "python").resolve()
deps_bin.unlink()
deps_bin.symlink_to(venv_bin)
Session.run_cmd_venv(deps_venv_path, cmd, env=env)
except CmdFailure as e:
raise CmdFailure(
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
install_requires=[
"dataclasses; python_version<'3.7'",
"click>=7",
"virtualenv<=20.20.0",
"virtualenv",
"rich",
"pexpect",
"packaging",
Expand Down
2 changes: 1 addition & 1 deletion tests/data/diff_pys_riotfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
name="test",
command="exit 0",
# DEV: purposely out of order so we can verify sorting in tests
pys=["3.5", "3.8", "3.6", "3.9", "3.7", "2.7"],
pys=["3.5", "3.8", "3.6", "3.9", "3.7"],
venvs=[
Venv(
pkgs={"pytest": ["==5.4.3", ""]},
Expand Down
7 changes: 3 additions & 4 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def test_list_with_python(cli: click.testing.CliRunner) -> None:
with with_riotfile(cli, "empty_riotfile.py"):
result = cli.invoke(
riot.cli.main,
["list", "--python", "3.6", "-p", "3.8", "--python", "2.7"],
["list", "--python", "3.6", "-p", "3.8"],
)
# Success, but no output because we don't have a matching pattern
assert result.exit_code == 0
Expand All @@ -106,7 +106,6 @@ def test_list_with_python(cli: click.testing.CliRunner) -> None:
assert list_venvs.call_args.kwargs["pythons"] == (
Interpreter("3.6"),
Interpreter("3.8"),
Interpreter("2.7"),
)


Expand All @@ -126,7 +125,7 @@ def test_list_with_interpreters_only(cli: click.testing.CliRunner) -> None:
with with_riotfile(cli, "diff_pys_riotfile.py"):
result = cli.invoke(riot.cli.main, ["list", "--interpreters"])
assert result.exit_code == 0, result.stdout
assert result.stdout == "2.7\n3.5\n3.6\n3.7\n3.8\n3.9\n"
assert result.stdout == "3.5\n3.6\n3.7\n3.8\n3.9\n"


def test_list_with_hash_only(cli: click.testing.CliRunner) -> None:
Expand All @@ -147,7 +146,7 @@ def test_list_with_hash_only(cli: click.testing.CliRunner) -> None:
assert result.exit_code == 0, result.stdout
assert (
result.stdout
== "156e0a3\n175f9ae\n1a1f742\n1f0f227\n524376c\n60d413e\n61b42ab\n83b22e0\n89d1e7a\n982a4b5\nb1c318a\nbdc1729\n"
== "156e0a3\n175f9ae\n1a1f742\n1f0f227\n524376c\n61b42ab\n83b22e0\n89d1e7a\n982a4b5\nb1c318a\n"
)


Expand Down

0 comments on commit f919c6b

Please sign in to comment.