зеркало из https://github.com/mozilla/gecko-dev.git
Bug 843492 - Bootstrapping fails using Python 3x due to urllib2; r=gps
DONTBUID (NPOTB)
This commit is contained in:
Родитель
4329623e9e
Коммит
aa7fc133a5
|
@ -18,7 +18,10 @@ import os
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import urllib2
|
try:
|
||||||
|
from urllib2 import urlopen
|
||||||
|
except ImportError:
|
||||||
|
from urllib.request import urlopen
|
||||||
|
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
||||||
|
@ -51,7 +54,7 @@ def fetch_files(repo_url, repo_type):
|
||||||
for path in REPOSITORY_PATHS:
|
for path in REPOSITORY_PATHS:
|
||||||
url = repo_url + '/raw-file/default/python/mozboot/' + path
|
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()
|
files[path] = req.read()
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError('Not sure how to handle repo type.', repo_type)
|
raise NotImplementedError('Not sure how to handle repo type.', repo_type)
|
||||||
|
|
|
@ -9,7 +9,10 @@ import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import urllib2
|
try:
|
||||||
|
from urllib2 import urlopen
|
||||||
|
except ImportError:
|
||||||
|
from urllib.request import urlopen
|
||||||
|
|
||||||
from distutils.version import StrictVersion
|
from distutils.version import StrictVersion
|
||||||
|
|
||||||
|
@ -258,7 +261,7 @@ class OSXBootstrapper(BaseBootstrapper):
|
||||||
|
|
||||||
def install_homebrew(self):
|
def install_homebrew(self):
|
||||||
print(PACKAGE_MANAGER_INSTALL % ('Homebrew', 'Homebrew', 'Homebrew', 'brew'))
|
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:
|
with tempfile.NamedTemporaryFile() as tf:
|
||||||
tf.write(bootstrap)
|
tf.write(bootstrap)
|
||||||
tf.flush()
|
tf.flush()
|
||||||
|
@ -272,7 +275,7 @@ class OSXBootstrapper(BaseBootstrapper):
|
||||||
'OS X version. You will need to install MacPorts manually.')
|
'OS X version. You will need to install MacPorts manually.')
|
||||||
|
|
||||||
print(PACKAGE_MANAGER_INSTALL % ('MacPorts', 'MacPorts', 'MacPorts', 'port'))
|
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:
|
with tempfile.NamedTemporaryFile(suffix='.pkg') as tf:
|
||||||
tf.write(pkg)
|
tf.write(pkg)
|
||||||
tf.flush()
|
tf.flush()
|
||||||
|
|
Загрузка…
Ссылка в новой задаче