summaryrefslogtreecommitdiffstats
path: root/python/mozbuild
diff options
context:
space:
mode:
Diffstat (limited to 'python/mozbuild')
-rw-r--r--python/mozbuild/mozbuild/mach_commands.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/python/mozbuild/mozbuild/mach_commands.py b/python/mozbuild/mozbuild/mach_commands.py
index a45656b37..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 | awk "/\.css:%/ || (!/\.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)