Fixed dotpath venv guessing

This commit is contained in:
Kamil Krzyśków
2025-07-23 22:04:07 +02:00
committed by Martin Donath
parent 88bdcf5f16
commit 6d4f756461
2 changed files with 20 additions and 18 deletions

View File

@@ -204,15 +204,16 @@ class InfoPlugin(BasePlugin[InfoConfig]):
# Guess other Virtual Environment paths in case we forget to activate
# them or in case we have multiple. Making sure which venv is activated
# is not necessary, as it is an optional step in the guidelines.
for path in glob.iglob(
pathname = "**/pyvenv.cfg",
root_dir = os.getcwd(),
recursive = True
):
path = os.path.join(os.getcwd(), os.path.dirname(path))
if path not in site.PREFIXES:
print(f"Possible inactive venv: {path}")
self.exclusion_patterns.append(_resolve_pattern(path))
for abs_root, dirnames, filenames in os.walk(os.getcwd()):
for filename in filenames:
if filename.lower() != "pyvenv.cfg":
continue
path = abs_root[0].upper() + abs_root[1:]
if path not in site.PREFIXES:
print(f"Possible inactive venv: {path}")
self.exclusion_patterns.append(_resolve_pattern(path))
# Exclude site_dir for projects
if projects_plugin:

View File

@@ -204,15 +204,16 @@ class InfoPlugin(BasePlugin[InfoConfig]):
# Guess other Virtual Environment paths in case we forget to activate
# them or in case we have multiple. Making sure which venv is activated
# is not necessary, as it is an optional step in the guidelines.
for path in glob.iglob(
pathname = "**/pyvenv.cfg",
root_dir = os.getcwd(),
recursive = True
):
path = os.path.join(os.getcwd(), os.path.dirname(path))
if path not in site.PREFIXES:
print(f"Possible inactive venv: {path}")
self.exclusion_patterns.append(_resolve_pattern(path))
for abs_root, dirnames, filenames in os.walk(os.getcwd()):
for filename in filenames:
if filename.lower() != "pyvenv.cfg":
continue
path = abs_root[0].upper() + abs_root[1:]
if path not in site.PREFIXES:
print(f"Possible inactive venv: {path}")
self.exclusion_patterns.append(_resolve_pattern(path))
# Exclude site_dir for projects
if projects_plugin: