зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1473498
- More support for py3. r=firefox-build-system-reviewers,mshal
This patch makes BuildEnvironmentNotFoundException a subclass of AttributeError as well, because hasattr in python3 no longer catches all tracebacks but only AttributeError, and we use both hasattr and BuildEnvironmentNotFoundException to guard against a handful of buildconfig variables in a few places where it is OK to not have a buildenvironment. We also use universal_newlines in real_host in init.configure (since I found that fix while working on the AttributeError one) so that we get the right string type back from the process call Lastly this patch also uses BytesIO for calling into a ReducedConfigureSandbox as its stdout and stderr pipes, This ensures that related code handling the sandbox doesn't complain about getbuffer() missing in StringIO in py3. Differential Revision: https://phabricator.services.mozilla.com/D36605 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
4ecf5f7454
Коммит
605aa0fa02
|
@ -819,7 +819,7 @@ def real_host(value, shell):
|
|||
if not value:
|
||||
config_guess = os.path.join(os.path.dirname(__file__), '..',
|
||||
'autoconf', 'config.guess')
|
||||
host = subprocess.check_output([shell, config_guess]).strip()
|
||||
host = subprocess.check_output([shell, config_guess], universal_newlines=True).strip()
|
||||
try:
|
||||
return split_triplet(host)
|
||||
except ValueError:
|
||||
|
|
|
@ -61,7 +61,7 @@ class BadEnvironmentException(Exception):
|
|||
"""Base class for errors raised when the build environment is not sane."""
|
||||
|
||||
|
||||
class BuildEnvironmentNotFoundException(BadEnvironmentException):
|
||||
class BuildEnvironmentNotFoundException(BadEnvironmentException, AttributeError):
|
||||
"""Raised when we could not find a build environment."""
|
||||
|
||||
|
||||
|
@ -270,7 +270,7 @@ class MozbuildObject(ProcessExecutionMixin):
|
|||
# the environment variable, which has an impact on autodetection (when
|
||||
# path is MozconfigLoader.AUTODETECT), and memoization wouldn't account
|
||||
# for it without the explicit (unused) argument.
|
||||
out = six.StringIO()
|
||||
out = six.BytesIO()
|
||||
env = os.environ
|
||||
if path and path != MozconfigLoader.AUTODETECT:
|
||||
env = dict(env)
|
||||
|
|
Загрузка…
Ссылка в новой задаче