From 56ef466dccdd97271a977736c26e81a47ef8ec56 Mon Sep 17 00:00:00 2001 From: DK96-OS <69859316+DK96-OS@users.noreply.github.com> Date: Fri, 17 Jan 2025 12:29:18 -0500 Subject: [PATCH] Merge pull request #2826 from DK96-OS/cli-precedence-2285 Simplify Solution to --python command-line flag precedence --- src/virtualenv/discovery/builtin.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/virtualenv/discovery/builtin.py b/src/virtualenv/discovery/builtin.py index a4c621715..0b0d26b5d 100644 --- a/src/virtualenv/discovery/builtin.py +++ b/src/virtualenv/discovery/builtin.py @@ -3,7 +3,6 @@ import logging import os import sys -from collections import deque from contextlib import suppress from pathlib import Path from typing import TYPE_CHECKING @@ -23,7 +22,7 @@ class Builtin(Discover): - python_spec: Sequence[str] | deque[str] + python_spec: Sequence[str] app_data: AppData try_first_with: Sequence[str] @@ -31,8 +30,7 @@ def __init__(self, options) -> None: super().__init__(options) self.python_spec = options.python or [sys.executable] if self._env.get("VIRTUALENV_PYTHON"): - self.python_spec = deque(self.python_spec) - self.python_spec.rotate(-1) + self.python_spec = self.python_spec[1:] + self.python_spec[:1] # Rotate the list self.app_data = options.app_data self.try_first_with = options.try_first_with