Bug 922437 - Allow py_actions to run as pymake native commands. r=gps

This commit is contained in:
Mike Hommey 2013-10-02 07:59:20 +09:00
parent 997153eebe
commit ef83d981fb
5 changed files with 26 additions and 8 deletions

View File

@ -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

View File

@ -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

View File

@ -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
@ -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.')
@ -32,7 +33,7 @@ if __name__ == '__main__':
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)
@ -42,3 +43,6 @@ if __name__ == '__main__':
updated=result.updated_files_count,
rm_files=result.removed_files_count,
rm_dirs=result.removed_directories_count))
if __name__ == '__main__':
main(sys.argv[1:])

View File

@ -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'):
@ -76,3 +76,6 @@ if __name__ == '__main__':
initests = getIniTests(d)
verifyDirectory(initests, d)
verifyIniFile(initests, d)
if __name__ == '__main__':
main(sys.argv[1:])

View File

@ -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.')
@ -82,6 +82,9 @@ if __name__ == '__main__':
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:])