Skip to content

Commit 6d4f756

Browse files
kamilkrzyskowsquidfunk
authored andcommitted
Fixed dotpath venv guessing
1 parent 88bdcf5 commit 6d4f756

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

material/plugins/info/plugin.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -204,15 +204,16 @@ def on_config(self, config):
204204
# Guess other Virtual Environment paths in case we forget to activate
205205
# them or in case we have multiple. Making sure which venv is activated
206206
# is not necessary, as it is an optional step in the guidelines.
207-
for path in glob.iglob(
208-
pathname = "**/pyvenv.cfg",
209-
root_dir = os.getcwd(),
210-
recursive = True
211-
):
212-
path = os.path.join(os.getcwd(), os.path.dirname(path))
213-
if path not in site.PREFIXES:
214-
print(f"Possible inactive venv: {path}")
215-
self.exclusion_patterns.append(_resolve_pattern(path))
207+
for abs_root, dirnames, filenames in os.walk(os.getcwd()):
208+
for filename in filenames:
209+
if filename.lower() != "pyvenv.cfg":
210+
continue
211+
212+
path = abs_root[0].upper() + abs_root[1:]
213+
214+
if path not in site.PREFIXES:
215+
print(f"Possible inactive venv: {path}")
216+
self.exclusion_patterns.append(_resolve_pattern(path))
216217

217218
# Exclude site_dir for projects
218219
if projects_plugin:

src/plugins/info/plugin.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -204,15 +204,16 @@ def on_config(self, config):
204204
# Guess other Virtual Environment paths in case we forget to activate
205205
# them or in case we have multiple. Making sure which venv is activated
206206
# is not necessary, as it is an optional step in the guidelines.
207-
for path in glob.iglob(
208-
pathname = "**/pyvenv.cfg",
209-
root_dir = os.getcwd(),
210-
recursive = True
211-
):
212-
path = os.path.join(os.getcwd(), os.path.dirname(path))
213-
if path not in site.PREFIXES:
214-
print(f"Possible inactive venv: {path}")
215-
self.exclusion_patterns.append(_resolve_pattern(path))
207+
for abs_root, dirnames, filenames in os.walk(os.getcwd()):
208+
for filename in filenames:
209+
if filename.lower() != "pyvenv.cfg":
210+
continue
211+
212+
path = abs_root[0].upper() + abs_root[1:]
213+
214+
if path not in site.PREFIXES:
215+
print(f"Possible inactive venv: {path}")
216+
self.exclusion_patterns.append(_resolve_pattern(path))
216217

217218
# Exclude site_dir for projects
218219
if projects_plugin:

0 commit comments

Comments
 (0)