22
22
from past .builtins import basestring
23
23
24
24
try :
25
- from urllib .parse import urlparse
25
+ from urllib .parse import urlparse , quote
26
26
from urllib .request import urlopen
27
27
except ImportError :
28
28
from urlparse import urlparse
29
29
from urllib2 import urlopen
30
+ from urllib import quote
30
31
31
32
import traceback
32
33
import sys
@@ -1290,7 +1291,7 @@ def write(self):
1290
1291
1291
1292
ref = url .rstrip ('/' ) + '/' + (('' if self .is_build else '#' ) + self .rev if self .rev else '' )
1292
1293
action ("Updating reference \" %s\" -> \" %s\" " % (relpath (cwd_root , self .path ) if cwd_root != self .path else self .name , ref ))
1293
- with open (self .lib , 'wb ' ) as f :
1294
+ with open (self .lib , 'w ' ) as f :
1294
1295
f .write (ref + "\n " )
1295
1296
1296
1297
def rm_untracked (self ):
@@ -1303,7 +1304,7 @@ def rm_untracked(self):
1303
1304
def url2cachedir (self , url ):
1304
1305
up = urlparse (formaturl (url , 'https' ))
1305
1306
if self .cache and up and up .netloc :
1306
- return os .path .join (self .cache , urllib . quote (up .netloc ), urllib . quote (re .sub (r'^/' , '' , up .path )))
1307
+ return os .path .join (self .cache , quote (up .netloc ), quote (re .sub (r'^/' , '' , up .path )))
1307
1308
1308
1309
def get_cache (self , url , scm ):
1309
1310
cpath = self .url2cachedir (url )
0 commit comments