Skip to content

Commit

Permalink
Bug 922437 - Allow py_actions to run as pymake native commands. r=gps
Browse files Browse the repository at this point in the history
  • Loading branch information
glandium committed Oct 1, 2013
1 parent afaa8bc commit 3089b4c
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 8 deletions.
4 changes: 4 additions & 0 deletions config/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -818,4 +818,8 @@ DEFINES += -DNO_NSPR_10_SUPPORT
#
# libs::
# $(call py_action,purge_manifests,_build_manifests/purge/foo.manifest)
ifdef .PYMAKE
py_action = %mozbuild.action.$(1) main $(2)
else
py_action = $(PYTHON) -m mozbuild.action.$(1) $(2)
endif
4 changes: 4 additions & 0 deletions js/src/config/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -818,4 +818,8 @@ DEFINES += -DNO_NSPR_10_SUPPORT
#
# libs::
# $(call py_action,purge_manifests,_build_manifests/purge/foo.manifest)
ifdef .PYMAKE
py_action = %mozbuild.action.$(1) main $(2)
else
py_action = $(PYTHON) -m mozbuild.action.$(1) $(2)
endif
8 changes: 6 additions & 2 deletions python/mozbuild/mozbuild/action/process_install_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from __future__ import print_function, unicode_literals

import argparse
import sys
from mozpack.copier import FileCopier
from mozpack.manifests import InstallManifest

Expand All @@ -23,7 +24,7 @@ def process_manifest(destdir, paths, remove_unaccounted=True):
return copier.copy(destdir, remove_unaccounted=remove_unaccounted)


if __name__ == '__main__':
def main(argv):
parser = argparse.ArgumentParser(
description='Process install manifest files.')

Expand All @@ -32,7 +33,7 @@ def process_manifest(destdir, paths, remove_unaccounted=True):
parser.add_argument('--no-remove', action='store_true',
help='Do not remove unaccounted files from destination.')

args = parser.parse_args()
args = parser.parse_args(argv)

result = process_manifest(args.destdir, args.manifests,
remove_unaccounted=not args.no_remove)
Expand All @@ -42,3 +43,6 @@ def process_manifest(destdir, paths, remove_unaccounted=True):
updated=result.updated_files_count,
rm_files=result.removed_files_count,
rm_dirs=result.removed_directories_count))

if __name__ == '__main__':
main(sys.argv[1:])
11 changes: 7 additions & 4 deletions python/mozbuild/mozbuild/action/xpccheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ def verifyIniFile(initests, directory):
print >>sys.stderr, "TEST-UNEXPECTED-FAIL | xpccheck | found %s in xpcshell.ini and not in directory '%s'" % (name, directory)
sys.exit(1)

if __name__ == '__main__':
if len(sys.argv) < 3:
def main(argv):
if len(argv) < 2:
print >>sys.stderr, "Usage: xpccheck.py <topsrcdir> <directory> [<directory> ...]"
sys.exit(1)

topsrcdir = sys.argv[1]
for d in sys.argv[2:]:
topsrcdir = argv[0]
for d in argv[1:]:
# xpcshell-unpack is a copy of xpcshell sibling directory and in the Makefile
# we copy all files (including xpcshell.ini from the sibling directory.
if d.endswith('toolkit/mozapps/extensions/test/xpcshell-unpack'):
Expand All @@ -76,3 +76,6 @@ def verifyIniFile(initests, directory):
initests = getIniTests(d)
verifyDirectory(initests, d)
verifyIniFile(initests, d)

if __name__ == '__main__':
main(sys.argv[1:])
7 changes: 5 additions & 2 deletions python/mozbuild/mozbuild/action/xpidl-process.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def process(input_dir, cache_dir, header_dir, xpt_dir, deps_dir, module, stems):
mk.dump(fh)


if __name__ == '__main__':
def main(argv):
parser = argparse.ArgumentParser()
parser.add_argument('--cache-dir',
help='Directory in which to find or write cached lexer data.')
Expand All @@ -82,6 +82,9 @@ def process(input_dir, cache_dir, header_dir, xpt_dir, deps_dir, module, stems):
parser.add_argument('idls', nargs='+',
help='Source .idl file(s). Specified as stems only.')

args = parser.parse_args()
args = parser.parse_args(argv)
process(args.inputdir, args.cache_dir, args.headerdir, args.xptdir,
args.depsdir, args.module, args.idls)

if __name__ == '__main__':
main(sys.argv[1:])

0 comments on commit 3089b4c

Please sign in to comment.