Skip to content

Commit e1c2e12

Browse files
committed
Fixes after rebase. Added compatability for urllib.quote and made a minor file write correction.
1 parent d3f1c59 commit e1c2e12

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

mbed/mbed.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@
2222
from past.builtins import basestring
2323

2424
try:
25-
from urllib.parse import urlparse
25+
from urllib.parse import urlparse, quote
2626
from urllib.request import urlopen
2727
except ImportError:
2828
from urlparse import urlparse
2929
from urllib2 import urlopen
30+
from urllib import quote
3031

3132
import traceback
3233
import sys
@@ -1290,7 +1291,7 @@ def write(self):
12901291

12911292
ref = url.rstrip('/') + '/' + (('' if self.is_build else '#') + self.rev if self.rev else '')
12921293
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:
12941295
f.write(ref+"\n")
12951296

12961297
def rm_untracked(self):
@@ -1303,7 +1304,7 @@ def rm_untracked(self):
13031304
def url2cachedir(self, url):
13041305
up = urlparse(formaturl(url, 'https'))
13051306
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)))
13071308

13081309
def get_cache(self, url, scm):
13091310
cpath = self.url2cachedir(url)

0 commit comments

Comments
 (0)