Skip to content

Commit

Permalink
Bug 1611326 - Default to py3_action, and add a py2 attribute to GENER…
Browse files Browse the repository at this point in the history
…ATED_FILES; r=firefox-build-system-reviewers,rstewart

GENERATED_FILES now defaults to python3 unless py2=True is specified as
an argument. All existing GENERATED_FILES scripts and GeneratedFile
templates have the py2=True attribute added, so this patch should
effectively be a no-op.

Going forward, individual scripts can be converted to python3 and their
corresponding py2=True attribute can be deleted. In effect, this patch
will be backed out in pieces until all scripts run in python3, at which
point the py2 attribute itself can be removed.

Differential Revision: https://phabricator.services.mozilla.com/D60919
  • Loading branch information
mshal committed Feb 13, 2020
1 parent 5f84fdc commit 391151d
Show file tree
Hide file tree
Showing 69 changed files with 143 additions and 22 deletions.
1 change: 1 addition & 0 deletions accessible/xpcom/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ else:
GeneratedFile(
'xpcAccEvents.h', 'xpcAccEvents.cpp',
script='AccEventGen.py', entry_point='gen_files',
py2=True,
inputs=[
'AccEvents.conf',
'!/xpcom/idl-parser/xpidl/xpidllex.py',
Expand Down
1 change: 1 addition & 0 deletions browser/app/winlauncher/freestanding/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ if CONFIG['COMPILE_ENVIRONMENT']:
'%sntdll_freestanding.%s' % (CONFIG['LIB_PREFIX'],
CONFIG['LIB_SUFFIX']),
script='gen_ntdll_freestanding_lib.py',
py2=True,
inputs=['ntdll_freestanding.def'],
flags=[CONFIG['LLVM_DLLTOOL']] + CONFIG['LLVM_DLLTOOL_FLAGS'])

Expand Down
2 changes: 2 additions & 0 deletions browser/locales/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ if CONFIG['MOZ_UPDATER']:
'en-US/updater/updater.ini',
'../installer/windows/nsis/updater_append.ini',
]
updater.py2 = True
# Yes, this is weird, but what can you do? This file doesn't want to be in the DIST_SUBDIR,
# but we can't really move it to a different directory until we change how locale repacks
# work.
Expand All @@ -34,6 +35,7 @@ bookmarks.inputs = [
# The `locales/en-US/` will be rewritten to the locale-specific path.
'en-US/profile/bookmarks.inc',
]
bookmarks.py2 = True

with Files("**"):
BUG_COMPONENT = ("Firefox Build System", "General")
Expand Down
1 change: 1 addition & 0 deletions build/clang-plugin/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ if CONFIG['ENABLE_MOZSEARCH_PLUGIN']:
]

GeneratedFile('ThirdPartyPaths.cpp', script="ThirdPartyPaths.py",
py2=True,
entry_point="generate", inputs=[
'/tools/rewriting/ThirdPartyPaths.txt',
'/tools/rewriting/Generated.txt',
Expand Down
3 changes: 3 additions & 0 deletions build/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ if CONFIG['MOZ_APP_BASENAME']:
script='../python/mozbuild/mozbuild/action/preprocessor.py',
entry_point='generate',
inputs=['application.ini.in'],
py2=True,
flags=['-D%s=%s' % (k, '1' if v is True else v)
for k, v in appini_defines.iteritems()])

Expand All @@ -95,10 +96,12 @@ if CONFIG['MOZ_APP_BASENAME']:
FINAL_TARGET_PP_FILES += ['update-settings.ini']

GeneratedFile('application.ini.h', script='appini_header.py',
py2=True,
inputs=['!application.ini'])

if CONFIG['ENABLE_TESTS']:
GeneratedFile('automation.py', script='gen_automation.py',
py2=True,
inputs=['automation.py.in'])

TEST_HARNESS_FILES.reftest += [
Expand Down
2 changes: 2 additions & 0 deletions build/templates.mozbuild
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ def GeneratedFile(name, *names, **kwargs):
inputs = kwargs.get('inputs', [])
flags = kwargs.get('flags', [])
force = kwargs.get('force', False)
py2 = kwargs.get('py2', False)
if entry_point and not script:
error('entry_point cannot be provided if script is not provided')
if script and ':' in script:
Expand All @@ -197,6 +198,7 @@ def GeneratedFile(name, *names, **kwargs):
generated_file.inputs = inputs
generated_file.flags = flags
generated_file.force = force
generated_file.py2 = py2

include('gecko_templates.mozbuild')
include('test_templates.mozbuild')
Expand Down
2 changes: 2 additions & 0 deletions build/test_templates.mozbuild
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ def GeneratedTestCertificate(name):
if not CONFIG['COMPILE_ENVIRONMENT']:
return
GeneratedFile(name, script='/security/manager/ssl/tests/unit/pycert.py',
py2=True,
inputs=['%s.certspec' % name])
# Turn RELATIVEDIR into list entry: like
# 'security/manager/ssl/tests/unit/bad_certs' ->
Expand All @@ -23,6 +24,7 @@ def GeneratedTestKey(name):
if not CONFIG['COMPILE_ENVIRONMENT']:
return
GeneratedFile(name, script='/security/manager/ssl/tests/unit/pykey.py',
py2=True,
inputs=['%s.keyspec' % name])
# Turn RELATIVEDIR into list entry: like
# 'security/manager/ssl/tests/unit/bad_certs' ->
Expand Down
1 change: 1 addition & 0 deletions build/unix/elfhack/inject/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ cpu = CONFIG['CPU_ARCH']

gen_src = '%s.c' % cpu
GeneratedFile(gen_src, script='copy_source.py', entry_point='copy',
py2=True,
inputs = ['../inject.c'])

SOURCES += [
Expand Down
4 changes: 4 additions & 0 deletions config/external/ffi/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ else:
]
GeneratedFile('../../../js/src/ctypes/libffi/include/ffi.h',
script='subst_header.py',
py2=True,
inputs=['../../../js/src/ctypes/libffi/include/ffi.h.in'])

LOCAL_INCLUDES += [
Expand Down Expand Up @@ -85,6 +86,7 @@ else:
'!../../../js/src/ctypes/libffi/include/ffi.h',
],
script='preprocess_libffi_asm.py',
py2=True,
flags=['$(DEFINES)', '$(LOCAL_INCLUDES)'])
SOURCES += ['!win64_aarch.asm']
elif CONFIG['FFI_TARGET'] == 'X86':
Expand All @@ -104,6 +106,7 @@ else:
'!../../../js/src/ctypes/libffi/fficonfig.h',
'!../../../js/src/ctypes/libffi/include/ffi.h',
], script='preprocess_libffi_asm.py',
py2=True,
flags=['$(DEFINES)', '$(LOCAL_INCLUDES)'])
SOURCES += ['!win32.asm']
ASFLAGS += ['-safeseh']
Expand All @@ -120,6 +123,7 @@ else:
'!../../../js/src/ctypes/libffi/fficonfig.h',
'!../../../js/src/ctypes/libffi/include/ffi.h',
], script='preprocess_libffi_asm.py',
py2=True,
flags=['$(DEFINES)', '$(LOCAL_INCLUDES)'])
SOURCES += ['!win64.asm']
elif CONFIG['FFI_TARGET'] == 'X86_DARWIN':
Expand Down
1 change: 1 addition & 0 deletions config/external/icu/data/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ LOCAL_INCLUDES += ['.']
if CONFIG['OS_TARGET'] == 'WINNT' and CONFIG['CPU_ARCH'] == 'aarch64':
icudata = 'icudata.asm'
GeneratedFile(icudata, script='genicudata.py',
py2=True,
inputs=[CONFIG['ICU_DATA_FILE']], flags=[data_symbol])
SOURCES += ['!%s' % icudata]
elif CONFIG['HAVE_YASM']:
Expand Down
3 changes: 3 additions & 0 deletions config/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ if CONFIG['WRAP_STL_INCLUDES']:
stl.script = 'make-stl-wrappers.py:gen_wrappers'
stl.flags = [output_dir, stl_compiler, template_file]
stl.flags.extend(stl_headers)
stl.py2 = True

# Wrap <windows.h> to make it easier to use correctly
# NOTE: If we aren't wrapping STL includes, we're building part of the browser
Expand All @@ -71,6 +72,7 @@ if CONFIG['WRAP_STL_INCLUDES']:
GeneratedFile('../dist/stl_wrappers/windows.h',
script='make-windows-h-wrapper.py',
entry_point='generate',
py2=True,
inputs = ['windows-h-constant.decls.h',
'windows-h-unicode.decls.h',
'windows-h-wrapper.template.h'],
Expand All @@ -86,3 +88,4 @@ if CONFIG['WRAP_SYSTEM_INCLUDES']:
system.flags = [output_dir]
system.flags.extend(stl_headers)
system.flags.extend(system_headers)
system.py2 = True
1 change: 1 addition & 0 deletions devtools/client/shared/build/node-templates.mozbuild
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def CompiledModules(*modules):
"node.stub", *[final + '/' + module for module in modules],
script='/python/mozbuild/mozbuild/action/node.py',
entry_point='generate',
py2=True,
inputs=['/devtools/client/shared/build/build.js'] +
[module for module in modules],
flags=[final])
1 change: 1 addition & 0 deletions devtools/shared/webconsole/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ for dir in RELATIVEDIR.split('/'):
base += ["!reserved-js-words.js"]

GeneratedFile('reserved-js-words.js', script='GenerateReservedWordsJS.py',
py2=True,
inputs = ['/js/src/frontend/ReservedWords.h'])

DevToolsModules(
Expand Down
2 changes: 2 additions & 0 deletions dom/base/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -546,9 +546,11 @@ if CONFIG['MOZ_X11']:
CXXFLAGS += CONFIG['TK_CFLAGS']

GeneratedFile('UseCounterList.h', script='gen-usecounters.py',
py2=True,
entry_point='use_counter_list', inputs=['UseCounters.conf'])

GeneratedFile('UseCounterWorkerList.h', script='gen-usecounters.py',
py2=True,
entry_point='use_counter_list', inputs=['UseCountersWorker.conf'])

if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
Expand Down
1 change: 1 addition & 0 deletions dom/bindings/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
if CONFIG['COMPILE_ENVIRONMENT']:
GeneratedFile('CSS2Properties.webidl',
script='GenerateCSS2PropertiesWebIDL.py',
py2=True,
entry_point='generate',
inputs=[
'/dom/webidl/CSS2Properties.webidl.in',
Expand Down
3 changes: 2 additions & 1 deletion dom/encoding/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ prefixes = (
for prefix in prefixes:
input_file = prefix + '.properties'
header = prefix + '.properties.h'
GeneratedFile(header, script=props2arrays, inputs=[input_file])
GeneratedFile(header, script=props2arrays, inputs=[input_file], py2=True)

input_file = 'nonparticipatingdomains.properties'
header = input_file + '.h'
GeneratedFile(header, script='../../intl/locale/props2arrays.py',
py2=True,
inputs=[input_file])

MOCHITEST_MANIFESTS += [
Expand Down
1 change: 1 addition & 0 deletions dom/webgpu/ffi/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ if CONFIG['COMPILE_ENVIRONMENT']:
GeneratedFile('wgpu_ffi_generated.h',
script='/layout/style/RunCbindgen.py',
entry_point='generate',
py2=True,
inputs=[
'/gfx/wgpu/wgpu-remote',
])
Expand Down
2 changes: 2 additions & 0 deletions gfx/layers/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -589,8 +589,10 @@ include('/ipc/chromium/chromium-config.mozbuild')

if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
GeneratedFile('CompositorD3D11Shaders.h', script='d3d11/genshaders.py',
py2=True,
inputs=['d3d11/shaders.manifest'])
GeneratedFile('MLGShaders.h', script='d3d11/genshaders.py',
py2=True,
inputs=['d3d11/mlgshaders/shaders.manifest'])

LOCAL_INCLUDES += [
Expand Down
1 change: 1 addition & 0 deletions gfx/webrender_bindings/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ if CONFIG['COMPILE_ENVIRONMENT']:

GeneratedFile('webrender_ffi_generated.h',
script='/layout/style/RunCbindgen.py', entry_point='generate',
py2=True,
inputs=[
'/gfx/webrender_bindings',
'/gfx/wr/webrender',
Expand Down
1 change: 1 addition & 0 deletions intl/hyphenation/glue/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ if CONFIG['COMPILE_ENVIRONMENT']:
generated.inputs = [
'/third_party/rust/mapped_hyph'
]
generated.py2 = True
4 changes: 3 additions & 1 deletion intl/locale/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ prefixes = (
for prefix in prefixes:
input_file = prefix + '.properties'
header = prefix + '.properties.h'
GeneratedFile(header, script='props2arrays.py', inputs=[input_file])
GeneratedFile(header, script='props2arrays.py', inputs=[input_file], py2=True)

if CONFIG['ENABLE_TESTS']:
DIRS += ['tests/gtest']
Expand All @@ -98,9 +98,11 @@ if CONFIG['COMPILE_ENVIRONMENT']:
ffi_generated.inputs = [
'/intl/locale/rust/unic-langid-ffi',
]
ffi_generated.py2 = True

ffi_generated = GENERATED_FILES['fluent_langneg_ffi_generated.h']
ffi_generated.script = '/layout/style/RunCbindgen.py:generate'
ffi_generated.inputs = [
'/intl/locale/rust/fluent-langneg-ffi',
]
ffi_generated.py2 = True
2 changes: 2 additions & 0 deletions js/src/build/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ if CONFIG['JS_SHARED_LIBRARY']:
# with those in libxul.
if CONFIG['OS_TARGET'] == 'Linux':
GeneratedFile('symverscript', script='/build/gen_symverscript.py',
py2=True,
inputs=['symverscript.in'],
flags=[CONFIG['JS_LIBRARY_NAME'].replace('-', '_')])
SYMBOLS_FILE = '!symverscript'
Expand Down Expand Up @@ -85,6 +86,7 @@ DIST_INSTALL = True
# running the script for no-op builds.
GeneratedFile(
'spidermonkey_checks', script='/config/run_spidermonkey_checks.py',
py2=True,
inputs=[
'!%sjs_static.%s' % (CONFIG['LIB_PREFIX'], CONFIG['LIB_SUFFIX']),
'/config/check_spidermonkey_style.py',
Expand Down
1 change: 1 addition & 0 deletions js/src/frontend/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ include('../js-cxxflags.mozbuild')

# Generate frontend/ReservedWordsGenerated.h from frontend/ReservedWords.h
GeneratedFile('ReservedWordsGenerated.h', script='GenerateReservedWords.py',
py2=True,
inputs=['ReservedWords.h'])


Expand Down
2 changes: 2 additions & 0 deletions js/src/gc/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ include('../js-cxxflags.mozbuild')

# Generate GC statistics phase data.
GeneratedFile('StatsPhasesGenerated.h',
py2=True,
script='GenerateStatsPhases.py', entry_point='generateHeader')
GeneratedFile('StatsPhasesGenerated.inc',
py2=True,
script='GenerateStatsPhases.py', entry_point='generateCpp')

UNIFIED_SOURCES += [
Expand Down
2 changes: 2 additions & 0 deletions js/src/jit/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,14 @@ elif CONFIG['JS_CODEGEN_MIPS32'] or CONFIG['JS_CODEGEN_MIPS64']:
# Generate jit/MOpcodes.h from jit/MIR.h
GeneratedFile('MOpcodes.h',
script='GenerateOpcodeFiles.py',
py2=True,
entry_point='generate_mir_header',
inputs=['MIR.h'])

# Generate jit/LOpcodes.h from jit/LIR.h, jit/shared/LIR-shared.h, and
# platform-specific LIR files.
GeneratedFile('LOpcodes.h',
script='GenerateOpcodeFiles.py',
py2=True,
entry_point='generate_lir_header',
inputs=lir_inputs)
1 change: 1 addition & 0 deletions js/src/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ selfhosted_inputs = [
# Prepare self-hosted JS code for embedding
GeneratedFile('selfhosted.out.h', 'selfhosted.js',
script='builtin/embedjs.py',
py2=True,
entry_point='generate_selfhosted',
inputs=selfhosted_inputs)

Expand Down
1 change: 1 addition & 0 deletions js/src/shell/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ OS_LIBS += CONFIG['EDITLINE_LIBS']
# Prepare module loader JS code for embedding
GeneratedFile('shellmoduleloader.out.h', 'shellmoduleloader.js',
script='../builtin/embedjs.py',
py2=True,
entry_point='generate_shellmoduleloader',
inputs=[
'../js.msg',
Expand Down
2 changes: 2 additions & 0 deletions layout/generic/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,11 @@ SOURCES += [

GeneratedFile('FrameIdList.h',
script='GenerateFrameLists.py',
py2=True,
entry_point='generate_frame_id_list_h')
GeneratedFile('FrameTypeList.h',
script='GenerateFrameLists.py',
py2=True,
entry_point='generate_frame_type_list_h')

include('/ipc/chromium/chromium-config.mozbuild')
Expand Down
8 changes: 8 additions & 0 deletions layout/style/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,17 @@ CONTENT_ACCESSIBLE_FILES += [


GeneratedFile('nsCSSPropertyID.h', script='GenerateCSSPropertyID.py',
py2=True,
entry_point='generate',
inputs=['nsCSSPropertyID.h.in', '!ServoCSSPropList.py'])
GeneratedFile('ServoCSSPropList.h',
script='GenerateServoCSSPropList.py',
py2=True,
entry_point='generate_header',
inputs=['!ServoCSSPropList.py'])
GeneratedFile('ServoCSSPropList.py',
script='GenerateServoCSSPropList.py', entry_point='generate_data',
py2=True,
inputs=['ServoCSSPropList.mako.py'])

if CONFIG['COMPILE_ENVIRONMENT']:
Expand All @@ -281,24 +284,29 @@ if CONFIG['COMPILE_ENVIRONMENT']:

GeneratedFile('CompositorAnimatableProperties.h',
script='GenerateCompositorAnimatableProperties.py',
py2=True,
entry_point='generate',
inputs=['!ServoCSSPropList.py'])
GeneratedFile(
'CountedUnknownProperties.h',
script='GenerateCountedUnknownProperties.py',
py2=True,
entry_point='generate',
inputs=[
'/servo/components/style/properties/counted_unknown_properties.py',
])
GeneratedFile('nsComputedDOMStyleGenerated.inc',
script='GenerateComputedDOMStyleGenerated.py',
py2=True,
entry_point='generate',
inputs=['!ServoCSSPropList.py'])
GeneratedFile('nsCSSPropsGenerated.inc',
script='GenerateCSSPropsGenerated.py',
py2=True,
entry_point='generate',
inputs=['!ServoCSSPropList.py'])
GeneratedFile('ServoStyleConsts.h', script='RunCbindgen.py',
py2=True,
entry_point='generate',
inputs = ['/servo/ports/geckolib', '/servo/components/style'])

Expand Down
1 change: 1 addition & 0 deletions layout/style/test/gtest/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ LOCAL_INCLUDES += [

GeneratedFile('ExampleStylesheet.h',
script='generate_example_stylesheet.py',
py2=True,
inputs=['example.css'])

FINAL_LIBRARY = 'xul-gtest'
Loading

0 comments on commit 391151d

Please sign in to comment.