зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1215526 - part 2 - write dependencies to file_generate.py's depfile; r=glandium
This commit is contained in:
Родитель
8bd1afc6a9
Коммит
3a6f416c97
|
@ -15,6 +15,7 @@ import sys
|
|||
import traceback
|
||||
|
||||
from mozbuild.util import FileAvoidWrite
|
||||
from mozbuild.makeutil import Makefile
|
||||
|
||||
def main(argv):
|
||||
parser = argparse.ArgumentParser('Generate a file from a Python script',
|
||||
|
@ -56,6 +57,16 @@ def main(argv):
|
|||
try:
|
||||
with FileAvoidWrite(args.output_file) as output:
|
||||
ret = module.__dict__[method](output, *args.additional_arguments)
|
||||
# We treat sets as a statement of success. Everything else
|
||||
# is an error (so scripts can conveniently |return 1| or
|
||||
# similar).
|
||||
if isinstance(ret, set) and ret:
|
||||
mk = Makefile()
|
||||
mk.create_rule([args.output_file]).add_dependencies(ret)
|
||||
with FileAvoidWrite(args.dep_file) as dep_file:
|
||||
mk.dump(dep_file)
|
||||
# The script succeeded, so reset |ret| to indicate that.
|
||||
ret = None
|
||||
except IOError as e:
|
||||
print('Error opening file "{0}"'.format(e.filename), file=sys.stderr)
|
||||
traceback.print_exc()
|
||||
|
|
|
@ -907,6 +907,9 @@ VARIABLES = {
|
|||
GENERATED_FILES += ['bar.c']
|
||||
bar = GENERATED_FILES['bar.c']
|
||||
bar.script = 'generate.py:make_bar'
|
||||
|
||||
The chosen script entry point may optionally return a set of strings,
|
||||
indicating extra files the output depends on.
|
||||
""", 'export'),
|
||||
|
||||
'DEFINES': (OrderedDict, dict,
|
||||
|
|
Загрузка…
Ссылка в новой задаче