Bug 1634737 - GeneratedFile() template should yell at you if you try to set py2=True r=glandium

As of bug 1621451 this argument was ignored, but it just silently runs your code with `python3` if you pass it anyway. Ensure this doesn't happen any more, and protect against any other unexpected arguments as well.

Differential Revision: https://phabricator.services.mozilla.com/D73485
This commit is contained in:
Ricky Stewart 2020-05-05 15:53:37 +00:00
parent 933b3522b8
commit 1395fb03f0
4 changed files with 9 additions and 8 deletions

View File

@ -68,7 +68,6 @@ else:
GeneratedFile(
'xpcAccEvents.h', 'xpcAccEvents.cpp',
script='AccEventGen.py', entry_point='gen_files',
py2=True,
inputs=[
'AccEvents.conf',
])

View File

@ -175,11 +175,14 @@ def GeneratedFile(name, *names, **kwargs):
You must pass in at least one generated file (the "name" argument). Other
names can be included as positional arguments after "name"."""
script = kwargs.get('script')
entry_point = kwargs.get('entry_point')
inputs = kwargs.get('inputs', [])
flags = kwargs.get('flags', [])
force = kwargs.get('force', False)
script = kwargs.pop('script', None)
entry_point = kwargs.pop('entry_point', None)
inputs = kwargs.pop('inputs', [])
flags = kwargs.pop('flags', [])
force = kwargs.pop('force', False)
if kwargs:
error('Unrecognized argument(s) to GeneratedFile: %s' %
', '.join(kwargs))
if entry_point and not script:
error('entry_point cannot be provided if script is not provided')
if script and ':' in script:

View File

@ -227,7 +227,6 @@ GeneratedFile('TelemetryProcessData.h',
GeneratedFile(
'glean_checks',
script='build_scripts/run_glean_parser.py',
py2=False,
inputs=['geckoview/streaming/metrics.yaml'])
# Add support for GeckoView: please note that building GeckoView

View File

@ -8,4 +8,4 @@ PYTHON_UNITTEST_MANIFESTS += [
'python.ini',
]
GeneratedFile('xpidl.stub', script='header.py', entry_point='main', py2=True)
GeneratedFile('xpidl.stub', script='header.py', entry_point='main')