Bug 1170431 part 0 - Use the *Path classes for GENERATED_FILES scripts and inputs. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 02 Jun 2015 15:27:14 +0900
changeset 246860 17c2626eb9d81080171cd57df7a820aec0e154b4
parent 246859 36d7559859edbcda785bf293e07a33e90f972936
child 246861 780ec82ee92a86e8e3f5d9a81b5a7c0f94feab2a
push id28843
push usercbook@mozilla.com
push dateWed, 03 Jun 2015 11:50:02 +0000
treeherdermozilla-central@6c612d7adbf5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1170431
milestone41.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1170431 part 0 - Use the *Path classes for GENERATED_FILES scripts and inputs. r=gps
browser/themes/tab-svgs.mozbuild
dom/encoding/moz.build
python/mozbuild/mozbuild/frontend/emitter.py
python/mozbuild/mozbuild/test/frontend/data/generated-files-absolute-script/moz.build
security/apps/moz.build
security/manager/ssl/tests/unit/test_intermediate_basic_usage_constraints/moz.build
--- a/browser/themes/tab-svgs.mozbuild
+++ b/browser/themes/tab-svgs.mozbuild
@@ -1,16 +1,16 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-script = TOPSRCDIR + '/browser/themes/preprocess-tab-svgs.py'
-input = [TOPSRCDIR + '/browser/themes/shared/tab-selected.svg']
+script = '/browser/themes/preprocess-tab-svgs.py'
+input = ['/browser/themes/shared/tab-selected.svg']
 
 # Context variables can't be used inside functions, so hack around that.
 generated_files = GENERATED_FILES
 
 def generate_svg(svg_name, script_function):
     global generated_files
     generated_files += [svg_name]
     svg = generated_files[svg_name]
--- a/dom/encoding/moz.build
+++ b/dom/encoding/moz.build
@@ -20,17 +20,17 @@ UNIFIED_SOURCES += [
 
 FAIL_ON_WARNINGS = True
 
 FINAL_LIBRARY = 'xul'
 LOCAL_INCLUDES += [
     '/intl/locale',
 ]
 
-props2arrays = TOPSRCDIR + '/intl/locale/props2arrays.py'
+props2arrays = '/intl/locale/props2arrays.py'
 prefixes = (
     'domainsfallbacks',
     'encodingsgroups',
     'labelsencodings',
     'localesfallbacks',
     'nonparticipatingdomains',
 )
 
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -845,43 +845,46 @@ class TreeMetadataEmitter(LoggingMixin):
     def _process_generated_files(self, context):
         generated_files = context.get('GENERATED_FILES')
         if not generated_files:
             return
 
         for f in generated_files:
             flags = generated_files[f]
             output = f
+            inputs = []
             if flags.script:
                 method = "main"
+                script = SourcePath(context, flags.script).full_path
+
                 # Deal with cases like "C:\\path\\to\\script.py:function".
-                if not flags.script.endswith('.py') and ':' in flags.script:
-                    script, method = flags.script.rsplit(':', 1)
-                else:
-                    script = flags.script
-                script = mozpath.join(context.srcdir, script)
-                inputs = [mozpath.join(context.srcdir, i) for i in flags.inputs]
+                if '.py:' in script:
+                    script, method = script.rsplit('.py:', 1)
+                    script += '.py'
 
                 if not os.path.exists(script):
                     raise SandboxValidationError(
                         'Script for generating %s does not exist: %s'
                         % (f, script), context)
                 if os.path.splitext(script)[1] != '.py':
                     raise SandboxValidationError(
                         'Script for generating %s does not end in .py: %s'
                         % (f, script), context)
-                for i in inputs:
-                    if not os.path.exists(i):
+
+                for i in flags.inputs:
+                    p = Path(context, i)
+                    if (isinstance(p, SourcePath) and
+                            not os.path.exists(p.full_path)):
                         raise SandboxValidationError(
                             'Input for generating %s does not exist: %s'
-                            % (f, i), context)
+                            % (f, p.full_path), context)
+                    inputs.append(p.full_path)
             else:
                 script = None
                 method = None
-                inputs = []
             yield GeneratedFile(context, script, method, output, inputs)
 
     def _process_test_harness_files(self, context):
         test_harness_files = context.get('TEST_HARNESS_FILES')
         if not test_harness_files:
             return
 
         srcdir_files = defaultdict(list)
--- a/python/mozbuild/mozbuild/test/frontend/data/generated-files-absolute-script/moz.build
+++ b/python/mozbuild/mozbuild/test/frontend/data/generated-files-absolute-script/moz.build
@@ -1,9 +1,9 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # Any copyright is dedicated to the Public Domain.
 # http://creativecommons.org/publicdomain/zero/1.0/
 
 GENERATED_FILES += ['bar.c']
 
 bar = GENERATED_FILES['bar.c']
-bar.script = TOPSRCDIR + '/script.py:make_bar'
+bar.script = '/script.py:make_bar'
 bar.inputs = []
--- a/security/apps/moz.build
+++ b/security/apps/moz.build
@@ -18,17 +18,17 @@ LOCAL_INCLUDES += [
     '/security/manager/ssl',
     '/security/pkix/include',
 ]
 
 DEFINES['NSS_ENABLE_ECC'] = 'True'
 for var in ('DLL_PREFIX', 'DLL_SUFFIX'):
     DEFINES[var] = '"%s"' % CONFIG[var]
 
-test_ssl_path = TOPSRCDIR + '/security/manager/ssl/tests/unit'
+test_ssl_path = '/security/manager/ssl/tests/unit'
 
 headers_arrays_certs = [
     ('marketplace-prod-public.inc', 'marketplaceProdPublicRoot', 'marketplace-prod-public.crt'),
     ('marketplace-prod-reviewers.inc', 'marketplaceProdReviewersRoot', 'marketplace-prod-reviewers.crt'),
     ('marketplace-dev-public.inc', 'marketplaceDevPublicRoot', 'marketplace-dev-public.crt'),
     ('marketplace-dev-reviewers.inc', 'marketplaceDevReviewersRoot', 'marketplace-dev-reviewers.crt'),
     ('marketplace-stage.inc', 'marketplaceStageRoot', 'marketplace-stage.crt'),
     ('manifest-signing-root.inc', 'trustedAppPublicRoot', 'trusted-app-public.der'),
--- a/security/manager/ssl/tests/unit/test_intermediate_basic_usage_constraints/moz.build
+++ b/security/manager/ssl/tests/unit/test_intermediate_basic_usage_constraints/moz.build
@@ -30,10 +30,10 @@ test_certificates = (
     'int-valid-ku-server-eku.pem',
 )
 
 for test_certificate in test_certificates:
     input_file = test_certificate + '.certspec'
     GENERATED_FILES += [test_certificate]
     props = GENERATED_FILES[test_certificate]
     props.script = '../pycert.py'
-    props.inputs = [input_file, TOPOBJDIR + '/config']
+    props.inputs = [input_file, '!/config']
     TEST_HARNESS_FILES.xpcshell.security.manager.ssl.tests.unit.test_intermediate_basic_usage_constraints += ['!%s' % test_certificate]