@@ -1276,19 +1276,22 @@ def rm_untracked(self):
1276
1276
action ("Remove untracked library reference \" %s\" " % f )
1277
1277
os .remove (f )
1278
1278
1279
- def get_cache (self , url , scm ):
1279
+ def url2cachedir (self , url ):
1280
1280
up = urlparse (formaturl (url , 'https' ))
1281
- if self .cache and up and up .netloc and os . path . isdir ( os . path . join ( self . cache , urllib . quote ( up . netloc ), urllib . quote ( re . sub ( r'^/' , '' , up . path ), '.' + scm ))) :
1281
+ if self .cache and up and up .netloc :
1282
1282
return os .path .join (self .cache , urllib .quote (up .netloc ), urllib .quote (re .sub (r'^/' , '' , up .path )))
1283
1283
1284
+ def get_cache (self , url , scm ):
1285
+ cpath = self .url2cachedir (url )
1286
+ if cpath and os .path .isdir (os .path .join (cpath , '.' + scm )):
1287
+ return cpath
1288
+
1284
1289
def set_cache (self , url ):
1285
- up = urlparse (formaturl (url , 'https' ))
1286
- if self .cache and up and up .netloc and os .path .isdir (self .path ):
1287
- cpath = os .path .join (self .cache , up .netloc , re .sub (r'^/' , '' , up .path ))
1290
+ cpath = self .url2cachedir (url )
1291
+ if cpath and os .path .isdir (self .path ):
1288
1292
try :
1289
1293
if not os .path .isdir (cpath ):
1290
1294
os .makedirs (cpath )
1291
-
1292
1295
scm_dir = '.' + self .scm .name
1293
1296
if os .path .isdir (os .path .join (cpath , scm_dir )):
1294
1297
rmtree_readonly (os .path .join (cpath , scm_dir ))
0 commit comments