diff options
Diffstat (limited to 'python/mozbuild')
-rw-r--r-- | python/mozbuild/mozbuild/action/dump_env.py | 8 | ||||
-rw-r--r-- | python/mozbuild/mozbuild/configure/constants.py | 3 | ||||
-rw-r--r-- | python/mozbuild/mozbuild/controller/clobber.py | 2 | ||||
-rw-r--r-- | python/mozbuild/mozbuild/mach_commands.py | 11 | ||||
-rwxr-xr-x | python/mozbuild/mozbuild/mozconfig_loader | 38 |
5 files changed, 38 insertions, 24 deletions
diff --git a/python/mozbuild/mozbuild/action/dump_env.py b/python/mozbuild/mozbuild/action/dump_env.py index a6fa19f3a..83e420d68 100644 --- a/python/mozbuild/mozbuild/action/dump_env.py +++ b/python/mozbuild/mozbuild/action/dump_env.py @@ -6,5 +6,11 @@ # native paths printed on Windows so that these paths can be incorporated # into Python configure's environment. import os +import sys + +sys.path.append(os.path.join(os.path.dirname(__file__), '..')) + +from shellutil import quote + for key, value in os.environ.items(): - print('%s=%s' % (key, value)) + print('%s=%s' % (key, quote(value))) diff --git a/python/mozbuild/mozbuild/configure/constants.py b/python/mozbuild/mozbuild/configure/constants.py index dfc7cf8ad..00d9ff9bb 100644 --- a/python/mozbuild/mozbuild/configure/constants.py +++ b/python/mozbuild/mozbuild/configure/constants.py @@ -23,6 +23,7 @@ OS = EnumString.subclass( 'iOS', 'NetBSD', 'OpenBSD', + 'SunOS', 'OSX', 'WINNT', ) @@ -35,6 +36,7 @@ Kernel = EnumString.subclass( 'Linux', 'NetBSD', 'OpenBSD', + 'SunOS', 'WINNT', ) @@ -97,6 +99,7 @@ kernel_preprocessor_checks = { 'Linux': '__linux__', 'NetBSD': '__NetBSD__', 'OpenBSD': '__OpenBSD__', + 'SunOS': '__sun__', 'WINNT': '_WIN32 || __CYGWIN__', } diff --git a/python/mozbuild/mozbuild/controller/clobber.py b/python/mozbuild/mozbuild/controller/clobber.py index 02f75c6ad..d3cdfd596 100644 --- a/python/mozbuild/mozbuild/controller/clobber.py +++ b/python/mozbuild/mozbuild/controller/clobber.py @@ -169,6 +169,7 @@ class Clobberer(object): if not self.clobber_needed(): print('Clobber not needed.', file=fh) + fh.flush() self.ensure_objdir_state() return False, False, None @@ -190,6 +191,7 @@ class Clobberer(object): 'Cannot clobber while the shell is inside the object directory.') print('Automatically clobbering %s' % self.topobjdir, file=fh) + fh.flush() try: self.remove_objdir(False) self.ensure_objdir_state() diff --git a/python/mozbuild/mozbuild/mach_commands.py b/python/mozbuild/mozbuild/mach_commands.py index 1bd5b8d34..c2e1a3e89 100644 --- a/python/mozbuild/mozbuild/mach_commands.py +++ b/python/mozbuild/mozbuild/mach_commands.py @@ -544,9 +544,14 @@ class Build(MachCommandBase): # Check if there are any unpreprocessed files in '@MOZ_OBJDIR@/dist/bin' # See python/mozbuild/mozbuild/preprocessor.py#L293-L309 for the list of directives # We skip if, ifdef, ifndef, else, elif, elifdef and elifndef, because they are never used alone - grepcmd = 'grep -E -r "^(#|%)(define|endif|error|expand|filter|include|literal|undef|unfilter)" '\ - + '--include=\*.{css,dtd,html,js,jsm,xhtml,xml,xul,manifest,properties,rdf} '\ - + self.topobjdir + '/dist/bin | grep -v ".css:#"' + # + # The original version of this script only worked with GNU grep because of the --include flag. + # Not a problem in and of itself, except that it didn't take TOOLCHAIN_PREFIX and simply assumed + # all operating systems use GNU grep as the system grep (often it's called ggrep or something). + # This script is a bit slower, but should do the same thing on all Unix platforms. + + grepcmd = 'find ' + self.topobjdir + '/dist/bin' + ' -name \'\*.{css,dtd,html,js,jsm,xhtml,xml,xul,manifest,properties,rdf}\' ' + '| xargs grep -E "^(#|%)(define|endif|error|expand|filter|include|literal|undef|unfilter)" '\ + + '| awk "/\.css:%/ || (!/\.css/ && /:#/)"' grepresult = subprocess.Popen(grepcmd, stdout=subprocess.PIPE, shell=True).communicate()[0] if grepresult: print('\nERROR: preprocessor was not applied to the following files:\n\n' + grepresult) diff --git a/python/mozbuild/mozbuild/mozconfig_loader b/python/mozbuild/mozbuild/mozconfig_loader index 6b1e05dce..6c3df47ac 100755 --- a/python/mozbuild/mozbuild/mozconfig_loader +++ b/python/mozbuild/mozbuild/mozconfig_loader @@ -10,49 +10,46 @@ set -e ac_add_options() { - local opt - for opt; do - case "$opt" in + for _mozconfig_opt; do + case "$_mozconfig_opt" in --target=*) echo "------BEGIN_MK_OPTION" - echo $opt | sed s/--target/CONFIG_GUESS/ + echo $_mozconfig_opt | sed s/--target/CONFIG_GUESS/ echo "------END_MK_OPTION" ;; esac echo "------BEGIN_AC_OPTION" - echo $opt + echo $_mozconfig_opt echo "------END_AC_OPTION" done } ac_add_app_options() { - local app - app=$1 + _mozconfig_app=$1 shift echo "------BEGIN_AC_APP_OPTION" - echo $app + echo $_mozconfig_app echo "$*" echo "------END_AC_APP_OPTION" } mk_add_options() { - local opt name op value - for opt; do + for _mozconfig_opt; do echo "------BEGIN_MK_OPTION" - echo $opt + echo $_mozconfig_opt # Remove any leading "export" - opt=${opt#export} - case "$opt" in - *\?=*) op="?=" ;; - *:=*) op=":=" ;; - *+=*) op="+=" ;; - *=*) op="=" ;; + opt=${_mozconfig_opt#export} + case "$_mozconfig_opt" in + *\?=*) _mozconfig_op="?=" ;; + *:=*) _mozconfig_op=":=" ;; + *+=*) _mozconfig_op="+=" ;; + *=*) _mozconfig_op="=" ;; esac # Remove the operator and the value that follows - name=${opt%%${op}*} - # Note: $(echo ${name}) strips the variable from any leading and trailing + _mozconfig_name=${_mozconfig_opt%%${_mozconfig_op}*} + # Note: $(echo ${_mozconfig_name}) strips the variable from any leading and trailing # whitespaces. - eval "$(echo ${name})_IS_SET=1" + eval "$(echo ${_mozconfig_name})_IS_SET=1" echo "------END_MK_OPTION" done } @@ -77,4 +74,5 @@ echo "------END_AFTER_SOURCE" echo "------BEGIN_ENV_AFTER_SOURCE" $3 $4 + echo "------END_ENV_AFTER_SOURCE" |