File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212import socket
1313import random
1414import shutil
15- from pkg_resources import resource_string
15+
16+ try :
17+ from pkg_resources import resource_string
18+ except ImportError as e :
19+ resource_string = None
20+
1621
1722import logging
1823from urlparse import urlparse
@@ -493,10 +498,11 @@ def get_best_stashcache():
493498 cache_files = [ caches_json_location ]
494499 else :
495500 prefix = os .environ .get ("OSG_LOCATION" , "" )
496- cache_files = [resource_string (__name__ , 'caches.json' ),
497- os .path .join (os .path .dirname (os .path .realpath (__file__ )), "caches.json" ),
501+ cache_files = [os .path .join (os .path .dirname (os .path .realpath (__file__ )), "caches.json" ),
498502 os .path .join (prefix , "/etc/stashcache/caches.json" ),
499503 os .path .join (prefix , "/usr/share/stashcache/caches.json" )]
504+ if resource_string :
505+ cache_files .insert (0 , resource_string (__name__ , 'caches.json' ))
500506
501507 for cache_file in cache_files :
502508 if os .path .isfile (cache_file ):
You can’t perform that action at this time.
0 commit comments