Bug 843492 - Bootstrapping fails using Python 3x due to urllib2; r=gps

DONTBUID (NPOTB)
This commit is contained in:
Timur Timirkhanov 2013-04-03 05:38:00 -07:00
Родитель 4329623e9e
Коммит aa7fc133a5
2 изменённых файлов: 11 добавлений и 5 удалений

Просмотреть файл

@ -18,7 +18,10 @@ import os
import shutil
import sys
import tempfile
import urllib2
try:
from urllib2 import urlopen
except ImportError:
from urllib.request import urlopen
from optparse import OptionParser
@ -51,7 +54,7 @@ def fetch_files(repo_url, repo_type):
for path in REPOSITORY_PATHS:
url = repo_url + '/raw-file/default/python/mozboot/' + path
req = urllib2.urlopen(url=url, timeout=30)
req = urlopen(url=url, timeout=30)
files[path] = req.read()
else:
raise NotImplementedError('Not sure how to handle repo type.', repo_type)

Просмотреть файл

@ -9,7 +9,10 @@ import re
import subprocess
import sys
import tempfile
import urllib2
try:
from urllib2 import urlopen
except ImportError:
from urllib.request import urlopen
from distutils.version import StrictVersion
@ -258,7 +261,7 @@ class OSXBootstrapper(BaseBootstrapper):
def install_homebrew(self):
print(PACKAGE_MANAGER_INSTALL % ('Homebrew', 'Homebrew', 'Homebrew', 'brew'))
bootstrap = urllib2.urlopen(url=HOMEBREW_BOOTSTRAP, timeout=20).read()
bootstrap = urlopen(url=HOMEBREW_BOOTSTRAP, timeout=20).read()
with tempfile.NamedTemporaryFile() as tf:
tf.write(bootstrap)
tf.flush()
@ -272,7 +275,7 @@ class OSXBootstrapper(BaseBootstrapper):
'OS X version. You will need to install MacPorts manually.')
print(PACKAGE_MANAGER_INSTALL % ('MacPorts', 'MacPorts', 'MacPorts', 'port'))
pkg = urllib2.urlopen(url=url, timeout=300).read()
pkg = urlopen(url=url, timeout=300).read()
with tempfile.NamedTemporaryFile(suffix='.pkg') as tf:
tf.write(pkg)
tf.flush()