File tree Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Original file line number Diff line number Diff line change 11import logging
22import os
33import sys
4+ from pathlib import Path
45
56
67if sys .platform == "win32" :
@@ -65,11 +66,7 @@ def main():
6566 # Print a warning if some cached modules were not removed, so that the
6667 # user knows he should manually delete them, or call
6768 # pytensor-cache purge, # to properly clear the cache.
68- items = [
69- item
70- for item in sorted (os .listdir (cache .dirname ))
71- if item .startswith ("tmp" )
72- ]
69+ items = list (Path (cache .dirname ).glob ("tmp*" ))
7370 if items :
7471 _logger .warning (
7572 "There remain elements in the cache dir that you may "
Original file line number Diff line number Diff line change 7777
7878import functools
7979import logging
80- import os
8180import shlex
8281import warnings
8382from pathlib import Path
@@ -402,9 +401,9 @@ def _ldflags(
402401 include_dir = False ,
403402 )
404403 for d in dirs :
405- for f in os . listdir (d .strip ('"' )):
406- if f .endswith ( ".so" ) or f . endswith ( ".dylib" ) or f . endswith ( ".dll" ) :
407- if any (f .find (ll ) >= 0 for ll in l ):
404+ for f in Path (d .strip ('"' )). iterdir ( ):
405+ if f .suffix in { ".so" , ".dylib" , ".dll" } :
406+ if any (f .stem . find (ll ) >= 0 for ll in l ):
408407 found_dyn = True
409408 # Special treatment of clang framework. Specifically for MacOS Accelerate
410409 if "-framework" in l and "Accelerate" in l :
You can’t perform that action at this time.
0 commit comments