From 9002364b941651e831866c9e7a4f7b321281f9e7 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Mon, 27 Jan 2014 16:24:52 -0500 Subject: [PATCH] Backed out changeset f9d83ec11ca9 (bug 936555) for checktest failures. CLOSED TREE --- CLOBBER | 2 +- python/mozbuild/mozbuild/mozconfig.py | 8 +++---- python/mozbuild/mozbuild/mozinfo.py | 9 ++++---- python/mozbuild/mozbuild/test/test_mozinfo.py | 23 ++++++++----------- 4 files changed, 19 insertions(+), 23 deletions(-) diff --git a/CLOBBER b/CLOBBER index 71d0c8c1d3e2..c52afa2e731f 100644 --- a/CLOBBER +++ b/CLOBBER @@ -22,4 +22,4 @@ # changes to stick? As of bug 928195, this shouldn't be necessary! Please # don't change CLOBBER for WebIDL changes any more. -Bug 936555 - changes to mozconfig finding require clobbers, given that builds on try were green +bug 960811 - clobber to rebuild preprocessed files when enabling synthetic APKs diff --git a/python/mozbuild/mozbuild/mozconfig.py b/python/mozbuild/mozbuild/mozconfig.py index 2f36e592f576..bfd2f2f8cd7f 100644 --- a/python/mozbuild/mozbuild/mozconfig.py +++ b/python/mozbuild/mozbuild/mozconfig.py @@ -75,7 +75,7 @@ class MozconfigLoader(ProcessExecutionMixin): return os.path.join(our_dir, 'mozconfig_loader') - def find_mozconfig(self, env=os.environ): + def find_mozconfig(self): """Find the active mozconfig file for the current environment. This emulates the logic in mozconfig-find. @@ -91,10 +91,10 @@ class MozconfigLoader(ProcessExecutionMixin): """ # Check for legacy methods first. - if 'MOZ_MYCONFIG' in env: + if 'MOZ_MYCONFIG' in os.environ: raise MozconfigFindException(MOZ_MYCONFIG_ERROR) - env_path = env.get('MOZCONFIG', None) + env_path = os.environ.get('MOZCONFIG', None) if env_path is not None: if not os.path.exists(env_path): raise MozconfigFindException( @@ -128,7 +128,7 @@ class MozconfigLoader(ProcessExecutionMixin): deprecated_paths = [os.path.join(self.topsrcdir, s) for s in self.DEPRECATED_TOPSRCDIR_PATHS] - home = env.get('HOME', None) + home = os.environ.get('HOME', None) if home is not None: deprecated_paths.extend([os.path.join(home, s) for s in self.DEPRECATED_HOME_PATHS]) diff --git a/python/mozbuild/mozbuild/mozinfo.py b/python/mozbuild/mozbuild/mozinfo.py index f73ae926b4a2..230281886053 100755 --- a/python/mozbuild/mozbuild/mozinfo.py +++ b/python/mozbuild/mozbuild/mozinfo.py @@ -8,7 +8,7 @@ import os import re import json -import mozbuild.mozconfig as mozconfig + def build_dict(config, env=os.environ): """ @@ -27,9 +27,10 @@ def build_dict(config, env=os.environ): d = {} d['topsrcdir'] = config.topsrcdir - the_mozconfig = mozconfig.MozconfigLoader(config.topsrcdir).find_mozconfig(env) - if the_mozconfig: - d['mozconfig'] = the_mozconfig + if 'MOZCONFIG' in env: + mozconfig = env["MOZCONFIG"] + mozconfig = os.path.join(config.topsrcdir, mozconfig) + d['mozconfig'] = os.path.normpath(mozconfig) # os o = substs["OS_TARGET"] diff --git a/python/mozbuild/mozbuild/test/test_mozinfo.py b/python/mozbuild/mozbuild/test/test_mozinfo.py index 80a8baeeaf87..870f0b6c305f 100755 --- a/python/mozbuild/mozbuild/test/test_mozinfo.py +++ b/python/mozbuild/mozbuild/test/test_mozinfo.py @@ -19,8 +19,6 @@ from mozbuild.mozinfo import ( write_mozinfo, ) -from mozfile.mozfile import NamedTemporaryFile - class Base(object): def _config(self, substs={}): @@ -241,18 +239,15 @@ class TestWriteMozinfo(unittest.TestCase, Base): MOZ_WIDGET_TOOLKIT='windows', )) c.topsrcdir = '/tmp' - with NamedTemporaryFile(dir=c.topsrcdir) as mozconfig: - mozconfig.write('unused contents') - mozconfig.flush() - write_mozinfo(self.f, c, {'MOZCONFIG': mozconfig.name}) - with open(self.f) as f: - d = json.load(f) - self.assertEqual('win', d['os']) - self.assertEqual('x86', d['processor']) - self.assertEqual('windows', d['toolkit']) - self.assertEqual('/tmp', d['topsrcdir']) - self.assertEqual(os.path.normpath(mozconfig.name), d['mozconfig']) - self.assertEqual(32, d['bits']) + write_mozinfo(self.f, c, {'MOZCONFIG': 'foo'}) + with open(self.f) as f: + d = json.load(f) + self.assertEqual('win', d['os']) + self.assertEqual('x86', d['processor']) + self.assertEqual('windows', d['toolkit']) + self.assertEqual('/tmp', d['topsrcdir']) + self.assertEqual(os.path.normpath('/tmp/foo'), d['mozconfig']) + self.assertEqual(32, d['bits']) def test_fileobj(self): """