Skip to content

Commit

Permalink
Update filter to reject conda /pkgs directory
Browse files Browse the repository at this point in the history
  • Loading branch information
mrclary committed Nov 5, 2024
1 parent d7e3649 commit 2558fa8
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions spyder/plugins/pythonpath/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,20 @@

def check_path(path):
"""Check that `path` is not a [site|dist]-packages folder."""
pattern_string = r'(ana|Ana|mini|micro)(conda|mamba)\d*(/base)*/pkgs'
if os.name == 'nt':
pattern = re.compile(r'.*(l|L)ib/(site|dist)-packages.*')
pattern_string = (
f'.*/({pattern_string}'
r'|(l|L)ib/(site|dist)-packages).*'
)
else:
pattern = re.compile(
r'.*(lib|lib64)/'
pattern_string = (
f'.*/({pattern_string}'
r'|(lib|lib64)/'
r'(python|python\d+|python\d+\.\d+)/'
r'(site|dist)-packages.*'
r'(site|dist)-packages).*'
)
pattern = re.compile(pattern_string)

path_norm = path.replace('\\', '/')
return pattern.match(path_norm) is None
Expand Down

0 comments on commit 2558fa8

Please sign in to comment.