Skip to content

Commit

Permalink
Merge pull request #2826 from DK96-OS/cli-precedence-2285
Browse files Browse the repository at this point in the history
Simplify Solution to --python command-line flag precedence
  • Loading branch information
DK96-OS authored Jan 17, 2025
1 parent caf03a2 commit 56ef466
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/virtualenv/discovery/builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -23,16 +22,15 @@


class Builtin(Discover):
python_spec: Sequence[str] | deque[str]
python_spec: Sequence[str]
app_data: AppData
try_first_with: Sequence[str]

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

Expand Down

0 comments on commit 56ef466

Please sign in to comment.