From 1ff59cb7a3371196038030a5e456979d210f784d Mon Sep 17 00:00:00 2001 From: Dorel Luca Date: Thu, 22 Oct 2020 03:51:06 +0300 Subject: [PATCH] Backed out changeset 7558c8821a07 (bug 1654103) for multiple failures. CLOSED TREE --- .ycm_extra_conf.py | 33 +- accessible/android/moz.build | 51 +- accessible/aom/moz.build | 32 +- accessible/atk/moz.build | 84 +- accessible/base/moz.build | 147 +- accessible/generic/moz.build | 84 +- accessible/html/moz.build | 58 +- accessible/interfaces/gecko/moz.build | 38 +- accessible/interfaces/ia2/moz.build | 162 +- accessible/interfaces/moz.build | 68 +- accessible/interfaces/msaa/moz.build | 54 +- accessible/ipc/extension/android/moz.build | 24 +- accessible/ipc/extension/mac/moz.build | 22 +- accessible/ipc/extension/moz.build | 12 +- accessible/ipc/extension/other/moz.build | 12 +- accessible/ipc/moz.build | 62 +- accessible/ipc/other/moz.build | 42 +- accessible/ipc/win/handler/moz.build | 124 +- accessible/ipc/win/moz.build | 70 +- accessible/ipc/win/typelib/moz.build | 11 +- accessible/mac/SelectorMapGen.py | 11 +- accessible/mac/moz.build | 94 +- accessible/moz.build | 59 +- accessible/other/moz.build | 22 +- accessible/tests/mochitest/moz.build | 58 +- accessible/windows/ia2/moz.build | 62 +- accessible/windows/moz.build | 4 +- accessible/windows/msaa/moz.build | 98 +- accessible/windows/sdn/moz.build | 22 +- accessible/windows/uia/moz.build | 18 +- accessible/xpcom/AccEventGen.py | 89 +- accessible/xpcom/moz.build | 85 +- accessible/xul/moz.build | 66 +- browser/actors/moz.build | 114 +- browser/app/macbuild/Contents/moz.build | 22 +- browser/app/macversion.py | 21 +- browser/app/moz.build | 110 +- browser/app/no-pie/moz.build | 16 +- .../gen_ntdll_freestanding_lib.py | 4 +- .../app/winlauncher/freestanding/moz.build | 44 +- browser/app/winlauncher/moz.build | 42 +- browser/app/winlauncher/test/moz.build | 14 +- browser/base/gen_aboutneterror_codes.py | 12 +- browser/base/moz.build | 126 +- browser/branding/aurora/content/moz.build | 2 +- browser/branding/aurora/locales/moz.build | 4 +- browser/branding/aurora/moz.build | 8 +- browser/branding/nightly/content/moz.build | 2 +- browser/branding/nightly/locales/moz.build | 4 +- browser/branding/nightly/moz.build | 8 +- browser/branding/official/content/moz.build | 2 +- browser/branding/official/locales/moz.build | 2 +- browser/branding/official/moz.build | 8 +- browser/branding/unofficial/content/moz.build | 2 +- browser/branding/unofficial/locales/moz.build | 4 +- browser/branding/unofficial/moz.build | 8 +- browser/components/about/moz.build | 18 +- browser/components/aboutconfig/moz.build | 4 +- browser/components/aboutlogins/moz.build | 18 +- browser/components/attribution/moz.build | 20 +- browser/components/build/moz.build | 14 +- .../components/contextualidentity/moz.build | 8 +- .../customizableui/content/moz.build | 2 +- browser/components/customizableui/moz.build | 22 +- browser/components/doh/moz.build | 16 +- browser/components/downloads/moz.build | 30 +- .../enterprisepolicies/helpers/moz.build | 6 +- .../components/enterprisepolicies/moz.build | 16 +- .../enterprisepolicies/schemas/moz.build | 2 +- .../enterprisepolicies/tests/moz.build | 18 +- browser/components/extensions/moz.build | 18 +- .../components/extensions/schemas/moz.build | 2 +- browser/components/fxmonitor/moz.build | 11 +- browser/components/installerprefs/moz.build | 10 +- browser/components/ion/moz.build | 12 +- browser/components/migration/moz.build | 60 +- .../tests/unit/insertIEHistory/moz.build | 8 +- browser/components/moz.build | 110 +- browser/components/newtab/moz.build | 28 +- browser/components/originattributes/moz.build | 10 +- browser/components/payments/moz.build | 26 +- browser/components/payments/server.py | 7 +- browser/components/places/moz.build | 14 +- browser/components/pocket/moz.build | 4 +- .../components/preferences/dialogs/moz.build | 8 +- browser/components/preferences/moz.build | 21 +- browser/components/privatebrowsing/moz.build | 8 +- browser/components/prompts/moz.build | 4 +- browser/components/protections/moz.build | 8 +- browser/components/protocolhandler/moz.build | 10 +- .../components/resistfingerprinting/moz.build | 8 +- browser/components/search/moz.build | 20 +- .../marionette/test_engines_on_restart.py | 9 +- browser/components/sessionstore/moz.build | 46 +- browser/components/shell/moz.build | 68 +- .../shell/test/mac_desktop_image.py | 63 +- browser/components/ssb/moz.build | 20 +- browser/components/syncedtabs/moz.build | 27 +- browser/components/touchbar/moz.build | 12 +- .../components/translation/content/moz.build | 2 +- browser/components/translation/moz.build | 28 +- browser/components/uitour/moz.build | 14 +- browser/components/urlbar/moz.build | 64 +- browser/extensions/doh-rollout/moz.build | 12 +- .../extensions/formautofill/locales/moz.build | 2 +- browser/extensions/formautofill/moz.build | 60 +- browser/extensions/moz.build | 8 +- .../report-site-issue/locales/moz.build | 2 +- .../extensions/report-site-issue/moz.build | 50 +- browser/extensions/screenshots/moz.build | 117 +- browser/extensions/webcompat/moz.build | 192 +- browser/fonts/moz.build | 8 +- browser/fxr/moz.build | 2 +- browser/installer/windows/moz.build | 14 +- browser/locales/filter.py | 42 +- browser/locales/generate_bookmarks.py | 18 +- browser/locales/generate_ini.py | 15 +- browser/locales/moz.build | 32 +- browser/modules/moz.build | 88 +- browser/moz.build | 60 +- browser/moz.configure | 20 +- browser/themes/addons/moz.build | 2 +- browser/themes/linux/moz.build | 5 +- browser/themes/moz.build | 26 +- browser/themes/osx/moz.build | 3 +- browser/themes/windows/moz.build | 5 +- browser/tools/mozscreenshots/moz.build | 16 +- .../mozscreenshots/extension/moz.build | 70 +- build/RunCbindgen.py | 48 +- build/appini_header.py | 69 +- build/build-clang/build-clang.py | 507 +- build/build-infer/build-infer.py | 126 +- build/buildconfig.py | 4 +- build/checksums.py | 87 +- build/clang-plugin/ThirdPartyPaths.py | 11 +- build/clang-plugin/ThreadAllows.py | 36 +- build/clang-plugin/import_mozilla_checks.py | 104 +- build/clang-plugin/moz.build | 162 +- build/clang-plugin/tests/moz.build | 125 +- build/compare-mozconfig/compare-mozconfigs.py | 114 +- build/gen_symverscript.py | 10 +- build/gen_test_packages_manifest.py | 122 +- build/mach_bootstrap.py | 362 +- build/midl.py | 37 +- build/mobile/remoteautomation.py | 190 +- build/moz.build | 136 +- build/moz.configure/android-ndk.configure | 356 +- build/moz.configure/android-sdk.configure | 106 +- build/moz.configure/arm.configure | 209 +- build/moz.configure/bindgen.configure | 298 +- build/moz.configure/checks.configure | 54 +- build/moz.configure/compile-checks.configure | 109 +- build/moz.configure/compilers-util.configure | 82 +- build/moz.configure/flags.configure | 65 +- build/moz.configure/headers.configure | 100 +- build/moz.configure/init.configure | 1146 +- build/moz.configure/java.configure | 63 +- build/moz.configure/keyfiles.configure | 48 +- build/moz.configure/lto-pgo.configure | 303 +- build/moz.configure/memory.configure | 78 +- build/moz.configure/node.configure | 42 +- build/moz.configure/nspr.configure | 97 +- build/moz.configure/nss.configure | 18 +- build/moz.configure/old.configure | 334 +- build/moz.configure/pkg.configure | 55 +- build/moz.configure/rust.configure | 375 +- build/moz.configure/toolchain.configure | 2108 ++- build/moz.configure/update-programs.configure | 73 +- build/moz.configure/util.configure | 206 +- build/moz.configure/warnings.configure | 155 +- build/moz.configure/windows.configure | 407 +- build/pgo/profileserver.py | 141 +- build/submit_telemetry_data.py | 58 +- build/unix/elfhack/inject/copy_source.py | 2 +- build/unix/elfhack/inject/moz.build | 24 +- build/unix/elfhack/moz.build | 29 +- build/unix/moz.build | 10 +- build/unix/rewrite_asan_dylib.py | 67 +- build/unix/stdc++compat/moz.build | 20 +- build/upload.py | 32 +- build/upload_generated_sources.py | 93 +- build/valgrind/mach_commands.py | 203 +- build/valgrind/output_handler.py | 53 +- build/variables.py | 60 +- build/win32/autowinchecksec.py | 53 +- build/win32/crashinjectdll/moz.build | 6 +- build/win32/moz.build | 44 +- build/windows_toolchain.py | 183 +- caps/moz.build | 83 +- caps/tests/gtest/moz.build | 10 +- chrome/moz.build | 38 +- chrome/test/moz.build | 4 +- client.py | 119 +- config/MozZipFile.py | 42 +- config/check_js_msg_encoding.py | 21 +- config/check_js_opcode.py | 10 +- config/check_source_count.py | 35 +- config/check_spidermonkey_style.py | 472 +- config/check_vanilla_allocations.py | 81 +- config/create_rc.py | 113 +- config/create_res.py | 48 +- config/createprecomplete.py | 32 +- config/external/fdlibm/moz.build | 6 +- config/external/ffi/moz.build | 189 +- config/external/ffi/preprocess_libffi_asm.py | 4 +- config/external/ffi/subst_header.py | 20 +- config/external/freetype2/moz.build | 8 +- config/external/icu/common/moz.build | 32 +- config/external/icu/data/convert_icudata.py | 14 +- config/external/icu/data/moz.build | 38 +- config/external/icu/i18n/moz.build | 18 +- config/external/icu/icupkg/moz.build | 20 +- config/external/icu/moz.build | 20 +- config/external/icu/toolutil/moz.build | 14 +- config/external/lgpllibs/moz.build | 4 +- config/external/moz.build | 84 +- config/external/nspr/ds/moz.build | 26 +- config/external/nspr/libc/moz.build | 48 +- config/external/nspr/moz.build | 24 +- config/external/nspr/pr/moz.build | 407 +- config/external/rlbox/moz.build | 36 +- config/external/rlbox_lucet_sandbox/moz.build | 10 +- config/external/sqlite/moz.build | 14 +- config/external/zlib/moz.build | 10 +- config/make-stl-wrappers.py | 2 +- config/make-system-wrappers.py | 12 +- config/make-windows-h-wrapper.py | 41 +- config/moz.build | 104 +- config/mozunit/mozunit/mozunit.py | 121 +- config/mozunit/setup.py | 24 +- config/nsinstall.py | 75 +- config/printprereleasesuffix.py | 16 +- config/rebuild_check.py | 20 +- config/run-and-prefix.py | 23 +- config/run_spidermonkey_checks.py | 3 +- config/tests/src-simple/moz.build | 2 +- config/tests/test_mozbuild_reading.py | 35 +- config/tests/unit-mozunit.py | 75 +- config/tests/unit-nsinstall.py | 58 +- config/tests/unit-printprereleasesuffix.py | 54 +- config/tests/unitMozZipFile.py | 83 +- configure.py | 129 +- devtools/client/aboutdebugging/moz.build | 18 +- .../aboutdebugging/src/actions/moz.build | 10 +- .../src/components/connect/moz.build | 10 +- .../src/components/debugtarget/moz.build | 32 +- .../aboutdebugging/src/components/moz.build | 24 +- .../src/components/shared/moz.build | 6 +- .../src/components/sidebar/moz.build | 10 +- .../aboutdebugging/src/middleware/moz.build | 14 +- .../aboutdebugging/src/modules/moz.build | 20 +- devtools/client/aboutdebugging/src/moz.build | 16 +- .../aboutdebugging/src/reducers/moz.build | 8 +- .../client/aboutdebugging/src/types/moz.build | 10 +- .../client/accessibility/actions/moz.build | 8 +- .../client/accessibility/components/moz.build | 52 +- devtools/client/accessibility/moz.build | 27 +- .../client/accessibility/reducers/moz.build | 7 +- devtools/client/accessibility/utils/moz.build | 5 +- devtools/client/application/moz.build | 15 +- .../client/application/src/actions/moz.build | 10 +- .../src/components/manifest/moz.build | 24 +- .../application/src/components/moz.build | 10 +- .../src/components/routing/moz.build | 6 +- .../src/components/service-workers/moz.build | 10 +- .../application/src/components/ui/moz.build | 2 +- .../application/src/middleware/moz.build | 2 +- .../client/application/src/modules/moz.build | 4 +- devtools/client/application/src/moz.build | 16 +- .../client/application/src/reducers/moz.build | 10 +- .../client/application/src/types/moz.build | 8 +- devtools/client/debugger/dist/moz.build | 8 +- devtools/client/debugger/moz.build | 15 +- .../client/debugger/src/actions/ast/moz.build | 8 +- .../src/actions/breakpoints/moz.build | 14 +- .../client/debugger/src/actions/moz.build | 40 +- .../debugger/src/actions/pause/moz.build | 40 +- .../debugger/src/actions/sources/moz.build | 20 +- .../src/actions/utils/middleware/moz.build | 18 +- .../debugger/src/actions/utils/moz.build | 4 +- .../debugger/src/client/firefox/moz.build | 10 +- devtools/client/debugger/src/client/moz.build | 6 +- .../src/components/Editor/Preview/moz.build | 10 +- .../src/components/Editor/menus/moz.build | 10 +- .../debugger/src/components/Editor/moz.build | 46 +- .../src/components/PrimaryPanes/moz.build | 14 +- .../SecondaryPanes/Breakpoints/moz.build | 16 +- .../SecondaryPanes/Frames/moz.build | 14 +- .../src/components/SecondaryPanes/moz.build | 24 +- .../client/debugger/src/components/moz.build | 20 +- .../src/components/shared/Button/moz.build | 11 +- .../components/shared/Button/styles/moz.build | 8 +- .../debugger/src/components/shared/moz.build | 28 +- .../debugger/src/context-menu/moz.build | 2 +- devtools/client/debugger/src/moz.build | 22 +- .../client/debugger/src/reducers/moz.build | 42 +- .../client/debugger/src/selectors/moz.build | 26 +- .../debugger/src/utils/breakpoint/moz.build | 10 +- .../debugger/src/utils/editor/moz.build | 20 +- devtools/client/debugger/src/utils/moz.build | 92 +- .../debugger/src/utils/pause/frames/moz.build | 16 +- .../src/utils/pause/mapScopes/moz.build | 24 +- .../client/debugger/src/utils/pause/moz.build | 10 +- .../debugger/src/utils/pause/scopes/moz.build | 12 +- .../debugger/src/utils/resource/moz.build | 19 +- .../debugger/src/utils/sources-tree/moz.build | 24 +- .../client/debugger/src/workers/moz.build | 10 +- .../debugger/src/workers/parser/moz.build | 6 +- .../src/workers/pretty-print/moz.build | 6 +- .../debugger/src/workers/search/moz.build | 6 +- devtools/client/dom/content/actions/moz.build | 4 +- .../client/dom/content/components/moz.build | 6 +- devtools/client/dom/content/moz.build | 16 +- .../client/dom/content/reducers/moz.build | 6 +- devtools/client/dom/moz.build | 10 +- devtools/client/framework/actions/moz.build | 10 +- .../framework/browser-toolbox/moz.build | 4 +- .../client/framework/components/moz.build | 14 +- devtools/client/framework/moz.build | 68 +- devtools/client/framework/reducers/moz.build | 10 +- devtools/client/fronts/addon/moz.build | 4 +- devtools/client/fronts/descriptors/moz.build | 9 +- devtools/client/fronts/inspector/moz.build | 3 +- devtools/client/fronts/moz.build | 88 +- devtools/client/fronts/targets/moz.build | 6 +- devtools/client/fronts/worker/moz.build | 6 +- .../inspector/animation/actions/moz.build | 4 +- .../animation/components/graph/moz.build | 22 +- .../components/keyframes-graph/moz.build | 16 +- .../inspector/animation/components/moz.build | 51 +- devtools/client/inspector/animation/moz.build | 18 +- .../inspector/animation/reducers/moz.build | 2 +- .../inspector/animation/utils/moz.build | 8 +- .../inspector/boxmodel/actions/moz.build | 4 +- .../inspector/boxmodel/components/moz.build | 12 +- devtools/client/inspector/boxmodel/moz.build | 14 +- .../inspector/boxmodel/reducers/moz.build | 2 +- .../client/inspector/boxmodel/utils/moz.build | 2 +- .../inspector/changes/actions/moz.build | 4 +- .../inspector/changes/components/moz.build | 4 +- devtools/client/inspector/changes/moz.build | 22 +- .../inspector/changes/reducers/moz.build | 2 +- .../inspector/changes/selectors/moz.build | 2 +- .../client/inspector/changes/utils/moz.build | 4 +- .../inspector/compatibility/actions/moz.build | 4 +- .../client/inspector/compatibility/moz.build | 20 +- .../compatibility/reducers/moz.build | 2 +- .../inspector/compatibility/utils/moz.build | 2 +- .../client/inspector/components/moz.build | 2 +- devtools/client/inspector/computed/moz.build | 8 +- .../inspector/extensions/actions/moz.build | 4 +- .../inspector/extensions/components/moz.build | 8 +- .../client/inspector/extensions/moz.build | 12 +- .../inspector/extensions/reducers/moz.build | 2 +- .../inspector/flexbox/actions/moz.build | 4 +- .../inspector/flexbox/components/moz.build | 16 +- devtools/client/inspector/flexbox/moz.build | 12 +- .../inspector/flexbox/reducers/moz.build | 4 +- .../client/inspector/fonts/actions/moz.build | 8 +- .../inspector/fonts/components/moz.build | 32 +- devtools/client/inspector/fonts/moz.build | 18 +- .../client/inspector/fonts/reducers/moz.build | 6 +- .../client/inspector/fonts/utils/moz.build | 4 +- .../client/inspector/grids/actions/moz.build | 6 +- .../inspector/grids/components/moz.build | 10 +- devtools/client/inspector/grids/moz.build | 16 +- .../client/inspector/grids/reducers/moz.build | 4 +- .../client/inspector/grids/utils/moz.build | 2 +- .../inspector/layout/components/moz.build | 2 +- devtools/client/inspector/layout/moz.build | 10 +- .../client/inspector/layout/utils/moz.build | 2 +- .../inspector/markup/components/moz.build | 2 +- devtools/client/inspector/markup/moz.build | 14 +- .../client/inspector/markup/utils/moz.build | 2 +- .../client/inspector/markup/views/moz.build | 22 +- devtools/client/inspector/moz.build | 48 +- .../client/inspector/rules/actions/moz.build | 8 +- .../inspector/rules/components/moz.build | 24 +- .../client/inspector/rules/models/moz.build | 10 +- devtools/client/inspector/rules/moz.build | 28 +- .../client/inspector/rules/reducers/moz.build | 6 +- .../client/inspector/rules/utils/moz.build | 4 +- .../client/inspector/rules/views/moz.build | 6 +- devtools/client/inspector/shared/moz.build | 20 +- devtools/client/jsonview/components/moz.build | 24 +- .../client/jsonview/components/reps/moz.build | 2 +- devtools/client/jsonview/css/moz.build | 14 +- devtools/client/jsonview/lib/moz.build | 4 +- devtools/client/jsonview/moz.build | 24 +- devtools/client/locales/moz.build | 2 +- devtools/client/memory/actions/moz.build | 26 +- devtools/client/memory/components/moz.build | 30 +- .../memory/components/tree-map/moz.build | 10 +- devtools/client/memory/moz.build | 34 +- devtools/client/memory/reducers/moz.build | 24 +- devtools/client/moz.build | 62 +- devtools/client/netmonitor/moz.build | 19 +- .../client/netmonitor/src/actions/moz.build | 22 +- .../src/components/messages/moz.build | 46 +- .../src/components/messages/parsers/moz.build | 10 +- .../messages/parsers/signalr/moz.build | 12 +- .../messages/parsers/socket-io/moz.build | 8 +- .../messages/parsers/sockjs/moz.build | 2 +- .../messages/parsers/stomp/moz.build | 8 +- .../messages/parsers/wamp/moz.build | 4 +- .../netmonitor/src/components/moz.build | 36 +- .../src/components/previews/moz.build | 5 +- .../src/components/request-blocking/moz.build | 2 +- .../src/components/request-details/moz.build | 21 +- .../src/components/request-list/moz.build | 44 +- .../src/components/search/moz.build | 8 +- .../client/netmonitor/src/connector/moz.build | 6 +- devtools/client/netmonitor/src/har/moz.build | 22 +- .../netmonitor/src/middleware/moz.build | 12 +- devtools/client/netmonitor/src/moz.build | 28 +- .../client/netmonitor/src/reducers/moz.build | 20 +- .../client/netmonitor/src/selectors/moz.build | 12 +- .../netmonitor/src/utils/firefox/moz.build | 2 +- .../client/netmonitor/src/utils/moz.build | 32 +- .../client/netmonitor/src/widgets/moz.build | 12 +- .../client/netmonitor/src/workers/moz.build | 4 +- .../netmonitor/src/workers/search/moz.build | 6 +- .../performance-new/aboutprofiling/moz.build | 4 +- .../performance-new/components/moz.build | 20 +- devtools/client/performance-new/moz.build | 30 +- .../client/performance-new/popup/moz.build | 10 +- .../client/performance-new/store/moz.build | 6 +- .../client/performance/components/moz.build | 22 +- .../performance/modules/logic/moz.build | 10 +- devtools/client/performance/modules/moz.build | 24 +- .../performance/modules/widgets/moz.build | 8 +- devtools/client/performance/moz.build | 26 +- .../client/performance/test/helpers/moz.build | 24 +- devtools/client/performance/test/moz.build | 2 +- devtools/client/performance/views/moz.build | 20 +- devtools/client/preferences/moz.build | 2 +- devtools/client/responsive/actions/moz.build | 10 +- .../client/responsive/components/moz.build | 24 +- devtools/client/responsive/moz.build | 30 +- devtools/client/responsive/reducers/moz.build | 8 +- devtools/client/responsive/utils/moz.build | 16 +- .../client/shared/components/menu/moz.build | 8 +- devtools/client/shared/components/moz.build | 46 +- .../client/shared/components/reps/moz.build | 8 +- .../object-inspector/components/moz.build | 4 +- .../reps/object-inspector/moz.build | 10 +- .../reps/object-inspector/utils/moz.build | 10 +- .../shared/components/reps/reps/moz.build | 72 +- .../shared/components/reps/shared/moz.build | 4 +- .../shared/components/splitter/moz.build | 6 +- .../client/shared/components/tabs/moz.build | 4 +- .../shared/components/throttling/moz.build | 10 +- .../client/shared/components/tree/moz.build | 12 +- devtools/client/shared/fluent-l10n/moz.build | 2 +- devtools/client/shared/moz.build | 104 +- .../client/shared/redux/middleware/moz.build | 20 +- devtools/client/shared/redux/moz.build | 10 +- .../remote-debugging/adb/commands/moz.build | 12 +- .../shared/remote-debugging/adb/moz.build | 26 +- .../remote-debugging/adb/xpcshell/adb.py | 25 +- .../client/shared/remote-debugging/moz.build | 16 +- devtools/client/shared/sourceeditor/moz.build | 16 +- devtools/client/shared/widgets/moz.build | 32 +- .../client/shared/widgets/tooltip/moz.build | 26 +- devtools/client/storage/moz.build | 14 +- devtools/client/storage/utils/moz.build | 4 +- devtools/client/styleeditor/moz.build | 16 +- devtools/client/themes/audio/moz.build | 2 +- devtools/client/themes/moz.build | 2 +- devtools/client/webconsole/actions/moz.build | 20 +- .../webconsole/components/FilterBar/moz.build | 10 +- .../webconsole/components/Input/moz.build | 12 +- .../components/Output/message-types/moz.build | 16 +- .../webconsole/components/Output/moz.build | 22 +- .../client/webconsole/components/moz.build | 10 +- .../client/webconsole/enhancers/moz.build | 10 +- .../client/webconsole/middleware/moz.build | 6 +- devtools/client/webconsole/moz.build | 58 +- devtools/client/webconsole/reducers/moz.build | 16 +- .../client/webconsole/selectors/moz.build | 14 +- devtools/client/webconsole/utils/moz.build | 14 +- devtools/moz.build | 54 +- devtools/platform/moz.build | 12 +- .../actors/accessibility/audit/moz.build | 10 +- .../server/actors/accessibility/moz.build | 20 +- devtools/server/actors/addon/moz.build | 4 +- .../server/actors/compatibility/lib/moz.build | 4 +- .../server/actors/compatibility/moz.build | 8 +- devtools/server/actors/descriptors/moz.build | 9 +- devtools/server/actors/emulation/moz.build | 6 +- devtools/server/actors/highlighters/moz.build | 30 +- .../actors/highlighters/utils/moz.build | 6 +- devtools/server/actors/inspector/moz.build | 24 +- devtools/server/actors/moz.build | 140 +- .../server/actors/network-monitor/moz.build | 22 +- .../actors/network-monitor/utils/moz.build | 6 +- devtools/server/actors/object/moz.build | 12 +- devtools/server/actors/resources/moz.build | 26 +- .../server/actors/resources/utils/moz.build | 6 +- devtools/server/actors/targets/moz.build | 18 +- devtools/server/actors/utils/moz.build | 36 +- devtools/server/actors/watcher/moz.build | 5 +- .../actors/watcher/target-helpers/moz.build | 3 +- .../actors/webconsole/listeners/moz.build | 12 +- devtools/server/actors/webconsole/moz.build | 20 +- devtools/server/actors/worker/moz.build | 12 +- .../connectors/js-window-actor/moz.build | 6 +- devtools/server/connectors/moz.build | 8 +- devtools/server/moz.build | 28 +- devtools/server/performance/moz.build | 14 +- devtools/server/socket/moz.build | 4 +- devtools/server/startup/moz.build | 8 +- .../shared/compatibility/dataset/moz.build | 4 +- devtools/shared/compatibility/moz.build | 6 +- .../shared/css/generated/mach_commands.py | 74 +- devtools/shared/css/generated/moz.build | 2 +- devtools/shared/css/moz.build | 14 +- devtools/shared/discovery/moz.build | 4 +- devtools/shared/heapsnapshot/moz.build | 74 +- .../shared/heapsnapshot/tests/gtest/moz.build | 36 +- devtools/shared/inspector/moz.build | 5 +- devtools/shared/layout/moz.build | 5 +- devtools/shared/locales/moz.build | 2 +- devtools/shared/moz.build | 128 +- devtools/shared/performance-new/moz.build | 8 +- devtools/shared/performance/moz.build | 6 +- devtools/shared/platform/moz.build | 6 +- devtools/shared/protocol/Actor/moz.build | 2 +- devtools/shared/protocol/Front/moz.build | 2 +- devtools/shared/protocol/moz.build | 22 +- devtools/shared/qrcode/moz.build | 16 +- .../resources/legacy-listeners/moz.build | 36 +- .../legacy-target-watchers/moz.build | 8 +- devtools/shared/resources/moz.build | 14 +- .../shared/resources/transformers/moz.build | 8 +- devtools/shared/screenshot/moz.build | 4 +- devtools/shared/security/moz.build | 12 +- devtools/shared/specs/addon/moz.build | 4 +- devtools/shared/specs/descriptors/moz.build | 9 +- devtools/shared/specs/moz.build | 100 +- devtools/shared/specs/targets/moz.build | 14 +- devtools/shared/specs/worker/moz.build | 6 +- devtools/shared/storage/moz.build | 8 +- devtools/shared/transport/moz.build | 18 +- .../webconsole/GeneratePureDOMFunctions.py | 75 +- .../webconsole/GenerateReservedWordsJS.py | 19 +- devtools/shared/webconsole/moz.build | 25 +- devtools/shared/worker/moz.build | 10 +- devtools/startup/aboutdevtools/moz.build | 6 +- devtools/startup/locales/moz.build | 2 +- devtools/startup/moz.build | 22 +- docs/conf.py | 6 +- docshell/base/moz.build | 186 +- docshell/base/timeline/moz.build | 64 +- docshell/build/moz.build | 12 +- docshell/moz.build | 62 +- docshell/resources/content/moz.build | 2 +- docshell/shistory/moz.build | 42 +- docshell/test/moz.build | 180 +- dom/abort/moz.build | 14 +- dom/abort/tests/moz.build | 4 +- dom/animation/moz.build | 98 +- dom/audiochannel/moz.build | 18 +- dom/base/gen-usecounters.py | 59 +- dom/base/moz.build | 970 +- dom/base/test/gtest/moz.build | 18 +- dom/base/test/jsmodules/moz.build | 4 +- dom/base/test/moz.build | 34 +- dom/base/test/useractivation/moz.build | 2 +- dom/base/usecounters.py | 79 +- dom/battery/moz.build | 12 +- dom/bindings/Codegen.py | 11722 ++++++---------- dom/bindings/Configuration.py | 437 +- dom/bindings/GenerateCSS2PropertiesWebIDL.py | 35 +- dom/bindings/mach_commands.py | 27 +- dom/bindings/moz.build | 218 +- dom/bindings/mozwebidlcodegen/__init__.py | 263 +- .../test/test_mozwebidlcodegen.py | 125 +- dom/bindings/parser/WebIDL.py | 5118 +++---- dom/bindings/parser/runtests.py | 47 +- dom/bindings/parser/tests/test_any_null.py | 6 +- .../test_argument_identifier_conflicts.py | 6 +- .../parser/tests/test_argument_keywords.py | 27 +- .../parser/tests/test_argument_novoid.py | 6 +- dom/bindings/parser/tests/test_arraybuffer.py | 48 +- dom/bindings/parser/tests/test_attr.py | 114 +- .../parser/tests/test_attr_sequence_type.py | 42 +- .../parser/tests/test_attributes_on_types.py | 315 +- .../parser/tests/test_builtin_filename.py | 9 +- dom/bindings/parser/tests/test_builtins.py | 33 +- dom/bindings/parser/tests/test_bytestring.py | 84 +- dom/bindings/parser/tests/test_callback.py | 21 +- .../parser/tests/test_callback_constructor.py | 49 +- .../parser/tests/test_callback_interface.py | 34 +- dom/bindings/parser/tests/test_cereactions.py | 80 +- .../test_conditional_dictionary_member.py | 84 +- dom/bindings/parser/tests/test_const.py | 35 +- dom/bindings/parser/tests/test_constructor.py | 467 +- .../parser/tests/test_constructor_global.py | 25 +- .../test_constructor_no_interface_object.py | 18 +- dom/bindings/parser/tests/test_deduplicate.py | 13 +- dom/bindings/parser/tests/test_dictionary.py | 457 +- .../parser/tests/test_distinguishability.py | 284 +- dom/bindings/parser/tests/test_double_null.py | 6 +- .../parser/tests/test_duplicate_qualifiers.py | 24 +- dom/bindings/parser/tests/test_empty_enum.py | 7 +- .../test_empty_sequence_default_value.py | 47 +- dom/bindings/parser/tests/test_enum.py | 52 +- .../tests/test_enum_duplicate_values.py | 7 +- dom/bindings/parser/tests/test_error_colno.py | 16 +- .../parser/tests/test_error_lineno.py | 24 +- .../tests/test_exposed_extended_attribute.py | 212 +- .../parser/tests/test_extended_attributes.py | 76 +- dom/bindings/parser/tests/test_float_types.py | 60 +- .../parser/tests/test_forward_decl.py | 7 +- .../parser/tests/test_global_extended_attr.py | 85 +- .../parser/tests/test_identifier_conflict.py | 36 +- .../parser/tests/test_incomplete_parent.py | 7 +- .../parser/tests/test_incomplete_types.py | 61 +- dom/bindings/parser/tests/test_interface.py | 339 +- ...st_interface_const_identifier_conflicts.py | 6 +- ...ace_identifier_conflicts_across_members.py | 24 +- .../test_interface_maplikesetlikeiterable.py | 566 +- .../parser/tests/test_interfacemixin.py | 361 +- .../parser/tests/test_lenientSetter.py | 48 +- dom/bindings/parser/tests/test_method.py | 340 +- dom/bindings/parser/tests/test_namespace.py | 59 +- dom/bindings/parser/tests/test_newobject.py | 16 +- .../parser/tests/test_nullable_equivalency.py | 54 +- .../parser/tests/test_nullable_void.py | 6 +- .../parser/tests/test_optional_constraints.py | 23 +- dom/bindings/parser/tests/test_overload.py | 46 +- dom/bindings/parser/tests/test_promise.py | 132 +- .../parser/tests/test_prototype_ident.py | 69 +- dom/bindings/parser/tests/test_putForwards.py | 46 +- dom/bindings/parser/tests/test_record.py | 38 +- dom/bindings/parser/tests/test_replaceable.py | 48 +- .../test_securecontext_extended_attribute.py | 440 +- .../test_special_method_signature_mismatch.py | 96 +- .../parser/tests/test_special_methods.py | 96 +- .../tests/test_special_methods_uniqueness.py | 19 +- dom/bindings/parser/tests/test_stringifier.py | 115 +- dom/bindings/parser/tests/test_toJSON.py | 312 +- .../tests/test_treatNonCallableAsNull.py | 25 +- dom/bindings/parser/tests/test_typedef.py | 54 +- .../tests/test_typedef_identifier_conflict.py | 9 +- .../tests/test_unenumerable_own_properties.py | 23 +- dom/bindings/parser/tests/test_unforgeable.py | 219 +- dom/bindings/parser/tests/test_union.py | 102 +- dom/bindings/parser/tests/test_union_any.py | 6 +- .../parser/tests/test_union_nullable.py | 35 +- dom/bindings/parser/tests/test_usvstring.py | 30 +- .../parser/tests/test_variadic_callback.py | 7 +- .../parser/tests/test_variadic_constraints.py | 47 +- dom/bindings/test/moz.build | 64 +- dom/broadcastchannel/moz.build | 20 +- dom/browser-element/moz.build | 22 +- dom/cache/moz.build | 144 +- dom/canvas/moz.build | 332 +- .../generate-wrappers-and-manifest.py | 262 +- dom/canvas/test/webgl-conf/import.py | 24 +- .../test/webgl-mochitest/mochi-to-testcase.py | 38 +- dom/chrome-webidl/moz.build | 94 +- dom/clients/api/moz.build | 21 +- dom/clients/manager/moz.build | 103 +- dom/clients/moz.build | 4 +- dom/commandhandler/moz.build | 32 +- dom/console/moz.build | 42 +- dom/credentialmanagement/moz.build | 16 +- dom/crypto/moz.build | 30 +- dom/debugger/moz.build | 22 +- dom/encoding/moz.build | 18 +- dom/events/android/moz.build | 4 +- dom/events/emacs/moz.build | 4 +- dom/events/mac/moz.build | 4 +- dom/events/moz.build | 296 +- dom/events/unix/moz.build | 4 +- dom/events/win/moz.build | 4 +- dom/fetch/moz.build | 76 +- dom/file/ipc/moz.build | 80 +- dom/file/moz.build | 80 +- dom/file/uri/moz.build | 28 +- dom/filehandle/moz.build | 20 +- dom/filesystem/compat/moz.build | 32 +- dom/filesystem/compat/tests/moz.build | 2 +- dom/filesystem/moz.build | 52 +- dom/filesystem/tests/moz.build | 2 +- dom/flex/moz.build | 18 +- dom/gamepad/moz.build | 116 +- dom/geolocation/moz.build | 48 +- dom/grid/moz.build | 34 +- dom/html/input/moz.build | 45 +- dom/html/moz.build | 430 +- dom/indexedDB/moz.build | 168 +- dom/indexedDB/test/gtest/moz.build | 14 +- dom/interfaces/base/moz.build | 43 +- dom/interfaces/events/moz.build | 5 +- dom/interfaces/geolocation/moz.build | 11 +- dom/interfaces/html/moz.build | 7 +- dom/interfaces/notification/moz.build | 5 +- dom/interfaces/payments/moz.build | 12 +- dom/interfaces/push/moz.build | 8 +- dom/interfaces/security/moz.build | 9 +- dom/interfaces/sidebar/moz.build | 5 +- dom/interfaces/storage/moz.build | 6 +- dom/interfaces/xul/moz.build | 23 +- dom/ipc/fuzztest/moz.build | 14 +- dom/ipc/jsactor/moz.build | 46 +- dom/ipc/moz.build | 356 +- dom/jsurl/moz.build | 10 +- dom/l10n/moz.build | 30 +- dom/l10n/tests/gtest/moz.build | 4 +- dom/locales/moz.build | 10 +- dom/localstorage/moz.build | 84 +- dom/localstorage/test/gtest/moz.build | 8 +- dom/manifest/moz.build | 18 +- dom/mathml/moz.build | 16 +- dom/media/bridge/moz.build | 36 +- dom/media/doctor/gtest/moz.build | 16 +- dom/media/doctor/moz.build | 42 +- dom/media/eme/mediadrm/moz.build | 14 +- dom/media/eme/moz.build | 62 +- dom/media/encoder/moz.build | 48 +- dom/media/fake-cdm/moz.build | 16 +- dom/media/flac/moz.build | 22 +- dom/media/fuzz/moz.build | 26 +- dom/media/gmp-plugin-openh264/moz.build | 10 +- dom/media/gmp/moz.build | 234 +- dom/media/gmp/widevine-adapter/moz.build | 22 +- dom/media/gtest/moz.build | 178 +- dom/media/gtest/mp4_demuxer/moz.build | 86 +- dom/media/hls/moz.build | 22 +- dom/media/imagecapture/moz.build | 12 +- dom/media/ipc/moz.build | 78 +- dom/media/mediacapabilities/moz.build | 28 +- dom/media/mediacontrol/moz.build | 54 +- dom/media/mediacontrol/tests/gtest/moz.build | 25 +- dom/media/mediasession/moz.build | 16 +- dom/media/mediasink/moz.build | 20 +- dom/media/mediasource/gtest/moz.build | 10 +- dom/media/mediasource/moz.build | 50 +- dom/media/moz.build | 620 +- dom/media/mp3/moz.build | 16 +- dom/media/mp4/moz.build | 54 +- dom/media/ogg/moz.build | 32 +- .../agnostic/bytestreams/gtest/moz.build | 4 +- .../platforms/agnostic/bytestreams/moz.build | 20 +- dom/media/platforms/agnostic/eme/moz.build | 18 +- dom/media/platforms/agnostic/gmp/moz.build | 12 +- dom/media/platforms/ffmpeg/ffvpx/moz.build | 42 +- dom/media/platforms/ffmpeg/moz.build | 20 +- dom/media/platforms/moz.build | 191 +- dom/media/platforms/omx/moz.build | 30 +- dom/media/platforms/wmf/moz.build | 38 +- dom/media/systemservices/moz.build | 139 +- dom/media/wave/moz.build | 16 +- dom/media/webaudio/blink/moz.build | 48 +- dom/media/webaudio/moz.build | 232 +- dom/media/webm/moz.build | 33 +- dom/media/webrtc/common/moz.build | 20 +- dom/media/webrtc/jsapi/moz.build | 50 +- dom/media/webrtc/jsep/moz.build | 20 +- dom/media/webrtc/libwebrtcglue/moz.build | 44 +- dom/media/webrtc/moz.build | 132 +- dom/media/webrtc/sdp/moz.build | 54 +- dom/media/webrtc/tests/fuzztests/moz.build | 14 +- .../third_party_build/extract-for-git.py | 94 +- dom/media/webrtc/third_party_build/moz.build | 116 +- .../third_party_build/vendor-libwebrtc.py | 147 +- dom/media/webrtc/transport/build/moz.build | 48 +- dom/media/webrtc/transport/common.build | 136 +- dom/media/webrtc/transport/fuzztest/moz.build | 30 +- dom/media/webrtc/transport/ipc/moz.build | 60 +- dom/media/webrtc/transport/moz.build | 14 +- dom/media/webrtc/transport/test/moz.build | 126 +- dom/media/webrtc/transportbridge/moz.build | 32 +- dom/media/webspeech/moz.build | 6 +- dom/media/webspeech/recognition/moz.build | 74 +- dom/media/webspeech/synth/android/moz.build | 10 +- dom/media/webspeech/synth/cocoa/moz.build | 6 +- dom/media/webspeech/synth/moz.build | 79 +- dom/media/webspeech/synth/speechd/moz.build | 10 +- dom/media/webspeech/synth/windows/moz.build | 8 +- dom/media/webvtt/moz.build | 14 +- dom/messagechannel/moz.build | 30 +- dom/messagechannel/tests/moz.build | 6 +- dom/midi/moz.build | 88 +- dom/moz.build | 196 +- dom/network/interfaces/moz.build | 6 +- dom/network/moz.build | 70 +- dom/notification/moz.build | 38 +- dom/offline/moz.build | 10 +- dom/payments/ipc/moz.build | 16 +- dom/payments/moz.build | 54 +- dom/performance/moz.build | 68 +- dom/permission/moz.build | 18 +- dom/plugins/base/moz.build | 114 +- dom/plugins/ipc/hangui/moz.build | 20 +- dom/plugins/ipc/interpose/moz.build | 6 +- dom/plugins/ipc/moz.build | 189 +- dom/plugins/test/moz.build | 13 +- .../test/testplugin/flashplugin/moz.build | 8 +- dom/plugins/test/testplugin/moz.build | 10 +- .../test/testplugin/secondplugin/moz.build | 8 +- .../test/testplugin/thirdplugin/moz.build | 8 +- dom/power/moz.build | 20 +- dom/presentation/interfaces/moz.build | 35 +- dom/presentation/moz.build | 112 +- dom/presentation/provider/moz.build | 22 +- dom/prio/moz.build | 12 +- dom/prio/test/gtest/moz.build | 10 +- dom/promise/moz.build | 36 +- dom/prototype/moz.build | 12 +- dom/push/moz.build | 60 +- dom/push/test/xpcshell/moz.build | 6 +- dom/quota/moz.build | 106 +- dom/quota/test/gtest/moz.build | 16 +- dom/quota/test/moz.build | 54 +- dom/reporting/moz.build | 64 +- dom/reporting/tests/gtest/moz.build | 6 +- dom/script/moz.build | 42 +- dom/security/featurepolicy/fuzztest/moz.build | 15 +- dom/security/featurepolicy/moz.build | 36 +- .../featurepolicy/test/gtest/moz.build | 7 +- dom/security/fuzztest/moz.build | 15 +- dom/security/moz.build | 110 +- dom/security/sanitizer/moz.build | 24 +- .../test/csp/file_upgrade_insecure_wsh.py | 2 + .../test/csp/file_websocket_self_wsh.py | 2 + .../general/file_sec_fetch_websocket_wsh.py | 1 + dom/security/test/gtest/moz.build | 18 +- .../https-only/file_upgrade_insecure_wsh.py | 2 + .../file_main_bug803225_websocket_wsh.py | 2 + dom/security/test/moz.build | 34 +- dom/serviceworkers/moz.build | 186 +- dom/serviceworkers/test/gtest/moz.build | 6 +- dom/simpledb/moz.build | 38 +- dom/smil/moz.build | 104 +- dom/storage/moz.build | 74 +- dom/svg/moz.build | 486 +- dom/system/android/moz.build | 10 +- dom/system/linux/moz.build | 16 +- dom/system/mac/moz.build | 13 +- dom/system/moz.build | 68 +- dom/system/windows/moz.build | 11 +- dom/tests/moz.build | 144 +- dom/u2f/moz.build | 22 +- dom/url/moz.build | 24 +- dom/vr/moz.build | 106 +- dom/webauthn/moz.build | 102 +- dom/webbrowserpersist/moz.build | 50 +- dom/webgpu/moz.build | 91 +- dom/webidl/moz.build | 1454 +- dom/webshare/moz.build | 3 +- dom/websocket/moz.build | 16 +- .../tests/file_websocket_basic_wsh.py | 12 +- ...bsocket_permessage_deflate_disabled_wsh.py | 6 +- ...websocket_permessage_deflate_params_wsh.py | 6 +- ...bsocket_permessage_deflate_rejected_wsh.py | 6 +- .../file_websocket_permessage_deflate_wsh.py | 6 +- dom/websocket/tests/file_websocket_wsh.py | 41 +- .../websocket_hybi/file_binary-frames_wsh.py | 4 +- .../file_check-binary-messages_wsh.py | 14 +- dom/workers/moz.build | 128 +- dom/workers/remoteworkers/moz.build | 52 +- dom/workers/sharedworkers/moz.build | 24 +- .../test_service_workers_at_startup.py | 17 +- dom/worklet/moz.build | 28 +- dom/xhr/moz.build | 36 +- dom/xml/moz.build | 48 +- dom/xml/resources/moz.build | 2 +- dom/xslt/base/moz.build | 26 +- dom/xslt/moz.build | 14 +- dom/xslt/xml/moz.build | 14 +- dom/xslt/xpath/moz.build | 90 +- dom/xslt/xslt/moz.build | 86 +- dom/xul/moz.build | 106 +- editor/composer/moz.build | 70 +- editor/libeditor/moz.build | 144 +- editor/moz.build | 38 +- editor/spellchecker/moz.build | 20 +- editor/txmgr/moz.build | 24 +- editor/txmgr/tests/moz.build | 4 +- extensions/auth/moz.build | 30 +- extensions/moz.build | 6 +- extensions/permissions/moz.build | 34 +- extensions/permissions/test/gtest/moz.build | 5 +- extensions/permissions/test/moz.build | 7 +- extensions/pref/autoconfig/moz.build | 6 +- extensions/pref/autoconfig/src/moz.build | 12 +- .../test/marionette/test_autoconfig.py | 91 +- extensions/pref/moz.build | 6 +- extensions/spellcheck/hunspell/glue/moz.build | 32 +- extensions/spellcheck/hunspell/moz.build | 6 +- extensions/spellcheck/idl/moz.build | 7 +- extensions/spellcheck/locales/moz.build | 4 +- extensions/spellcheck/moz.build | 14 +- extensions/spellcheck/src/moz.build | 30 +- extensions/universalchardet/moz.build | 6 +- extensions/universalchardet/tests/moz.build | 3 +- gfx/2d/moz.build | 352 +- gfx/angle/moz.build | 10 +- gfx/angle/targets/angle_common/moz.build | 132 +- .../targets/angle_gpu_info_util/moz.build | 92 +- gfx/angle/targets/angle_image_util/moz.build | 86 +- gfx/angle/targets/libEGL/moz.build | 152 +- gfx/angle/targets/libGLESv2/moz.build | 536 +- gfx/angle/targets/preprocessor/moz.build | 100 +- gfx/angle/targets/translator/moz.build | 336 +- gfx/angle/update-angle.py | 479 +- gfx/angle/vendor_from_git.py | 49 +- gfx/config/moz.build | 26 +- gfx/gl/GLConsts.py | 62 +- gfx/gl/moz.build | 217 +- gfx/ipc/moz.build | 103 +- gfx/layers/apz/test/gtest/moz.build | 38 +- gfx/layers/apz/test/gtest/mvm/moz.build | 6 +- gfx/layers/d3d11/genshaders.py | 83 +- gfx/layers/ipc/fuzztest/moz.build | 12 +- gfx/layers/moz.build | 1128 +- gfx/moz.build | 74 +- gfx/src/moz.build | 116 +- gfx/tests/gtest/moz.build | 106 +- .../test_pref_rollout_workaround.py | 122 +- gfx/tests/moz.build | 8 +- gfx/thebes/gencjkcisvs.py | 43 +- gfx/thebes/moz.build | 384 +- gfx/vr/moz.build | 150 +- gfx/vr/service/moz.build | 41 +- gfx/vr/vrhost/moz.build | 42 +- gfx/vr/vrhost/testhost/moz.build | 10 +- gfx/webrender_bindings/moz.build | 152 +- gfx/wgpu_bindings/moz.build | 15 +- hal/moz.build | 136 +- image/build/moz.build | 18 +- image/decoders/icon/android/moz.build | 6 +- image/decoders/icon/gtk/moz.build | 6 +- image/decoders/icon/mac/moz.build | 4 +- image/decoders/icon/moz.build | 28 +- image/decoders/icon/win/moz.build | 6 +- image/decoders/moz.build | 56 +- image/encoders/bmp/moz.build | 6 +- image/encoders/ico/moz.build | 10 +- image/encoders/jpeg/moz.build | 4 +- image/encoders/moz.build | 8 +- image/encoders/png/moz.build | 6 +- image/moz.build | 186 +- image/test/fuzzing/moz.build | 18 +- image/test/gtest/moz.build | 186 +- intl/build/moz.build | 14 +- intl/gtest/moz.build | 8 +- intl/hyphenation/glue/moz.build | 20 +- intl/icu_sources_data.py | 361 +- intl/l10n/moz.build | 45 +- intl/l10n/rust/gtest/moz.build | 4 +- intl/locale/android/moz.build | 8 +- intl/locale/gtk/moz.build | 8 +- intl/locale/mac/moz.build | 8 +- intl/locale/moz.build | 109 +- intl/locale/props2arrays.py | 12 +- intl/locale/tests/gtest/moz.build | 14 +- intl/locale/windows/moz.build | 9 +- intl/locales/moz.build | 76 +- intl/lwbrk/gtest/moz.build | 5 +- intl/lwbrk/moz.build | 30 +- intl/moz.build | 36 +- intl/strres/moz.build | 18 +- intl/uconv/moz.build | 26 +- intl/uconv/tests/moz.build | 5 +- intl/unicharutil/moz.build | 6 +- intl/unicharutil/util/moz.build | 32 +- ipc/app/moz.build | 74 +- ipc/chromium/moz.build | 156 +- ipc/glue/moz.build | 320 +- ipc/gtest/moz.build | 10 +- ipc/ipdl/ipdl.py | 166 +- ipc/ipdl/ipdl/__init__.py | 46 +- ipc/ipdl/ipdl/ast.py | 123 +- ipc/ipdl/ipdl/builtin.py | 81 +- ipc/ipdl/ipdl/cgen.py | 55 +- ipc/ipdl/ipdl/checker.py | 27 +- ipc/ipdl/ipdl/cxx/ast.py | 312 +- ipc/ipdl/ipdl/cxx/cgen.py | 321 +- ipc/ipdl/ipdl/cxx/code.py | 39 +- ipc/ipdl/ipdl/direct_call.py | 916 +- ipc/ipdl/ipdl/lower.py | 3860 ++--- ipc/ipdl/ipdl/parser.py | 321 +- ipc/ipdl/ipdl/type.py | 574 +- ipc/ipdl/ipdl/util.py | 2 +- ipc/ipdl/moz.build | 12 +- ipc/ipdl/test/cxx/app/moz.build | 14 +- ipc/ipdl/test/cxx/genIPDLUnitTests.py | 146 +- ipc/ipdl/test/cxx/moz.build | 306 +- ipc/ipdl/test/ipdl/IPDLCompile.py | 45 +- ipc/ipdl/test/ipdl/moz.build | 1 + ipc/ipdl/test/ipdl/runtests.py | 65 +- ipc/ipdl/test/moz.build | 6 +- ipc/moz.build | 16 +- ipc/mscom/moz.build | 108 +- ipc/mscom/mozglue/moz.build | 6 +- ipc/mscom/oop/moz.build | 30 +- ipc/pull-chromium.py | 34 +- ipc/testshell/moz.build | 34 +- js/ductwork/debugger/moz.build | 14 +- js/ffi.configure | 72 +- js/moz.build | 26 +- js/moz.configure | 824 +- js/src/build/moz.build | 83 +- js/src/builtin/embedjs.py | 83 +- js/src/builtin/intl/make_intl_data.py | 1860 +-- js/src/debugger/moz.build | 29 +- js/src/devtools/automation/autospider.py | 645 +- js/src/devtools/gc/gc-test.py | 78 +- js/src/devtools/rootAnalysis/analyze.py | 396 +- js/src/devtools/rootAnalysis/explain.py | 50 +- js/src/devtools/rootAnalysis/mach_commands.py | 219 +- js/src/devtools/rootAnalysis/run-test.py | 75 +- .../rootAnalysis/t/exceptions/test.py | 18 +- .../devtools/rootAnalysis/t/hazards/test.py | 86 +- .../rootAnalysis/t/sixgill-tree/test.py | 78 +- js/src/devtools/rootAnalysis/t/sixgill.py | 70 +- .../rootAnalysis/t/suppression/test.py | 18 +- .../devtools/rootAnalysis/t/virtual/test.py | 60 +- js/src/frontend/GenerateReservedWords.py | 116 +- js/src/frontend/align_stack_comment.py | 49 +- js/src/frontend/moz.build | 108 +- js/src/frontend/smoosh/moz.build | 13 +- js/src/fuzz-tests/moz.build | 36 +- js/src/gc/GenerateStatsPhases.py | 315 +- js/src/gc/moz.build | 63 +- js/src/gdb/lib-for-tests/catcher.py | 6 +- js/src/gdb/lib-for-tests/prologue.py | 59 +- js/src/gdb/moz.build | 66 +- js/src/gdb/mozilla/CellHeader.py | 8 +- js/src/gdb/mozilla/ExecutableAllocator.py | 19 +- js/src/gdb/mozilla/GCCellPtr.py | 73 +- js/src/gdb/mozilla/Interpreter.py | 46 +- js/src/gdb/mozilla/IonGraph.py | 110 +- js/src/gdb/mozilla/JSObject.py | 52 +- js/src/gdb/mozilla/JSString.py | 36 +- js/src/gdb/mozilla/JSSymbol.py | 8 +- js/src/gdb/mozilla/PropertyKey.py | 15 +- js/src/gdb/mozilla/Root.py | 24 +- js/src/gdb/mozilla/asmjs.py | 12 +- js/src/gdb/mozilla/jitsrc.py | 71 +- js/src/gdb/mozilla/jsop.py | 10 +- js/src/gdb/mozilla/jsval.py | 83 +- js/src/gdb/mozilla/prettyprinters.py | 50 +- js/src/gdb/mozilla/unwind.py | 151 +- js/src/gdb/progressbar.py | 18 +- js/src/gdb/run-tests.py | 257 +- js/src/gdb/taskpool.py | 46 +- js/src/gdb/tests/enum-printers.py | 26 +- js/src/gdb/tests/test-ExecutableAllocator.py | 19 +- js/src/gdb/tests/test-GCCellPtr.py | 26 +- js/src/gdb/tests/test-Interpreter.py | 20 +- js/src/gdb/tests/test-JSObject-null.py | 8 +- js/src/gdb/tests/test-JSObject.py | 22 +- js/src/gdb/tests/test-JSString-null.py | 8 +- js/src/gdb/tests/test-JSString-subclasses.py | 4 +- js/src/gdb/tests/test-JSString.py | 22 +- js/src/gdb/tests/test-JSSymbol.py | 12 +- js/src/gdb/tests/test-Root-null.py | 6 +- js/src/gdb/tests/test-Root.py | 34 +- js/src/gdb/tests/test-asmjs.py | 6 +- js/src/gdb/tests/test-jsbytecode.py | 8 +- js/src/gdb/tests/test-jsid.py | 24 +- js/src/gdb/tests/test-jsop.py | 8 +- js/src/gdb/tests/test-jsval.py | 34 +- js/src/gdb/tests/test-prettyprinters.py | 30 +- js/src/gdb/tests/test-unwind.py | 6 +- js/src/gdb/tests/typedef-printers.py | 8 +- js/src/irregexp/import-irregexp.py | 73 +- js/src/irregexp/moz.build | 54 +- js/src/jit-test/jit_test.py | 506 +- js/src/jit/GenerateCacheIRFiles.py | 498 +- js/src/jit/GenerateOpcodeFiles.py | 25 +- js/src/jit/arm/gen-double-encoder-table.py | 6 +- js/src/jit/moz.build | 437 +- js/src/jsapi-tests/moz.build | 278 +- js/src/make-source-package.py | 278 +- js/src/moz.build | 866 +- js/src/rust/moz.build | 42 +- js/src/shell/js-gdb.py | 4 +- js/src/shell/moz.build | 50 +- js/src/tests/compare_bench.py | 26 +- js/src/tests/jstests.py | 624 +- js/src/tests/lib/jittests.py | 429 +- js/src/tests/lib/manifest.py | 324 +- js/src/tests/lib/progressbar.py | 54 +- js/src/tests/lib/remote.py | 24 +- js/src/tests/lib/results.py | 275 +- js/src/tests/lib/structuredlog.py | 34 +- js/src/tests/lib/tasks_unix.py | 17 +- js/src/tests/lib/tasks_win.py | 32 +- js/src/tests/lib/terminal_unix.py | 28 +- js/src/tests/lib/terminal_win.py | 36 +- js/src/tests/lib/tests.py | 159 +- js/src/tests/lib/wptreport.py | 42 +- js/src/tests/moz.build | 1 + .../make-normalize-generateddata-input.py | 63 +- js/src/tests/parsemark.py | 122 +- js/src/tests/test/run.py | 82 +- js/src/tests/test262-export.py | 128 +- js/src/tests/test262-update.py | 276 +- js/src/vm/jsopcode.py | 283 +- js/src/vm/make_opcode_doc.py | 111 +- js/src/wasm/moz.build | 63 +- js/sub.configure | 49 +- js/xpconnect/idl/moz.build | 15 +- js/xpconnect/loader/moz.build | 58 +- js/xpconnect/loader/script_cache.py | 43 +- js/xpconnect/moz.build | 10 +- js/xpconnect/public/moz.build | 5 +- js/xpconnect/shell/moz.build | 42 +- js/xpconnect/src/moz.build | 102 +- js/xpconnect/tests/browser/moz.build | 3 +- js/xpconnect/tests/chrome/moz.build | 6 +- .../tests/components/native/moz.build | 14 +- js/xpconnect/tests/idl/moz.build | 16 +- js/xpconnect/tests/marionette/moz.build | 2 +- .../marionette/test_preloader_telemetry.py | 32 +- js/xpconnect/tests/mochitest/moz.build | 3 +- js/xpconnect/tests/moz.build | 32 +- js/xpconnect/wrappers/moz.build | 28 +- layout/base/gtest/moz.build | 22 +- layout/base/moz.build | 280 +- layout/base/tests/marionette/selection.py | 178 +- .../test_accessiblecaret_cursor_mode.py | 62 +- .../test_accessiblecaret_selection_mode.py | 356 +- layout/build/moz.build | 102 +- layout/forms/moz.build | 74 +- layout/generic/FrameClass.py | 2 +- layout/generic/FrameClasses.py | 2 + layout/generic/GenerateFrameLists.py | 8 +- layout/generic/frame-graph.py | 6 +- layout/generic/moz.build | 436 +- layout/inspector/moz.build | 34 +- layout/ipc/moz.build | 30 +- layout/mathml/moz.build | 91 +- layout/media/moz.build | 22 +- layout/media/webrtc/moz.build | 8 +- layout/moz.build | 48 +- layout/painting/moz.build | 104 +- layout/printing/moz.build | 42 +- layout/reftests/border-image/gen-refs.py | 660 +- .../reftests/fonts/gsubtest/makegsubfonts.py | 422 +- layout/reftests/fonts/mark-generate.py | 29 +- layout/reftests/fonts/math/generate.py | 127 +- layout/reftests/moz.build | 472 +- layout/style/GenerateCSSPropertyID.py | 15 +- layout/style/GenerateCSSPropsGenerated.py | 54 +- .../GenerateCompositorAnimatableProperties.py | 11 +- .../GenerateComputedDOMStyleGenerated.py | 7 +- .../style/GenerateCountedUnknownProperties.py | 8 +- layout/style/GenerateServoCSSPropList.py | 37 +- layout/style/moz.build | 521 +- layout/style/test/gen-css-properties.py | 6 +- .../test/gtest/generate_example_stylesheet.py | 13 +- layout/style/test/gtest/moz.build | 18 +- layout/style/test/moz.build | 244 +- layout/svg/moz.build | 148 +- layout/tables/moz.build | 72 +- layout/tools/layout-debug/moz.build | 8 +- layout/tools/layout-debug/src/moz.build | 14 +- layout/tools/layout-debug/ui/moz.build | 2 +- layout/tools/recording/moz.build | 6 +- layout/tools/reftest/mach_commands.py | 152 +- .../reftest/mach_test_package_commands.py | 60 +- layout/tools/reftest/moz.build | 42 +- layout/tools/reftest/output.py | 117 +- layout/tools/reftest/reftest/__init__.py | 104 +- layout/tools/reftest/reftestcommandline.py | 818 +- layout/tools/reftest/remotereftest.py | 226 +- layout/tools/reftest/runreftest.py | 539 +- layout/tools/reftest/selftest/conftest.py | 74 +- .../selftest/test_python_manifest_parser.py | 12 +- .../selftest/test_reftest_manifest_parser.py | 37 +- .../reftest/selftest/test_reftest_output.py | 88 +- layout/xul/grid/moz.build | 54 +- layout/xul/moz.build | 110 +- layout/xul/tree/moz.build | 56 +- media/gmp-clearkey/0.1/gtest/moz.build | 6 +- media/gmp-clearkey/0.1/moz.build | 65 +- media/psshparser/gtest/moz.build | 6 +- media/psshparser/moz.build | 14 +- media/webrtc/moz.build | 10 +- media/webrtc/signaling/gtest/moz.build | 67 +- memory/build/moz.build | 53 +- memory/gtest/moz.build | 14 +- memory/moz.build | 14 +- memory/moz.configure | 2 +- memory/mozalloc/moz.build | 48 +- memory/replace/dmd/block_analyzer.py | 207 +- memory/replace/dmd/dmd.py | 647 +- memory/replace/dmd/moz.build | 30 +- memory/replace/dmd/test/moz.build | 23 +- memory/replace/dmd/test/scan-test.py | 68 +- memory/replace/logalloc/moz.build | 16 +- .../replace/logalloc/replay/logalloc_munge.py | 65 +- memory/replace/logalloc/replay/moz.build | 55 +- memory/replace/moz.build | 18 +- memory/replace/phc/moz.build | 24 +- memory/replace/phc/test/gtest/moz.build | 6 +- memory/replace/phc/test/moz.build | 4 +- memory/volatile/moz.build | 20 +- memory/volatile/tests/moz.build | 4 +- mfbt/moz.build | 308 +- mfbt/tests/gtest/moz.build | 26 +- mfbt/tests/moz.build | 169 +- mobile/android/actors/moz.build | 26 +- mobile/android/app/moz.build | 32 +- mobile/android/base/moz.build | 10 +- .../android/branding/beta/content/moz.build | 2 +- .../android/branding/beta/locales/moz.build | 2 +- mobile/android/branding/beta/moz.build | 2 +- .../branding/nightly/content/moz.build | 2 +- .../branding/nightly/locales/moz.build | 2 +- mobile/android/branding/nightly/moz.build | 2 +- .../branding/official/content/moz.build | 2 +- .../branding/official/locales/moz.build | 2 +- mobile/android/branding/official/moz.build | 2 +- .../branding/unofficial/content/moz.build | 2 +- .../branding/unofficial/locales/moz.build | 2 +- mobile/android/branding/unofficial/moz.build | 2 +- mobile/android/chrome/geckoview/moz.build | 2 +- mobile/android/chrome/moz.build | 16 +- .../android/components/extensions/moz.build | 10 +- .../components/extensions/schemas/moz.build | 2 +- mobile/android/components/geckoview/moz.build | 44 +- mobile/android/components/moz.build | 12 +- mobile/android/debug_sign_tool.py | 173 +- mobile/android/fonts/moz.build | 14 +- .../src/androidTest/assets/moz.build | 69 +- mobile/android/gradle.configure | 318 +- mobile/android/gradle.py | 20 +- mobile/android/installer/moz.build | 4 +- mobile/android/locales/filter.py | 20 +- mobile/android/locales/moz.build | 6 +- mobile/android/modules/geckoview/moz.build | 62 +- mobile/android/modules/moz.build | 8 +- mobile/android/moz.build | 44 +- mobile/android/moz.configure | 83 +- mobile/android/themes/core/moz.build | 2 +- mobile/android/themes/geckoview/moz.build | 2 +- mobile/locales/filter.py | 20 +- mobile/locales/moz.build | 6 +- modules/libjar/moz.build | 46 +- modules/libjar/zipwriter/moz.build | 20 +- modules/libmar/moz.build | 14 +- modules/libmar/sign/moz.build | 20 +- modules/libmar/src/moz.build | 26 +- modules/libmar/tests/moz.build | 6 +- modules/libmar/tool/moz.build | 48 +- modules/libmar/verify/moz.build | 34 +- .../libpref/init/generate_static_pref_list.py | 341 +- modules/libpref/moz.build | 234 +- modules/libpref/test/gtest/moz.build | 22 +- .../test/test_generate_static_pref_list.py | 247 +- modules/moz.build | 8 +- moz.build | 198 +- moz.configure | 820 +- mozglue/android/moz.build | 83 +- mozglue/baseprofiler/moz.build | 134 +- mozglue/build/moz.build | 92 +- mozglue/dllservices/gen_dll_blocklist_defs.py | 257 +- mozglue/dllservices/moz.build | 62 +- mozglue/linker/moz.build | 30 +- mozglue/linker/tests/moz.build | 16 +- mozglue/misc/interceptor/moz.build | 25 +- mozglue/misc/moz.build | 111 +- mozglue/moz.build | 22 +- .../TestDllBlocklist_AllowByVersion/moz.build | 10 +- .../TestDllBlocklist_MatchByName/moz.build | 8 +- .../TestDllBlocklist_MatchByVersion/moz.build | 10 +- .../TestDllBlocklist_NoOpEntryPoint/moz.build | 10 +- mozglue/tests/gtest/moz.build | 15 +- mozglue/tests/interceptor/moz.build | 28 +- mozglue/tests/moz.build | 50 +- netwerk/base/http-sfv/moz.build | 10 +- netwerk/base/moz.build | 540 +- netwerk/base/mozurl/moz.build | 12 +- netwerk/base/rust-helper/moz.build | 6 +- netwerk/build/moz.build | 50 +- netwerk/cache/moz.build | 58 +- netwerk/cache2/moz.build | 74 +- netwerk/cookie/moz.build | 78 +- netwerk/dns/mdns/libmdns/moz.build | 44 +- netwerk/dns/mdns/moz.build | 6 +- netwerk/dns/moz.build | 136 +- netwerk/dns/prepare_tlds.py | 191 +- netwerk/dns/tests/moz.build | 4 +- netwerk/dns/tests/unit/data/moz.build | 10 +- netwerk/dns/tests/unit/moz.build | 4 +- netwerk/ipc/moz.build | 152 +- netwerk/locales/moz.build | 2 +- netwerk/mime/moz.build | 18 +- netwerk/moz.build | 46 +- netwerk/protocol/about/moz.build | 28 +- netwerk/protocol/data/moz.build | 23 +- netwerk/protocol/file/moz.build | 36 +- netwerk/protocol/ftp/moz.build | 42 +- netwerk/protocol/gio/moz.build | 15 +- netwerk/protocol/http/make_incoming_tables.py | 120 +- netwerk/protocol/http/make_outgoing_tables.py | 31 +- netwerk/protocol/http/moz.build | 298 +- netwerk/protocol/moz.build | 8 +- netwerk/protocol/res/moz.build | 34 +- netwerk/protocol/viewsource/moz.build | 18 +- netwerk/protocol/websocket/moz.build | 86 +- netwerk/sctp/datachannel/moz.build | 34 +- netwerk/socket/moz.build | 45 +- netwerk/socket/neqo_glue/moz.build | 13 +- netwerk/streamconv/converters/moz.build | 32 +- netwerk/streamconv/moz.build | 20 +- netwerk/system/android/moz.build | 6 +- netwerk/system/linux/moz.build | 6 +- netwerk/system/mac/moz.build | 8 +- netwerk/system/moz.build | 22 +- netwerk/system/netlink/moz.build | 6 +- netwerk/system/win32/moz.build | 6 +- netwerk/test/fuzz/moz.build | 31 +- netwerk/test/gtest/moz.build | 101 +- netwerk/test/gtest/parse-ftp/moz.build | 104 +- netwerk/test/http3server/moz.build | 12 +- netwerk/test/httpserver/moz.build | 10 +- netwerk/test/moz.build | 21 +- netwerk/test/unit/moz.build | 2 +- netwerk/url-classifier/moz.build | 80 +- netwerk/wifi/moz.build | 50 +- parser/html/moz.build | 160 +- parser/htmlparser/moz.build | 70 +- parser/moz.build | 9 +- parser/prototype/moz.build | 12 +- parser/xml/moz.build | 6 +- parser/xml/test/moz.build | 2 +- python/devtools/migrate-l10n/migrate/main.py | 129 +- python/gdbpp/gdbpp/__init__.py | 2 +- python/gdbpp/gdbpp/enumset.py | 14 +- python/gdbpp/gdbpp/linkedlist.py | 12 +- python/gdbpp/gdbpp/owningthread.py | 12 +- python/gdbpp/gdbpp/smartptr.py | 32 +- python/gdbpp/gdbpp/string.py | 6 +- python/gdbpp/gdbpp/tarray.py | 16 +- python/gdbpp/gdbpp/thashtable.py | 40 +- python/l10n/convert_xul_to_fluent/convert.py | 102 +- .../convert_xul_to_fluent/lib/__init__.py | 1 - python/l10n/convert_xul_to_fluent/lib/dtd.py | 5 +- .../l10n/convert_xul_to_fluent/lib/fluent.py | 10 +- .../convert_xul_to_fluent/lib/migration.py | 68 +- .../l10n/convert_xul_to_fluent/lib/utils.py | 4 +- python/l10n/convert_xul_to_fluent/lib/xul.py | 45 +- .../bug_1552333_aboutCertError.py | 50 +- .../bug_1634042_page_action_menu.py | 120 +- .../bug_1658629_migration_urlbar_actions.py | 40 +- .../bug_1667781_preferences_dialogs.py | 56 +- .../bug_1668284_settings_change.py | 23 +- python/l10n/test_fluent_migrations/fmt.py | 130 +- python/lldbutils/lldbutils/__init__.py | 4 +- python/lldbutils/lldbutils/general.py | 69 +- python/lldbutils/lldbutils/gfx.py | 47 +- python/lldbutils/lldbutils/layout.py | 25 +- python/lldbutils/lldbutils/utils.py | 36 +- python/mach/mach/base.py | 14 +- python/mach/mach/commands/commandinfo.py | 243 +- python/mach/mach/commands/settings.py | 35 +- python/mach/mach/config.py | 81 +- python/mach/mach/decorators.py | 135 +- python/mach/mach/dispatcher.py | 201 +- python/mach/mach/logging.py | 68 +- python/mach/mach/main.py | 277 +- python/mach/mach/mixin/logging.py | 7 +- python/mach/mach/mixin/process.py | 70 +- python/mach/mach/registrar.py | 55 +- python/mach/mach/sentry.py | 38 +- python/mach/mach/telemetry.py | 51 +- python/mach/mach/terminal.py | 8 +- python/mach/mach/test/conftest.py | 14 +- python/mach/mach/test/providers/basic.py | 7 +- python/mach/mach/test/providers/commands.py | 14 +- python/mach/mach/test/providers/conditions.py | 12 +- .../mach/test/providers/conditions_invalid.py | 2 +- python/mach/mach/test/providers/throw.py | 8 +- python/mach/mach/test/test_commands.py | 27 +- python/mach/mach/test/test_conditions.py | 42 +- python/mach/mach/test/test_config.py | 120 +- python/mach/mach/test/test_dispatcher.py | 16 +- python/mach/mach/test/test_entry_point.py | 25 +- python/mach/mach/test/test_error_output.py | 21 +- python/mach/mach/test/test_logger.py | 15 +- python/mach/mach/test/test_mach.py | 10 +- python/mach/mach/test/test_telemetry.py | 192 +- python/mach/mach/test/zero_microseconds.py | 7 +- python/mach/setup.py | 41 +- python/mach_commands.py | 255 +- python/moz.build | 90 +- python/mozboot/bin/bootstrap.py | 254 +- python/mozboot/mozboot/android.py | 275 +- python/mozboot/mozboot/archlinux.py | 139 +- python/mozboot/mozboot/base.py | 590 +- python/mozboot/mozboot/bootstrap.py | 429 +- python/mozboot/mozboot/centosfedora.py | 102 +- python/mozboot/mozboot/debian.py | 82 +- python/mozboot/mozboot/dump_syms.py | 6 +- python/mozboot/mozboot/fix_stacks.py | 6 +- python/mozboot/mozboot/freebsd.py | 54 +- python/mozboot/mozboot/gentoo.py | 58 +- python/mozboot/mozboot/linux_common.py | 83 +- python/mozboot/mozboot/lucetc.py | 2 +- python/mozboot/mozboot/mach_commands.py | 86 +- python/mozboot/mozboot/minidump_stackwalk.py | 6 +- python/mozboot/mozboot/mozconfig.py | 84 +- python/mozboot/mozboot/mozillabuild.py | 154 +- python/mozboot/mozboot/nasm.py | 4 +- python/mozboot/mozboot/node.py | 8 +- python/mozboot/mozboot/openbsd.py | 36 +- python/mozboot/mozboot/opensuse.py | 98 +- python/mozboot/mozboot/osx.py | 432 +- python/mozboot/mozboot/rust.py | 111 +- python/mozboot/mozboot/sccache.py | 10 +- python/mozboot/mozboot/solus.py | 77 +- python/mozboot/mozboot/static_analysis.py | 6 +- python/mozboot/mozboot/stylo.py | 12 +- python/mozboot/mozboot/test/test_mozconfig.py | 83 +- .../mozboot/mozboot/test/test_write_config.py | 56 +- python/mozboot/mozboot/util.py | 17 +- python/mozboot/mozboot/void.py | 61 +- python/mozboot/mozboot/wasi_sysroot.py | 2 +- python/mozboot/mozboot/windows.py | 110 +- python/mozboot/setup.py | 12 +- python/mozbuild/mozbuild/action/buildlist.py | 15 +- .../mozbuild/mozbuild/action/check_binary.py | 236 +- .../mozbuild/action/download_wpt_manifest.py | 3 +- python/mozbuild/mozbuild/action/dump_env.py | 7 +- .../mozbuild/mozbuild/action/dumpsymbols.py | 124 +- .../mozbuild/action/exe_7z_archive.py | 68 +- .../mozbuild/action/exe_7z_extract.py | 9 +- python/mozbuild/mozbuild/action/fat_aar.py | 101 +- .../mozbuild/mozbuild/action/file_generate.py | 89 +- .../mozbuild/action/generate_searchjson.py | 25 +- .../mozbuild/action/generate_symbols_file.py | 40 +- python/mozbuild/mozbuild/action/install.py | 2 +- python/mozbuild/mozbuild/action/jar_maker.py | 2 +- python/mozbuild/mozbuild/action/l10n_merge.py | 27 +- .../mozbuild/action/langpack_manifest.py | 204 +- python/mozbuild/mozbuild/action/make_dmg.py | 25 +- python/mozbuild/mozbuild/action/make_unzip.py | 7 +- python/mozbuild/mozbuild/action/make_zip.py | 7 +- python/mozbuild/mozbuild/action/node.py | 40 +- .../action/output_searchplugins_list.py | 2 +- .../action/package_generated_sources.py | 15 +- .../mozbuild/action/process_define_files.py | 88 +- .../action/process_install_manifest.py | 90 +- .../mozbuild/action/symbols_archive.py | 77 +- .../mozbuild/mozbuild/action/test_archive.py | 1167 +- python/mozbuild/mozbuild/action/tooltool.py | 961 +- python/mozbuild/mozbuild/action/unpack_dmg.py | 29 +- python/mozbuild/mozbuild/action/util.py | 12 +- python/mozbuild/mozbuild/action/webidl.py | 2 +- python/mozbuild/mozbuild/action/wrap_rustc.py | 57 +- python/mozbuild/mozbuild/action/xpccheck.py | 64 +- .../mozbuild/mozbuild/action/xpidl-process.py | 101 +- python/mozbuild/mozbuild/action/zip.py | 26 +- python/mozbuild/mozbuild/analyze/hg.py | 53 +- .../mozbuild/mozbuild/android_version_code.py | 123 +- python/mozbuild/mozbuild/artifact_builds.py | 38 +- python/mozbuild/mozbuild/artifact_cache.py | 88 +- python/mozbuild/mozbuild/artifact_commands.py | 559 +- python/mozbuild/mozbuild/artifacts.py | 1255 +- python/mozbuild/mozbuild/backend/__init__.py | 32 +- python/mozbuild/mozbuild/backend/base.py | 145 +- .../mozbuild/backend/cargo_build_defs.py | 294 +- python/mozbuild/mozbuild/backend/clangd.py | 8 +- python/mozbuild/mozbuild/backend/common.py | 297 +- .../mozbuild/backend/configenvironment.py | 129 +- .../mozbuild/mozbuild/backend/cpp_eclipse.py | 235 +- .../mozbuild/mozbuild/backend/fastermake.py | 196 +- .../mozbuild/backend/mach_commands.py | 44 +- python/mozbuild/mozbuild/backend/make.py | 101 +- .../mozbuild/backend/recursivemake.py | 1225 +- .../mozbuild/backend/static_analysis.py | 11 +- .../mozbuild/backend/test_manifest.py | 55 +- .../mozbuild/mozbuild/backend/visualstudio.py | 497 +- python/mozbuild/mozbuild/base.py | 520 +- python/mozbuild/mozbuild/build_commands.py | 222 +- python/mozbuild/mozbuild/chunkify.py | 4 +- .../mozbuild/mozbuild/code_analysis/moz.build | 4 +- .../mozbuild/codecoverage/chrome_map.py | 76 +- .../mozbuild/codecoverage/lcov_rewriter.py | 321 +- .../mozbuild/codecoverage/manifest_handler.py | 2 +- .../mozbuild/codecoverage/packager.py | 32 +- .../mozbuild/compilation/codecomplete.py | 30 +- .../mozbuild/mozbuild/compilation/database.py | 4 +- python/mozbuild/mozbuild/compilation/util.py | 24 +- .../mozbuild/mozbuild/compilation/warnings.py | 125 +- python/mozbuild/mozbuild/config_status.py | 116 +- .../mozbuild/mozbuild/configure/__init__.py | 553 +- .../mozbuild/configure/check_debug_ranges.py | 40 +- .../mozbuild/mozbuild/configure/constants.py | 150 +- python/mozbuild/mozbuild/configure/help.py | 54 +- .../mozbuild/mozbuild/configure/libstdcxx.py | 51 +- python/mozbuild/mozbuild/configure/lint.py | 98 +- python/mozbuild/mozbuild/configure/options.py | 347 +- python/mozbuild/mozbuild/configure/util.py | 72 +- .../mozbuild/mozbuild/controller/building.py | 977 +- .../mozbuild/mozbuild/controller/clobber.py | 112 +- python/mozbuild/mozbuild/doctor.py | 229 +- python/mozbuild/mozbuild/dotproperties.py | 42 +- .../mozbuild/export_telemetry_schema.py | 14 +- python/mozbuild/mozbuild/faster_daemon.py | 229 +- python/mozbuild/mozbuild/frontend/context.py | 2306 ++- python/mozbuild/mozbuild/frontend/data.py | 736 +- python/mozbuild/mozbuild/frontend/emitter.py | 1416 +- .../mozbuild/mozbuild/frontend/gyp_reader.py | 365 +- .../mozbuild/frontend/mach_commands.py | 200 +- python/mozbuild/mozbuild/frontend/reader.py | 673 +- python/mozbuild/mozbuild/frontend/sandbox.py | 75 +- python/mozbuild/mozbuild/gen_test_backend.py | 10 +- python/mozbuild/mozbuild/generated_sources.py | 46 +- python/mozbuild/mozbuild/gn_processor.py | 444 +- python/mozbuild/mozbuild/html_build_viewer.py | 40 +- python/mozbuild/mozbuild/jar.py | 348 +- python/mozbuild/mozbuild/makeutil.py | 91 +- python/mozbuild/mozbuild/mozconfig.py | 218 +- python/mozbuild/mozbuild/mozinfo.py | 129 +- python/mozbuild/mozbuild/nodeutil.py | 40 +- python/mozbuild/mozbuild/preprocessor.py | 362 +- python/mozbuild/mozbuild/pythonutil.py | 34 +- .../mozbuild/repackaging/application_ini.py | 7 +- python/mozbuild/mozbuild/repackaging/dmg.py | 7 +- .../mozbuild/repackaging/installer.py | 9 +- python/mozbuild/mozbuild/repackaging/mar.py | 45 +- python/mozbuild/mozbuild/repackaging/msi.py | 67 +- python/mozbuild/mozbuild/schedules.py | 84 +- python/mozbuild/mozbuild/shellutil.py | 129 +- python/mozbuild/mozbuild/sphinx.py | 165 +- .../mozbuild/test/action/test_buildlist.py | 22 +- .../test/action/test_langpack_manifest.py | 47 +- .../mozbuild/test/action/test_node.py | 8 +- .../action/test_process_install_manifest.py | 42 +- .../mozbuild/mozbuild/test/backend/common.py | 311 +- .../test/backend/data/build/app/moz.build | 34 +- .../test/backend/data/build/moz.build | 40 +- .../test/backend/data/database/moz.build | 8 +- .../test/backend/data/defines/moz.build | 12 +- .../test/backend/data/dist-files/moz.build | 4 +- .../backend/data/exports-generated/moz.build | 16 +- .../test/backend/data/exports/moz.build | 10 +- .../final-target-files-wildcard/moz.build | 2 +- .../backend/data/final_target/both/moz.build | 4 +- .../data/final_target/dist-subdir/moz.build | 2 +- .../data/final_target/final-target/moz.build | 2 +- .../test/backend/data/final_target/moz.build | 2 +- .../data/final_target/xpi-name/moz.build | 2 +- .../data/generated-files-force/moz.build | 12 +- .../backend/data/generated-files/moz.build | 12 +- .../backend/data/generated_includes/moz.build | 2 +- .../test/backend/data/gn-processor/moz.build | 36 +- .../test/backend/data/host-defines/moz.build | 12 +- .../data/host-rust-library-features/moz.build | 9 +- .../backend/data/host-rust-library/moz.build | 9 +- .../install_substitute_config_files/moz.build | 2 +- .../sub/moz.build | 4 +- .../backend/data/ipdl_sources/bar/moz.build | 6 +- .../backend/data/ipdl_sources/foo/moz.build | 6 +- .../test/backend/data/ipdl_sources/moz.build | 4 +- .../test/backend/data/jar-manifests/moz.build | 3 +- .../test/backend/data/linkage/moz.build | 12 +- .../test/backend/data/linkage/prog/moz.build | 8 +- .../backend/data/linkage/prog/qux/moz.build | 4 +- .../backend/data/linkage/real/foo/moz.build | 7 +- .../test/backend/data/linkage/real/moz.build | 8 +- .../backend/data/linkage/shared/baz/moz.build | 4 +- .../backend/data/linkage/shared/moz.build | 10 +- .../linkage/static/bar/bar_helper/moz.build | 4 +- .../backend/data/linkage/static/bar/moz.build | 8 +- .../backend/data/linkage/static/moz.build | 8 +- .../backend/data/local_includes/moz.build | 2 +- .../backend/data/localized-files/moz.build | 6 +- .../localized-generated-files-AB_CD/moz.build | 30 +- .../localized-generated-files-force/moz.build | 20 +- .../data/localized-generated-files/moz.build | 12 +- .../backend/data/localized-pp-files/moz.build | 4 +- .../data/prog-lib-c-only/c-library/moz.build | 4 +- .../data/prog-lib-c-only/c-program/moz.build | 4 +- .../c-simple-programs/moz.build | 2 +- .../prog-lib-c-only/cxx-library/moz.build | 6 +- .../prog-lib-c-only/cxx-program/moz.build | 4 +- .../cxx-simple-programs/moz.build | 2 +- .../backend/data/prog-lib-c-only/moz.build | 20 +- .../prog-lib-c-only/simple-programs/moz.build | 1 + .../data/program-paths/dist-bin/moz.build | 2 +- .../data/program-paths/dist-subdir/moz.build | 4 +- .../data/program-paths/final-target/moz.build | 4 +- .../test/backend/data/program-paths/moz.build | 10 +- .../program-paths/not-installed/moz.build | 2 +- .../test/backend/data/resources/moz.build | 12 +- .../data/rust-library-features/moz.build | 7 +- .../test/backend/data/rust-library/moz.build | 7 +- .../backend/data/rust-programs/code/moz.build | 4 +- .../test/backend/data/rust-programs/moz.build | 2 +- .../test/backend/data/sources/moz.build | 22 +- .../test/backend/data/stub0/dir1/moz.build | 2 + .../test/backend/data/stub0/dir2/moz.build | 1 + .../test/backend/data/stub0/dir3/moz.build | 1 + .../test/backend/data/stub0/moz.build | 6 +- .../data/substitute_config_files/moz.build | 2 +- .../test-manifest-shared-support/moz.build | 4 +- .../test-manifests-backend-sources/moz.build | 2 +- .../moz.build | 4 +- .../test-manifests-package-tests/moz.build | 4 +- .../data/test-manifests-written/moz.build | 6 +- .../test-support-binaries-tracked/moz.build | 2 +- .../src/moz.build | 6 +- .../test/moz.build | 23 +- .../test/backend/data/test_config/moz.build | 2 +- .../backend/data/variable_passthru/moz.build | 10 +- .../backend/data/visual-studio/dir1/moz.build | 10 +- .../test/backend/data/visual-studio/moz.build | 4 +- .../test/backend/data/xpidl/moz.build | 4 +- .../test/backend/test_configenvironment.py | 53 +- .../mozbuild/test/backend/test_database.py | 20 +- .../mozbuild/test/backend/test_fastermake.py | 23 +- .../test/backend/test_gn_processor.py | 219 +- .../backend/test_partialconfigenvironment.py | 130 +- .../test/backend/test_test_manifest.py | 75 +- .../test/backend/test_visualstudio.py | 55 +- .../test/code_analysis/test_mach_commands.py | 7 +- python/mozbuild/mozbuild/test/common.py | 54 +- .../test/compilation/test_warnings.py | 131 +- .../mozbuild/test/configure/common.py | 119 +- .../test/configure/data/decorators.configure | 17 +- .../test/configure/data/extra.configure | 8 +- .../configure/data/imply_option/imm.configure | 23 +- .../data/imply_option/infer.configure | 16 +- .../data/imply_option/infer_ko.configure | 21 +- .../data/imply_option/negative.configure | 24 +- .../data/imply_option/simple.configure | 16 +- .../data/imply_option/values.configure | 16 +- .../test/configure/data/included.configure | 27 +- .../test/configure/data/moz.configure | 124 +- .../test/configure/data/set_config.configure | 30 +- .../test/configure/data/set_define.configure | 30 +- .../test/configure/data/subprocess.configure | 21 +- .../mozbuild/mozbuild/test/configure/lint.py | 36 +- .../test/configure/test_checks_configure.py | 1150 +- .../test/configure/test_compile_checks.py | 438 +- .../mozbuild/test/configure/test_configure.py | 1660 +-- .../mozbuild/test/configure/test_lint.py | 266 +- .../test/configure/test_moz_configure.py | 149 +- .../mozbuild/test/configure/test_options.py | 1043 +- .../configure/test_toolchain_configure.py | 2630 ++-- .../test/configure/test_toolchain_helpers.py | 498 +- .../configure/test_toolkit_moz_configure.py | 147 +- .../mozbuild/test/configure/test_util.py | 483 +- .../test/controller/test_ccachestats.py | 10 +- .../mozbuild/test/controller/test_clobber.py | 66 +- .../data/allow-compiler-warnings/moz.build | 13 +- .../test/frontend/data/asflags/moz.build | 13 +- .../frontend/data/branding-files/moz.build | 9 +- .../frontend/data/compile-defines/moz.build | 12 +- .../compile-flags-field-validation/moz.build | 10 +- .../data/compile-flags-templates/moz.build | 15 +- .../compile-flags-type-validation/moz.build | 10 +- .../frontend/data/compile-flags/moz.build | 16 +- .../frontend/data/compile-includes/moz.build | 10 +- .../data/config-file-substitution/moz.build | 4 +- .../moz.build | 7 +- .../test/frontend/data/defines/moz.build | 12 +- .../data/disable-compiler-warnings/moz.build | 11 +- .../data/disable-stl-wrapping/moz.build | 12 +- .../data/dist-files-missing/moz.build | 4 +- .../test/frontend/data/dist-files/moz.build | 4 +- .../frontend/data/exports-generated/moz.build | 8 +- .../data/exports-missing-generated/moz.build | 4 +- .../frontend/data/exports-missing/moz.build | 6 +- .../test/frontend/data/exports/moz.build | 20 +- .../bug_component/bad-assignment/moz.build | 4 +- .../different-matchers/moz.build | 8 +- .../files-info/bug_component/final/moz.build | 4 +- .../final/subcomponent/moz.build | 4 +- .../data/files-info/bug_component/moz.build | 4 +- .../files-info/bug_component/simple/moz.build | 4 +- .../files-info/bug_component/static/moz.build | 8 +- .../moz.build | 2 +- .../generated-files-absolute-script/moz.build | 6 +- .../data/generated-files-force/moz.build | 10 +- .../generated-files-method-names/moz.build | 10 +- .../data/generated-files-no-inputs/moz.build | 8 +- .../moz.build | 6 +- .../data/generated-files-no-script/moz.build | 6 +- .../frontend/data/generated-files/moz.build | 6 +- .../frontend/data/generated-sources/moz.build | 24 +- .../data/generated_includes/moz.build | 2 +- .../data/host-compile-flags/moz.build | 22 +- .../host-program-paths/final-target/moz.build | 4 +- .../host-program-paths/installed/moz.build | 2 +- .../data/host-program-paths/moz.build | 8 +- .../not-installed/moz.build | 2 +- .../data/host-rust-libraries/moz.build | 9 +- .../host-rust-program-no-cargo-toml/moz.build | 2 +- .../moz.build | 2 +- .../data/host-rust-programs/moz.build | 2 +- .../test/frontend/data/host-sources/moz.build | 18 +- .../data/include-basic/included.build | 2 +- .../frontend/data/include-basic/moz.build | 4 +- .../data/include-file-stack/included-1.build | 2 +- .../data/include-file-stack/moz.build | 2 +- .../frontend/data/include-missing/moz.build | 2 +- .../include-outside-topsrcdir/relative.build | 2 +- .../child/child.build | 2 +- .../child/child2.build | 2 +- .../child/grandchild/grandchild.build | 2 +- .../include-relative-from-child/parent.build | 2 +- .../data/include-topsrcdir-relative/moz.build | 2 +- .../include-topsrcdir-relative/sibling.build | 2 +- .../inheriting-variables/foo/baz/moz.build | 2 +- .../data/inheriting-variables/foo/moz.build | 2 +- .../data/inheriting-variables/moz.build | 4 +- .../frontend/data/ipdl_sources/bar/moz.build | 6 +- .../frontend/data/ipdl_sources/foo/moz.build | 6 +- .../test/frontend/data/ipdl_sources/moz.build | 4 +- .../jar-manifests-multiple-files/moz.build | 3 +- .../frontend/data/jar-manifests/moz.build | 2 +- .../data/library-defines/liba/moz.build | 4 +- .../data/library-defines/libb/moz.build | 8 +- .../data/library-defines/libc/moz.build | 4 +- .../data/library-defines/libd/moz.build | 2 +- .../frontend/data/library-defines/moz.build | 6 +- .../test/frontend/data/link-flags/moz.build | 12 +- .../data/local_includes-filename/moz.build | 2 +- .../local_includes-invalid/objdir/moz.build | 2 +- .../local_includes-invalid/srcdir/moz.build | 2 +- .../frontend/data/local_includes/moz.build | 2 +- .../localized-files-from-generated/moz.build | 4 +- .../data/localized-files-no-en-us/moz.build | 6 +- .../moz.build | 4 +- .../frontend/data/localized-files/moz.build | 6 +- .../moz.build | 4 +- .../localized-generated-files-force/moz.build | 4 +- .../data/localized-generated-files/moz.build | 2 +- .../data/localized-pp-files/moz.build | 4 +- .../data/missing-local-includes/moz.build | 2 +- .../frontend/data/missing-xpidl/moz.build | 4 +- .../data/multiple-rust-libraries/moz.build | 16 +- .../multiple-rust-libraries/rust1/moz.build | 2 +- .../multiple-rust-libraries/rust2/moz.build | 2 +- .../data/program-paths/dist-bin/moz.build | 2 +- .../data/program-paths/dist-subdir/moz.build | 4 +- .../data/program-paths/final-target/moz.build | 4 +- .../frontend/data/program-paths/moz.build | 10 +- .../program-paths/not-installed/moz.build | 2 +- .../test/frontend/data/program/moz.build | 10 +- .../data/reader-error-bad-dir/moz.build | 2 +- .../data/reader-error-error-func/moz.build | 3 +- .../data/reader-error-included-from/moz.build | 2 +- .../reader-error-missing-include/moz.build | 2 +- .../reader-error-outside-topsrcdir/moz.build | 2 +- .../data/reader-error-repeated-dir/moz.build | 4 +- .../reader-error-write-bad-value/moz.build | 2 +- .../moz.build | 4 +- .../data/resolved-flags-error/moz.build | 14 +- .../data/rust-library-dash-folding/moz.build | 7 +- .../rust-library-duplicate-features/moz.build | 7 +- .../data/rust-library-features/moz.build | 7 +- .../rust-library-invalid-crate-type/moz.build | 7 +- .../data/rust-library-name-mismatch/moz.build | 7 +- .../data/rust-library-no-cargo-toml/moz.build | 7 +- .../rust-library-no-lib-section/moz.build | 7 +- .../data/rust-program-no-cargo-toml/moz.build | 2 +- .../rust-program-nonexistent-name/moz.build | 2 +- .../frontend/data/rust-programs/moz.build | 2 +- .../test/frontend/data/schedules/moz.build | 20 +- .../frontend/data/schedules/subd/moz.build | 8 +- .../frontend/data/sources-just-c/moz.build | 16 +- .../test/frontend/data/sources/moz.build | 24 +- .../data/test-install-shared-lib/moz.build | 8 +- .../data/test-linkables-cxx-link/moz.build | 9 +- .../test-linkables-cxx-link/one/moz.build | 6 +- .../test-linkables-cxx-link/three/moz.build | 4 +- .../test-linkables-cxx-link/two/moz.build | 6 +- .../test-manifest-absolute-support/moz.build | 2 +- .../data/test-manifest-dupes/moz.build | 2 +- .../test-manifest-emitted-includes/moz.build | 2 +- .../data/test-manifest-empty/moz.build | 2 +- .../test-manifest-install-includes/moz.build | 2 +- .../data/test-manifest-just-support/moz.build | 2 +- .../test-manifest-keys-extracted/moz.build | 18 +- .../test-manifest-missing-manifest/moz.build | 2 +- .../moz.build | 2 +- .../test-manifest-missing-test-file/moz.build | 2 +- .../moz.build | 2 +- .../test-manifest-shared-missing/moz.build | 4 +- .../test-manifest-shared-support/moz.build | 4 +- .../moz.build | 2 +- .../moz.build | 6 +- .../data/test-symbols-file-objdir/moz.build | 10 +- .../frontend/data/test-symbols-file/moz.build | 6 +- .../data/traversal-all-vars/moz.build | 4 +- .../traversal-outside-topsrcdir/moz.build | 2 +- .../traversal-relative-dirs/foo/moz.build | 2 +- .../data/traversal-relative-dirs/moz.build | 2 +- .../traversal-repeated-dirs/bar/moz.build | 2 +- .../traversal-repeated-dirs/foo/moz.build | 2 +- .../data/traversal-repeated-dirs/moz.build | 2 +- .../data/traversal-simple/foo/moz.build | 2 +- .../frontend/data/traversal-simple/moz.build | 2 +- .../unified-sources-non-unified/moz.build | 20 +- .../frontend/data/unified-sources/moz.build | 20 +- .../test/frontend/data/use-yasm/moz.build | 6 +- .../frontend/data/variable-passthru/moz.build | 10 +- .../frontend/data/visibility-flags/moz.build | 12 +- .../data/wasm-compile-flags/moz.build | 18 +- .../test/frontend/data/wasm-sources/moz.build | 10 +- .../data/xpidl-module-no-sources/moz.build | 2 +- .../mozbuild/test/frontend/test_context.py | 552 +- .../mozbuild/test/frontend/test_emitter.py | 1566 +-- .../mozbuild/test/frontend/test_namespaces.py | 138 +- .../mozbuild/test/frontend/test_reader.py | 471 +- .../mozbuild/test/frontend/test_sandbox.py | 370 +- .../test/test_android_version_code.py | 105 +- .../mozbuild/test/test_artifact_cache.py | 39 +- python/mozbuild/mozbuild/test/test_base.py | 274 +- .../mozbuild/mozbuild/test/test_containers.py | 88 +- .../mozbuild/test/test_dotproperties.py | 141 +- .../mozbuild/mozbuild/test/test_expression.py | 43 +- .../mozbuild/mozbuild/test/test_jarmaker.py | 384 +- .../mozbuild/mozbuild/test/test_licenses.py | 20 +- .../mozbuild/test/test_line_endings.py | 20 +- .../mozbuild/mozbuild/test/test_makeutil.py | 167 +- .../mozbuild/mozbuild/test/test_manifest.py | 54 +- .../mozbuild/mozbuild/test/test_mozconfig.py | 228 +- python/mozbuild/mozbuild/test/test_mozinfo.py | 349 +- .../mozbuild/test/test_preprocessor.py | 1131 +- .../mozbuild/mozbuild/test/test_pythonutil.py | 12 +- python/mozbuild/mozbuild/test/test_util.py | 473 +- .../mozbuild/test/test_util_fileavoidwrite.py | 1 - python/mozbuild/mozbuild/testing.py | 129 +- python/mozbuild/mozbuild/util.py | 415 +- .../mozbuild/mozbuild/vendor/mach_commands.py | 2 +- .../mozbuild/vendor/vendor_manifest.py | 9 +- .../mozbuild/mozbuild/vendor/vendor_python.py | 12 +- .../mozbuild/mozbuild/vendor/vendor_rust.py | 21 +- python/mozbuild/mozbuild/virtualenv.py | 347 +- python/mozbuild/mozpack/archive.py | 26 +- python/mozbuild/mozpack/chrome/flags.py | 181 +- python/mozbuild/mozpack/chrome/manifest.py | 213 +- python/mozbuild/mozpack/copier.py | 191 +- python/mozbuild/mozpack/dmg.py | 188 +- python/mozbuild/mozpack/errors.py | 13 +- python/mozbuild/mozpack/executables.py | 111 +- python/mozbuild/mozpack/files.py | 449 +- python/mozbuild/mozpack/manifests.py | 149 +- python/mozbuild/mozpack/mozjar.py | 483 +- python/mozbuild/mozpack/packager/__init__.py | 212 +- python/mozbuild/mozpack/packager/formats.py | 155 +- python/mozbuild/mozpack/packager/l10n.py | 75 +- python/mozbuild/mozpack/packager/unpack.py | 87 +- python/mozbuild/mozpack/path.py | 89 +- .../mozpack/test/support/minify_js_verify.py | 4 +- python/mozbuild/mozpack/test/test_archive.py | 112 +- .../mozpack/test/test_chrome_flags.py | 215 +- .../mozpack/test/test_chrome_manifest.py | 209 +- python/mozbuild/mozpack/test/test_copier.py | 430 +- python/mozbuild/mozpack/test/test_errors.py | 77 +- python/mozbuild/mozpack/test/test_files.py | 1038 +- .../mozbuild/mozpack/test/test_manifests.py | 335 +- python/mozbuild/mozpack/test/test_mozjar.py | 320 +- python/mozbuild/mozpack/test/test_packager.py | 685 +- .../mozpack/test/test_packager_formats.py | 629 +- .../mozpack/test/test_packager_l10n.py | 200 +- .../mozpack/test/test_packager_unpack.py | 20 +- python/mozbuild/mozpack/test/test_path.py | 161 +- python/mozbuild/setup.py | 28 +- python/mozlint/mozlint/cli.py | 330 +- python/mozlint/mozlint/editor.py | 30 +- python/mozlint/mozlint/errors.py | 6 +- python/mozlint/mozlint/formatters/__init__.py | 12 +- python/mozlint/mozlint/formatters/compact.py | 9 +- python/mozlint/mozlint/formatters/summary.py | 29 +- .../mozlint/mozlint/formatters/treeherder.py | 5 +- python/mozlint/mozlint/formatters/unix.py | 3 +- python/mozlint/mozlint/parser.py | 93 +- python/mozlint/mozlint/pathutils.py | 49 +- python/mozlint/mozlint/result.py | 3 +- python/mozlint/mozlint/roller.py | 116 +- python/mozlint/mozlint/types.py | 60 +- python/mozlint/mozlint/util/implementation.py | 5 +- python/mozlint/mozlint/util/pip.py | 10 +- python/mozlint/mozlint/util/string.py | 4 +- python/mozlint/setup.py | 24 +- python/mozlint/test/conftest.py | 41 +- python/mozlint/test/linters/external.py | 32 +- python/mozlint/test/linters/global_payload.py | 17 +- python/mozlint/test/runcli.py | 6 +- python/mozlint/test/test_cli.py | 55 +- python/mozlint/test/test_editor.py | 54 +- python/mozlint/test/test_formatters.py | 4 +- python/mozlint/test/test_parser.py | 64 +- python/mozlint/test/test_pathutils.py | 200 +- python/mozlint/test/test_result.py | 12 +- python/mozlint/test/test_roller.py | 150 +- python/mozlint/test/test_types.py | 37 +- python/mozrelease/mozrelease/balrog.py | 61 +- .../mozrelease/mozrelease/buglist_creator.py | 162 +- python/mozrelease/mozrelease/chunking.py | 5 +- python/mozrelease/mozrelease/mach_commands.py | 110 +- .../mozrelease/mozrelease/partner_repack.py | 559 +- python/mozrelease/mozrelease/paths.py | 55 +- python/mozrelease/mozrelease/platforms.py | 15 +- python/mozrelease/mozrelease/update_verify.py | 180 +- python/mozrelease/mozrelease/util.py | 4 +- python/mozrelease/mozrelease/versions.py | 77 +- python/mozrelease/setup.py | 24 +- python/mozrelease/test/test_balrog.py | 49 +- .../mozrelease/test/test_buglist_creator.py | 199 +- python/mozrelease/test/test_update_verify.py | 312 +- python/mozrelease/test/test_versions.py | 118 +- python/mozterm/mozterm/terminal.py | 6 +- python/mozterm/mozterm/widgets.py | 6 +- python/mozterm/setup.py | 34 +- python/mozterm/test/test_terminal.py | 8 +- python/mozterm/test/test_widgets.py | 20 +- .../mozversioncontrol/__init__.py | 324 +- .../mozversioncontrol/repoupdate.py | 22 +- python/mozversioncontrol/setup.py | 30 +- python/mozversioncontrol/test/conftest.py | 14 +- python/mozversioncontrol/test/test_commit.py | 40 +- .../test/test_context_manager.py | 6 +- .../test/test_push_to_try.py | 41 +- .../test/test_workdir_outgoing.py | 66 +- .../test/test_working_directory.py | 10 +- remote/mach_commands.py | 315 +- remote/moz.build | 4 +- security/apps/gen_cert_header.py | 15 +- security/apps/moz.build | 47 +- security/certverifier/moz.build | 46 +- security/certverifier/tests/gtest/moz.build | 10 +- security/ct/moz.build | 56 +- security/ct/tests/gtest/createSTHTestData.py | 46 +- security/ct/tests/gtest/moz.build | 74 +- security/generate_certdata.py | 9 +- security/generate_mapfile.py | 27 +- security/manager/locales/moz.build | 2 +- security/manager/moz.build | 6 +- security/manager/pki/moz.build | 20 +- security/manager/pki/resources/moz.build | 2 +- security/manager/ssl/moz.build | 316 +- .../osclientcerts/dynamic-library/moz.build | 24 +- security/manager/ssl/osclientcerts/moz.build | 4 +- security/manager/ssl/tests/gtest/moz.build | 30 +- .../ssl/tests/mochitest/browser/moz.build | 8 +- .../tests/mochitest/mixedcontent/moz.build | 3 +- .../manager/ssl/tests/mochitest/moz.build | 6 +- .../stricttransportsecurity/moz.build | 5 +- security/manager/ssl/tests/moz.build | 12 +- .../ssl/tests/unit/bad_certs/moz.build | 12 +- security/manager/ssl/tests/unit/moz.build | 62 +- .../ssl/tests/unit/ocsp_certs/moz.build | 12 +- .../ssl/tests/unit/pkcs11testmodule/moz.build | 8 +- security/manager/ssl/tests/unit/pycert.py | 379 +- security/manager/ssl/tests/unit/pycms.py | 122 +- security/manager/ssl/tests/unit/pyct.py | 32 +- security/manager/ssl/tests/unit/pykey.py | 922 +- security/manager/ssl/tests/unit/sign_app.py | 258 +- .../unit/test_baseline_requirements/moz.build | 6 +- .../tests/unit/test_certDB_import/moz.build | 6 +- .../ssl/tests/unit/test_cert_eku/moz.build | 6 +- .../unit/test_cert_embedded_null/moz.build | 6 +- .../tests/unit/test_cert_keyUsage/moz.build | 6 +- .../ssl/tests/unit/test_cert_sha1/moz.build | 6 +- .../tests/unit/test_cert_signatures/moz.build | 6 +- .../ssl/tests/unit/test_cert_trust/moz.build | 6 +- .../ssl/tests/unit/test_cert_utf8/moz.build | 6 +- .../tests/unit/test_cert_version/generate.py | 75 +- .../tests/unit/test_cert_version/moz.build | 6 +- .../tests/unit/test_content_signing/moz.build | 6 +- .../tests/unit/test_content_signing/pysign.py | 6 +- .../manager/ssl/tests/unit/test_ct/moz.build | 12 +- .../unit/test_delegated_credentials/moz.build | 12 +- .../ssl/tests/unit/test_ev_certs/moz.build | 12 +- .../moz.build | 6 +- .../unit/test_intermediate_preloads/moz.build | 12 +- .../ssl/tests/unit/test_keysize/moz.build | 6 +- .../ssl/tests/unit/test_keysize_ev/moz.build | 12 +- .../unit/test_missing_intermediate/moz.build | 6 +- .../unit/test_name_constraints/moz.build | 6 +- .../ssl/tests/unit/test_ocsp_url/moz.build | 12 +- .../ssl/tests/unit/test_onecrl/moz.build | 6 +- .../ssl/tests/unit/test_sanctions/moz.build | 6 +- .../ssl/tests/unit/test_signed_apps/moz.build | 35 +- .../tests/unit/test_startcom_wosign/moz.build | 6 +- .../ssl/tests/unit/test_validity/moz.build | 12 +- .../ssl/tests/unit/tlsserver/cmd/moz.build | 29 +- .../ssl/tests/unit/tlsserver/lib/moz.build | 8 +- .../ssl/tests/unit/tlsserver/moz.build | 2 +- .../crtshToIdentifyingStruct.py | 55 +- security/manager/tools/getCTKnownLogs.py | 125 +- security/moz.build | 163 +- security/sandbox/common/moz.build | 34 +- security/sandbox/linux/broker/moz.build | 28 +- security/sandbox/linux/glue/moz.build | 24 +- security/sandbox/linux/gtest/moz.build | 16 +- security/sandbox/linux/interfaces/moz.build | 4 +- security/sandbox/linux/launch/moz.build | 18 +- security/sandbox/linux/moz.build | 188 +- security/sandbox/linux/reporter/moz.build | 18 +- security/sandbox/mac/moz.build | 16 +- security/sandbox/moz.build | 335 +- security/sandbox/test/mac_register_font.py | 58 +- .../win/src/remotesandboxbroker/moz.build | 32 +- .../sandbox/win/src/sandboxbroker/moz.build | 12 +- .../win/src/sandboxpermissions/moz.build | 10 +- .../sandbox/win/src/sandboxtarget/moz.build | 12 +- services/automation/moz.build | 10 +- services/common/moz.build | 46 +- services/common/tests/moz.build | 6 +- services/crypto/component/moz.build | 10 +- services/crypto/moz.build | 18 +- services/fxaccounts/moz.build | 52 +- services/fxaccounts/rust-bridge/moz.build | 8 +- services/interfaces/moz.build | 14 +- services/moz.build | 26 +- services/settings/dumps/blocklists/moz.build | 24 +- services/settings/dumps/main/moz.build | 26 +- services/settings/dumps/moz.build | 8 +- services/settings/dumps/pinning/moz.build | 6 +- .../settings/dumps/security-state/moz.build | 10 +- services/settings/moz.build | 36 +- services/settings/test/moz.build | 4 +- services/settings/test/unit/moz.build | 4 +- .../test_remote_settings_signatures/moz.build | 6 +- services/sync/locales/moz.build | 2 +- services/sync/moz.build | 92 +- .../style/counter_style/update_predefined.py | 8 +- servo/components/style/gecko/regen_atoms.py | 80 +- servo/components/style/properties/build.py | 47 +- servo/components/style/properties/data.py | 390 +- startupcache/moz.build | 22 +- startupcache/test/moz.build | 4 +- storage/build/moz.build | 8 +- storage/moz.build | 122 +- storage/test/gtest/moz.build | 36 +- storage/test/moz.build | 5 +- .../extract_locales_from_l10n_json.py | 4 +- .../extract_locales_from_l10n_json.py | 4 +- .../visual-metrics/run-visual-metrics.py | 47 +- .../docker/visual-metrics/similarity.py | 39 +- taskcluster/mach_commands.py | 646 +- taskcluster/moz.build | 16 +- taskcluster/scripts/misc/fetch-chromium.py | 157 +- taskcluster/scripts/misc/repack_rust.py | 384 +- taskcluster/scripts/misc/verify-updatebot.py | 77 +- taskcluster/taskgraph/__init__.py | 2 +- taskcluster/taskgraph/actions/__init__.py | 10 +- taskcluster/taskgraph/actions/add_new_jobs.py | 49 +- taskcluster/taskgraph/actions/add_talos.py | 47 +- taskcluster/taskgraph/actions/backfill.py | 232 +- taskcluster/taskgraph/actions/cancel.py | 16 +- taskcluster/taskgraph/actions/cancel_all.py | 27 +- .../taskgraph/actions/create_interactive.py | 139 +- .../taskgraph/actions/gecko_profile.py | 94 +- taskcluster/taskgraph/actions/isolate_test.py | 185 +- .../taskgraph/actions/merge_automation.py | 6 +- taskcluster/taskgraph/actions/openh264.py | 17 +- taskcluster/taskgraph/actions/purge_caches.py | 22 +- taskcluster/taskgraph/actions/registry.py | 199 +- .../taskgraph/actions/release_promotion.py | 425 +- taskcluster/taskgraph/actions/retrigger.py | 216 +- .../taskgraph/actions/retrigger_custom.py | 207 +- .../taskgraph/actions/run_missing_tests.py | 18 +- taskcluster/taskgraph/actions/util.py | 216 +- taskcluster/taskgraph/config.py | 225 +- taskcluster/taskgraph/create.py | 30 +- taskcluster/taskgraph/decision.py | 458 +- taskcluster/taskgraph/docker.py | 91 +- taskcluster/taskgraph/files_changed.py | 46 +- taskcluster/taskgraph/filter_tasks.py | 10 +- taskcluster/taskgraph/generator.py | 220 +- taskcluster/taskgraph/graph.py | 16 +- taskcluster/taskgraph/loader/multi_dep.py | 140 +- taskcluster/taskgraph/loader/single_dep.py | 28 +- taskcluster/taskgraph/loader/test.py | 92 +- taskcluster/taskgraph/loader/transform.py | 15 +- taskcluster/taskgraph/morph.py | 25 +- taskcluster/taskgraph/optimize/__init__.py | 332 +- taskcluster/taskgraph/optimize/backstop.py | 2 - taskcluster/taskgraph/optimize/bugbug.py | 59 +- taskcluster/taskgraph/optimize/schema.py | 26 +- taskcluster/taskgraph/optimize/strategies.py | 32 +- taskcluster/taskgraph/parameters.py | 247 +- taskcluster/taskgraph/target_tasks.py | 806 +- taskcluster/taskgraph/task.py | 50 +- taskcluster/taskgraph/taskgraph.py | 8 +- .../taskgraph/test/test_actions_util.py | 99 +- taskcluster/taskgraph/test/test_create.py | 48 +- taskcluster/taskgraph/test/test_decision.py | 135 +- .../taskgraph/test/test_files_changed.py | 46 +- taskcluster/taskgraph/test/test_generator.py | 215 +- taskcluster/taskgraph/test/test_graph.py | 209 +- taskcluster/taskgraph/test/test_morph.py | 64 +- taskcluster/taskgraph/test/test_optimize.py | 248 +- .../test/test_optimize_strategies.py | 519 +- taskcluster/taskgraph/test/test_parameters.py | 129 +- .../taskgraph/test/test_target_tasks.py | 136 +- .../taskgraph/test/test_taskcluster_yml.py | 1 + taskcluster/taskgraph/test/test_taskgraph.py | 161 +- .../taskgraph/test/test_transforms_base.py | 24 +- .../taskgraph/test/test_transforms_job.py | 48 +- .../taskgraph/test/test_try_option_syntax.py | 381 +- .../taskgraph/test/test_util_attributes.py | 93 +- .../taskgraph/test/test_util_backstop.py | 28 +- .../taskgraph/test/test_util_bugbug.py | 6 +- .../taskgraph/test/test_util_chunking.py | 350 +- .../taskgraph/test/test_util_docker.py | 182 +- .../test/test_util_parameterization.py | 154 +- .../taskgraph/test/test_util_python_path.py | 18 +- .../taskgraph/test/test_util_runnable_jobs.py | 77 +- .../taskgraph/test/test_util_schema.py | 164 +- .../taskgraph/test/test_util_taskcluster.py | 9 +- .../taskgraph/test/test_util_templates.py | 71 +- taskcluster/taskgraph/test/test_util_time.py | 37 +- .../taskgraph/test/test_util_treeherder.py | 15 +- .../taskgraph/test/test_util_verify.py | 69 +- taskcluster/taskgraph/test/test_util_yaml.py | 10 +- .../taskgraph/transforms/balrog_submit.py | 134 +- .../taskgraph/transforms/balrog_toplevel.py | 31 +- taskcluster/taskgraph/transforms/base.py | 14 +- taskcluster/taskgraph/transforms/beetmover.py | 144 +- .../transforms/beetmover_checksums.py | 110 +- .../transforms/beetmover_emefree_checksums.py | 88 +- .../transforms/beetmover_geckoview.py | 129 +- .../beetmover_langpack_checksums.py | 94 +- .../transforms/beetmover_push_to_release.py | 87 +- .../transforms/beetmover_repackage.py | 225 +- .../transforms/beetmover_repackage_l10n.py | 24 +- .../transforms/beetmover_repackage_partner.py | 269 +- .../taskgraph/transforms/beetmover_snap.py | 15 +- .../taskgraph/transforms/beetmover_source.py | 12 +- .../transforms/beetmover_source_checksums.py | 105 +- .../taskgraph/transforms/bouncer_check.py | 53 +- .../taskgraph/transforms/bouncer_locations.py | 13 +- .../transforms/bouncer_submission.py | 292 +- .../transforms/bouncer_submission_partners.py | 127 +- taskcluster/taskgraph/transforms/build.py | 146 +- .../taskgraph/transforms/build_attrs.py | 29 +- .../taskgraph/transforms/build_fat_aar.py | 54 +- .../taskgraph/transforms/build_lints.py | 25 +- .../taskgraph/transforms/build_signing.py | 50 +- .../taskgraph/transforms/cached_tasks.py | 49 +- .../taskgraph/transforms/chunk_partners.py | 34 +- .../taskgraph/transforms/code_review.py | 12 +- .../copy_attributes_from_dependent_task.py | 6 +- .../taskgraph/transforms/diffoscope.py | 224 +- .../taskgraph/transforms/docker_image.py | 242 +- taskcluster/taskgraph/transforms/fetch.py | 435 +- .../taskgraph/transforms/final_verify.py | 16 +- .../transforms/geckodriver_signing.py | 126 +- .../taskgraph/transforms/github_sync.py | 15 +- taskcluster/taskgraph/transforms/iris.py | 74 +- .../taskgraph/transforms/job/__init__.py | 369 +- .../taskgraph/transforms/job/common.py | 211 +- .../transforms/job/debian_package.py | 265 +- .../taskgraph/transforms/job/hazard.py | 68 +- taskcluster/taskgraph/transforms/job/mach.py | 80 +- .../taskgraph/transforms/job/mozharness.py | 471 +- .../transforms/job/mozharness_test.py | 525 +- .../taskgraph/transforms/job/python_test.py | 47 +- .../taskgraph/transforms/job/run_task.py | 297 +- .../taskgraph/transforms/job/spidermonkey.py | 136 +- .../taskgraph/transforms/job/toolchain.py | 255 +- taskcluster/taskgraph/transforms/l10n.py | 468 +- .../transforms/mac_notarization_poller.py | 96 +- .../taskgraph/transforms/maybe_release.py | 8 +- .../taskgraph/transforms/merge_automation.py | 10 +- .../taskgraph/transforms/name_sanity.py | 30 +- taskcluster/taskgraph/transforms/openh264.py | 14 +- .../taskgraph/transforms/openh264_signing.py | 89 +- taskcluster/taskgraph/transforms/partials.py | 160 +- .../transforms/partner_attribution.py | 24 +- .../partner_attribution_beetmover.py | 6 +- .../taskgraph/transforms/partner_repack.py | 57 +- .../taskgraph/transforms/partner_signing.py | 43 +- .../transforms/per_platform_dummy.py | 14 +- taskcluster/taskgraph/transforms/perftest.py | 146 +- .../taskgraph/transforms/python_update.py | 4 +- taskcluster/taskgraph/transforms/raptor.py | 363 +- taskcluster/taskgraph/transforms/release.py | 4 +- .../release_beetmover_signed_addons.py | 201 +- .../taskgraph/transforms/release_deps.py | 36 +- .../transforms/release_flatpak_push.py | 71 +- .../transforms/release_flatpak_repackage.py | 25 +- .../transforms/release_generate_checksums.py | 16 +- .../release_generate_checksums_beetmover.py | 96 +- .../release_generate_checksums_signing.py | 83 +- .../transforms/release_mark_as_shipped.py | 22 +- .../transforms/release_notifications.py | 33 +- .../release_sign_and_push_langpacks.py | 137 +- .../taskgraph/transforms/release_snap_push.py | 75 +- .../transforms/release_snap_repackage.py | 20 +- .../taskgraph/transforms/release_started.py | 40 +- .../transforms/release_version_bump.py | 21 +- taskcluster/taskgraph/transforms/repackage.py | 486 +- .../taskgraph/transforms/repackage_l10n.py | 10 +- .../taskgraph/transforms/repackage_partner.py | 301 +- .../taskgraph/transforms/repackage_routes.py | 30 +- .../taskgraph/transforms/repackage_signing.py | 106 +- .../taskgraph/transforms/repo_update.py | 4 +- .../transforms/reverse_chunk_deps.py | 13 +- .../taskgraph/transforms/run_pgo_profile.py | 23 +- .../taskgraph/transforms/scriptworker.py | 6 +- .../transforms/shippable_l10n_signing.py | 72 +- taskcluster/taskgraph/transforms/signing.py | 286 +- .../transforms/source_checksums_signing.py | 83 +- .../taskgraph/transforms/source_test.py | 193 +- .../taskgraph/transforms/spidermonkey.py | 6 +- .../transforms/strip_dependent_task.py | 2 +- taskcluster/taskgraph/transforms/task.py | 2540 ++-- taskcluster/taskgraph/transforms/tests.py | 2135 +-- taskcluster/taskgraph/transforms/try_job.py | 2 +- .../taskgraph/transforms/update_verify.py | 37 +- .../transforms/update_verify_config.py | 54 +- .../transforms/upload_generated_sources.py | 34 +- .../taskgraph/transforms/upload_symbols.py | 66 +- .../transforms/upstream_artifact_task.py | 17 +- .../taskgraph/transforms/visual_metrics.py | 7 +- .../transforms/visual_metrics_dep.py | 28 +- taskcluster/taskgraph/try_option_syntax.py | 588 +- taskcluster/taskgraph/util/attributes.py | 96 +- taskcluster/taskgraph/util/backstop.py | 6 +- taskcluster/taskgraph/util/bugbug.py | 26 +- taskcluster/taskgraph/util/cached_tasks.py | 56 +- taskcluster/taskgraph/util/chunking.py | 115 +- .../taskgraph/util/declarative_artifacts.py | 63 +- taskcluster/taskgraph/util/docker.py | 169 +- taskcluster/taskgraph/util/hash.py | 18 +- taskcluster/taskgraph/util/hg.py | 48 +- taskcluster/taskgraph/util/keyed_by.py | 24 +- .../taskgraph/util/parameterization.py | 50 +- taskcluster/taskgraph/util/partials.py | 162 +- taskcluster/taskgraph/util/partners.py | 293 +- taskcluster/taskgraph/util/perfile.py | 58 +- taskcluster/taskgraph/util/platforms.py | 34 +- taskcluster/taskgraph/util/python_path.py | 21 +- taskcluster/taskgraph/util/schema.py | 39 +- taskcluster/taskgraph/util/scriptworker.py | 627 +- .../taskgraph/util/signed_artifacts.py | 189 +- taskcluster/taskgraph/util/taskcluster.py | 183 +- taskcluster/taskgraph/util/taskgraph.py | 13 +- taskcluster/taskgraph/util/templates.py | 15 +- taskcluster/taskgraph/util/time.py | 37 +- taskcluster/taskgraph/util/treeherder.py | 37 +- taskcluster/taskgraph/util/verify.py | 220 +- taskcluster/taskgraph/util/workertypes.py | 68 +- taskcluster/taskgraph/util/yaml.py | 4 +- testing/awsy/awsy/__init__.py | 14 +- testing/awsy/awsy/awsy_test_case.py | 73 +- testing/awsy/awsy/parse_about_memory.py | 48 +- testing/awsy/awsy/process_perf_data.py | 156 +- testing/awsy/awsy/test_base_memory_usage.py | 46 +- testing/awsy/awsy/test_memory_usage.py | 88 +- testing/awsy/awsy/webservers.py | 38 +- testing/awsy/mach_commands.py | 343 +- testing/awsy/setup.py | 25 +- testing/condprofile/mach_commands.py | 13 +- testing/condprofile/moz.build | 2 +- testing/crashtest/moz.build | 2 +- .../harness/firefox_ui_harness/__init__.py | 2 +- .../firefox_ui_harness/arguments/base.py | 3 +- .../firefox_ui_harness/cli_functional.py | 11 +- .../firefox_ui_harness/runners/base.py | 21 +- testing/firefox-ui/harness/setup.py | 44 +- testing/firefox-ui/mach_commands.py | 78 +- .../safebrowsing/test_initial_download.py | 99 +- .../safebrowsing/test_notification.py | 67 +- .../safebrowsing/test_warning_pages.py | 59 +- .../security/test_ssl_status_after_restart.py | 31 +- .../sessionstore/session_store_test_case.py | 254 +- ..._restore_windows_after_restart_and_quit.py | 87 +- ..._restore_windows_after_windows_shutdown.py | 17 +- testing/geckodriver/mach_commands.py | 115 +- testing/geckodriver/moz.build | 1 + testing/gtest/bench.py | 19 +- testing/gtest/benchmark/moz.build | 6 +- testing/gtest/mach_test_package_commands.py | 89 +- testing/gtest/moz.build | 112 +- testing/gtest/mozilla/moz.build | 14 +- testing/gtest/remotegtests.py | 274 +- testing/gtest/rungtests.py | 131 +- testing/jsshell/benchmark.py | 174 +- testing/mach_commands.py | 890 +- testing/marionette/client/docs/conf.py | 57 +- .../client/marionette_driver/__init__.py | 2 +- .../client/marionette_driver/addons.py | 7 +- .../marionette_driver/date_time_value.py | 8 +- .../client/marionette_driver/decorators.py | 7 +- .../client/marionette_driver/errors.py | 21 +- .../client/marionette_driver/geckoinstance.py | 162 +- .../client/marionette_driver/gestures.py | 66 +- .../client/marionette_driver/keys.py | 126 +- .../marionette_driver/legacy_actions.py | 114 +- .../client/marionette_driver/localization.py | 8 +- .../client/marionette_driver/marionette.py | 411 +- .../client/marionette_driver/transport.py | 26 +- .../client/marionette_driver/wait.py | 20 +- testing/marionette/client/setup.py | 66 +- .../harness/marionette_harness/__init__.py | 2 +- .../marionette_test/__init__.py | 2 +- .../marionette_test/decorators.py | 43 +- .../marionette_test/testcases.py | 152 +- .../marionette_harness/runner/__init__.py | 4 +- .../harness/marionette_harness/runner/base.py | 912 +- .../marionette_harness/runner/httpd.py | 97 +- .../runner/mixins/__init__.py | 4 +- .../runner/mixins/window_manager.py | 61 +- .../marionette_harness/runner/serve.py | 48 +- .../harness/marionette_harness/runtests.py | 56 +- .../tests/harness_unit/conftest.py | 113 +- .../tests/harness_unit/test_httpd.py | 2 +- .../harness_unit/test_marionette_arguments.py | 53 +- .../harness_unit/test_marionette_harness.py | 33 +- .../harness_unit/test_marionette_runner.py | 315 +- .../test_marionette_test_result.py | 19 +- .../tests/harness_unit/test_serve.py | 2 +- .../tests/unit/test_accessibility.py | 147 +- .../tests/unit/test_addons.py | 23 +- .../tests/unit/test_capabilities.py | 90 +- .../tests/unit/test_checkbox_chrome.py | 5 +- .../tests/unit/test_chrome.py | 9 +- .../tests/unit/test_chrome_element_css.py | 10 +- .../tests/unit/test_cli_arguments.py | 7 +- .../tests/unit/test_click.py | 205 +- .../tests/unit/test_click_chrome.py | 5 +- .../tests/unit/test_click_scrolling.py | 81 +- .../tests/unit/test_context.py | 11 +- .../tests/unit/test_cookies.py | 62 +- .../tests/unit/test_crash.py | 58 +- .../tests/unit/test_data_driven.py | 32 +- .../tests/unit/test_element_rect.py | 9 +- .../tests/unit/test_element_rect_chrome.py | 11 +- .../tests/unit/test_element_retrieval.py | 175 +- .../tests/unit/test_element_state.py | 57 +- .../tests/unit/test_element_state_chrome.py | 13 +- .../tests/unit/test_errors.py | 31 +- .../tests/unit/test_execute_async_script.py | 146 +- .../tests/unit/test_execute_isolate.py | 24 +- .../tests/unit/test_execute_sandboxes.py | 43 +- .../tests/unit/test_execute_script.py | 278 +- .../tests/unit/test_expected.py | 9 +- .../tests/unit/test_file_upload.py | 33 +- .../tests/unit/test_findelement_chrome.py | 53 +- .../tests/unit/test_geckoinstance.py | 18 +- .../tests/unit/test_get_current_url_chrome.py | 1 + .../tests/unit/test_key_actions.py | 31 +- .../tests/unit/test_localization.py | 67 +- .../tests/unit/test_marionette.py | 34 +- .../tests/unit/test_modal_dialogs.py | 17 +- .../tests/unit/test_mouse_action.py | 79 +- .../tests/unit/test_navigation.py | 214 +- .../tests/unit/test_pagesource.py | 27 +- .../tests/unit/test_pagesource_chrome.py | 5 +- .../tests/unit/test_position.py | 5 +- .../tests/unit/test_prefs.py | 93 +- .../tests/unit/test_prefs_enforce.py | 13 +- .../tests/unit/test_profile_management.py | 20 +- .../tests/unit/test_proxy.py | 99 +- .../tests/unit/test_quit_restart.py | 163 +- .../tests/unit/test_reftest.py | 76 +- .../tests/unit/test_rendered_element.py | 9 +- .../tests/unit/test_report.py | 3 +- .../tests/unit/test_run_js_test.py | 4 +- .../tests/unit/test_screen_orientation.py | 14 +- .../tests/unit/test_screenshot.py | 97 +- .../tests/unit/test_select.py | 78 +- .../tests/unit/test_session.py | 1 + .../tests/unit/test_skip_setup.py | 14 +- .../tests/unit/test_switch_frame_chrome.py | 25 +- .../tests/unit/test_switch_window_chrome.py | 35 +- .../tests/unit/test_switch_window_content.py | 13 +- .../tests/unit/test_text.py | 9 +- .../tests/unit/test_text_chrome.py | 10 +- .../tests/unit/test_timeouts.py | 26 +- .../tests/unit/test_title_chrome.py | 7 +- .../tests/unit/test_transport.py | 5 +- .../tests/unit/test_typing.py | 43 +- .../unit/test_unhandled_prompt_behavior.py | 48 +- .../tests/unit/test_visibility.py | 80 +- .../tests/unit/test_wait.py | 34 +- .../tests/unit/test_window_close_chrome.py | 1 + .../tests/unit/test_window_close_content.py | 15 +- .../tests/unit/test_window_handles_chrome.py | 72 +- .../tests/unit/test_window_handles_content.py | 7 +- .../tests/unit/test_window_management.py | 23 +- .../tests/unit/test_window_maximize.py | 14 +- .../tests/unit/test_window_rect.py | 194 +- .../tests/unit/test_window_status_chrome.py | 1 + .../tests/unit/test_window_status_content.py | 1 + .../tests/unit/test_window_type_chrome.py | 4 +- testing/marionette/harness/setup.py | 70 +- testing/marionette/mach_commands.py | 64 +- .../marionette/mach_test_package_commands.py | 38 +- testing/mochitest/BrowserTestUtils/moz.build | 16 +- testing/mochitest/bisection.py | 193 +- testing/mochitest/leaks.py | 225 +- testing/mochitest/mach_commands.py | 358 +- .../mochitest/mach_test_package_commands.py | 116 +- testing/mochitest/manifests/moz.build | 2 +- testing/mochitest/moz.build | 284 +- testing/mochitest/pywebsocket_wrapper.py | 6 +- testing/mochitest/runjunit.py | 525 +- testing/mochitest/runtests.py | 1771 ++- testing/mochitest/runtestsremote.py | 147 +- testing/mochitest/ssltunnel/moz.build | 12 +- testing/mochitest/tests/SimpleTest/moz.build | 36 +- testing/mochitest/tests/moz.build | 10 +- testing/mochitest/tests/python/conftest.py | 65 +- .../python/test_basic_mochitest_plain.py | 64 +- .../tests/python/test_build_profile.py | 16 +- .../tests/python/test_get_active_tests.py | 74 +- .../tests/python/test_message_logger.py | 114 +- testing/modules/moz.build | 32 +- testing/moz.build | 9 +- .../docs/_static/structured_example.py | 9 +- testing/mozbase/docs/conf.py | 72 +- .../manifestparser/manifestparser/cli.py | 104 +- .../manifestparser/expression.py | 76 +- .../manifestparser/manifestparser/filters.py | 118 +- .../manifestparser/manifestparser/ini.py | 51 +- .../manifestparser/manifestparser.py | 228 +- .../manifestparser/manifestparser/util.py | 16 +- testing/mozbase/manifestparser/setup.py | 46 +- .../manifestparser/tests/test_chunking.py | 125 +- .../tests/test_convert_directory.py | 82 +- .../tests/test_convert_symlinks.py | 77 +- .../tests/test_default_overrides.py | 88 +- .../tests/test_expressionparser.py | 20 +- .../manifestparser/tests/test_filters.py | 104 +- .../tests/test_manifestparser.py | 335 +- .../manifestparser/tests/test_read_ini.py | 51 +- .../manifestparser/tests/test_testmanifest.py | 75 +- testing/mozbase/moz.build | 100 +- testing/mozbase/mozcrash/mozcrash/mozcrash.py | 350 +- testing/mozbase/mozcrash/setup.py | 46 +- testing/mozbase/mozcrash/tests/conftest.py | 69 +- testing/mozbase/mozcrash/tests/test_basic.py | 10 +- .../mozcrash/tests/test_java_exception.py | 16 +- .../mozbase/mozcrash/tests/test_save_path.py | 8 +- .../mozbase/mozcrash/tests/test_stackwalk.py | 18 +- .../mozcrash/tests/test_symbols_path.py | 20 +- testing/mozbase/mozdebug/mozdebug/mozdebug.py | 181 +- testing/mozbase/mozdebug/setup.py | 43 +- testing/mozbase/mozdebug/tests/test.py | 24 +- .../mozbase/mozdevice/mozdevice/__init__.py | 13 +- testing/mozbase/mozdevice/mozdevice/adb.py | 1421 +- .../mozdevice/mozdevice/adb_android.py | 1 - testing/mozbase/mozdevice/setup.py | 46 +- testing/mozbase/mozdevice/tests/conftest.py | 47 +- testing/mozbase/mozdevice/tests/test_chown.py | 28 +- .../tests/test_escape_command_line.py | 12 +- .../mozdevice/tests/test_is_app_installed.py | 15 +- .../mozdevice/tests/test_socket_connection.py | 93 +- testing/mozbase/mozfile/mozfile/mozfile.py | 35 +- testing/mozbase/mozfile/tests/stubs.py | 33 +- testing/mozbase/mozfile/tests/test_extract.py | 30 +- .../mozbase/mozfile/tests/test_move_remove.py | 29 +- testing/mozbase/mozfile/tests/test_tempdir.py | 3 +- .../mozbase/mozfile/tests/test_tempfile.py | 16 +- testing/mozbase/mozfile/tests/test_tree.py | 12 +- testing/mozbase/mozfile/tests/test_url.py | 10 +- testing/mozbase/mozfile/tests/test_which.py | 16 +- .../mozgeckoprofiler/symFileManager.py | 4 +- .../mozgeckoprofiler/symbolication.py | 1 - .../mozgeckoprofiler/symbolicationRequest.py | 1 - .../mozgeckoprofiler/viewgeckoprofile.py | 4 +- testing/mozbase/mozhttpd/mozhttpd/__init__.py | 2 +- testing/mozbase/mozhttpd/mozhttpd/handlers.py | 8 +- testing/mozbase/mozhttpd/mozhttpd/mozhttpd.py | 125 +- testing/mozbase/mozhttpd/setup.py | 43 +- testing/mozbase/mozhttpd/tests/filelisting.py | 8 +- testing/mozbase/mozinfo/mozinfo/__init__.py | 1 + testing/mozbase/mozinfo/mozinfo/mozinfo.py | 179 +- .../mozbase/mozinfo/mozinfo/string_version.py | 2 +- testing/mozbase/mozinfo/tests/test.py | 63 +- .../mozbase/mozinstall/mozinstall/__init__.py | 2 +- .../mozinstall/mozinstall/mozinstall.py | 97 +- testing/mozbase/mozinstall/setup.py | 71 +- testing/mozbase/mozinstall/tests/conftest.py | 4 +- .../mozbase/mozinstall/tests/test_binary.py | 36 +- .../mozbase/mozinstall/tests/test_install.py | 55 +- .../mozinstall/tests/test_is_installer.py | 19 +- .../mozinstall/tests/test_uninstall.py | 18 +- testing/mozbase/mozleak/mozleak/__init__.py | 2 +- testing/mozbase/mozleak/mozleak/leaklog.py | 149 +- testing/mozbase/mozleak/mozleak/lsan.py | 83 +- testing/mozbase/mozleak/setup.py | 22 +- testing/mozbase/mozleak/tests/test_lsan.py | 30 +- testing/mozbase/mozlog/mozlog/__init__.py | 16 +- testing/mozbase/mozlog/mozlog/capture.py | 4 +- testing/mozbase/mozlog/mozlog/commandline.py | 161 +- .../mozlog/mozlog/formatters/__init__.py | 13 +- .../mozlog/mozlog/formatters/errorsummary.py | 59 +- .../mozlog/mozlog/formatters/grouping.py | 213 +- .../mozlog/mozlog/formatters/html/__init__.py | 3 +- .../mozlog/mozlog/formatters/html/html.py | 280 +- .../mozlog/mozlog/formatters/html/xmlgen.py | 119 +- .../mozlog/mozlog/formatters/machformatter.py | 333 +- .../mozlog/mozlog/formatters/process.py | 11 +- .../mozlog/mozlog/formatters/tbplformatter.py | 179 +- .../mozlog/mozlog/formatters/unittest.py | 37 +- .../mozbase/mozlog/mozlog/formatters/xunit.py | 37 +- .../mozlog/mozlog/handlers/__init__.py | 11 +- .../mozbase/mozlog/mozlog/handlers/base.py | 14 +- .../mozlog/mozlog/handlers/bufferhandler.py | 27 +- .../mozlog/mozlog/handlers/statushandler.py | 32 +- .../mozlog/mozlog/handlers/summaryhandler.py | 134 +- .../mozlog/mozlog/handlers/valgrindhandler.py | 59 +- testing/mozbase/mozlog/mozlog/logtypes.py | 84 +- .../mozlog/mozlog/pytest_mozlog/plugin.py | 74 +- .../mozbase/mozlog/mozlog/scripts/__init__.py | 21 +- .../mozbase/mozlog/mozlog/scripts/format.py | 30 +- .../mozbase/mozlog/mozlog/scripts/logmerge.py | 16 +- .../mozbase/mozlog/mozlog/scripts/unstable.py | 54 +- testing/mozbase/mozlog/mozlog/stdadapter.py | 9 +- .../mozbase/mozlog/mozlog/structuredlog.py | 296 +- .../mozlog/mozlog/unstructured/logger.py | 66 +- .../mozlog/unstructured/loggingmixin.py | 5 +- .../mozlog/mozlog/unstructured/loglistener.py | 9 +- testing/mozbase/mozlog/setup.py | 65 +- .../mozbase/mozlog/tests/test_formatters.py | 437 +- testing/mozbase/mozlog/tests/test_logger.py | 255 +- testing/mozbase/mozlog/tests/test_logtypes.py | 72 +- .../mozbase/mozlog/tests/test_structured.py | 840 +- .../mozbase/moznetwork/moznetwork/__init__.py | 2 +- .../moznetwork/moznetwork/moznetwork.py | 109 +- testing/mozbase/moznetwork/setup.py | 28 +- .../moznetwork/tests/test_moznetwork.py | 38 +- testing/mozbase/mozpower/mozpower/__init__.py | 18 +- .../mozpower/mozpower/intel_power_gadget.py | 292 +- .../mozpower/mozpower/macintelpower.py | 23 +- testing/mozbase/mozpower/mozpower/mozpower.py | 124 +- .../mozpower/mozpower/mozpowerutils.py | 6 +- .../mozbase/mozpower/mozpower/powerbase.py | 15 +- testing/mozbase/mozpower/setup.py | 46 +- testing/mozbase/mozpower/tests/conftest.py | 57 +- .../mozpower/tests/test_intelpowergadget.py | 117 +- .../mozbase/mozpower/tests/test_mozpower.py | 218 +- .../mozbase/mozpower/tests/test_powerbase.py | 23 +- .../mozprocess/mozprocess/processhandler.py | 578 +- testing/mozbase/mozprocess/mozprocess/qijo.py | 109 +- .../mozprocess/mozprocess/winprocess.py | 380 +- testing/mozbase/mozprocess/setup.py | 52 +- .../mozbase/mozprocess/tests/proclaunch.py | 134 +- testing/mozbase/mozprocess/tests/proctest.py | 33 +- .../mozprocess/tests/scripts/infinite_loop.py | 2 +- .../mozprocess/tests/scripts/procnonewline.py | 1 - .../mozbase/mozprocess/tests/test_detached.py | 20 +- testing/mozbase/mozprocess/tests/test_kill.py | 66 +- testing/mozbase/mozprocess/tests/test_misc.py | 37 +- .../mozbase/mozprocess/tests/test_output.py | 29 +- .../mozbase/mozprocess/tests/test_params.py | 27 +- testing/mozbase/mozprocess/tests/test_pid.py | 14 +- testing/mozbase/mozprocess/tests/test_poll.py | 90 +- .../mozprocess/tests/test_process_reader.py | 51 +- testing/mozbase/mozprocess/tests/test_wait.py | 88 +- .../mozbase/mozprofile/mozprofile/addons.py | 90 +- testing/mozbase/mozprofile/mozprofile/cli.py | 101 +- testing/mozbase/mozprofile/mozprofile/diff.py | 34 +- .../mozprofile/mozprofile/permissions.py | 79 +- .../mozbase/mozprofile/mozprofile/prefs.py | 38 +- .../mozbase/mozprofile/mozprofile/profile.py | 229 +- testing/mozbase/mozprofile/mozprofile/view.py | 13 +- testing/mozbase/mozprofile/setup.py | 65 +- .../mozbase/mozprofile/tests/addon_stubs.py | 35 +- .../mozbase/mozprofile/tests/test_addonid.py | 10 +- .../mozbase/mozprofile/tests/test_addons.py | 178 +- .../mozprofile/tests/test_bug758250.py | 10 +- .../mozprofile/tests/test_chrome_profile.py | 24 +- .../mozprofile/tests/test_clone_cleanup.py | 11 +- .../mozbase/mozprofile/tests/test_nonce.py | 18 +- .../mozprofile/tests/test_permissions.py | 84 +- .../mozprofile/tests/test_preferences.py | 141 +- .../mozbase/mozprofile/tests/test_profile.py | 44 +- .../mozprofile/tests/test_profile_view.py | 31 +- .../mozprofile/tests/test_server_locations.py | 45 +- testing/mozbase/mozproxy/mozproxy/__init__.py | 3 +- .../mozproxy/backends/mitm/android.py | 9 +- .../mozproxy/backends/mitm/desktop.py | 8 +- .../mozproxy/mozproxy/backends/mitm/mitm.py | 42 +- .../mitm/scripts/alternate-server-replay.py | 55 +- .../mitm/scripts/inject-deterministic.py | 66 +- testing/mozbase/mozproxy/mozproxy/driver.py | 93 +- .../mozbase/mozproxy/mozproxy/recordings.py | 46 +- testing/mozbase/mozproxy/mozproxy/utils.py | 18 +- testing/mozbase/mozproxy/setup.py | 6 +- .../mozproxy/tests/test_command_line.py | 30 +- testing/mozbase/mozproxy/tests/test_proxy.py | 13 +- .../mozrunner/mozrunner/application.py | 43 +- .../mozrunner/mozrunner/base/browser.py | 52 +- .../mozrunner/mozrunner/base/device.py | 84 +- .../mozrunner/mozrunner/base/runner.py | 58 +- testing/mozbase/mozrunner/mozrunner/cli.py | 94 +- .../mozrunner/mozrunner/devices/__init__.py | 10 +- .../mozrunner/devices/android_device.py | 554 +- .../mozrunner/mozrunner/devices/base.py | 62 +- .../mozrunner/mozrunner/devices/emulator.py | 97 +- .../mozrunner/devices/emulator_battery.py | 31 +- .../mozrunner/devices/emulator_geo.py | 3 +- .../mozrunner/devices/emulator_screen.py | 48 +- .../mozbase/mozrunner/mozrunner/runners.py | 58 +- testing/mozbase/mozrunner/mozrunner/utils.py | 140 +- testing/mozbase/mozrunner/setup.py | 71 +- testing/mozbase/mozrunner/tests/conftest.py | 29 +- testing/mozbase/mozrunner/tests/test_crash.py | 12 +- .../mozrunner/tests/test_interactive.py | 2 +- testing/mozbase/mozrunner/tests/test_start.py | 6 +- .../mozbase/mozrunner/tests/test_states.py | 2 +- testing/mozbase/mozrunner/tests/test_stop.py | 2 +- .../mozbase/mozrunner/tests/test_threads.py | 2 +- testing/mozbase/mozrunner/tests/test_wait.py | 2 +- .../mozscreenshot/mozscreenshot/__init__.py | 38 +- testing/mozbase/mozscreenshot/setup.py | 24 +- .../mozsystemmonitor/resourcemonitor.py | 168 +- testing/mozbase/mozsystemmonitor/setup.py | 30 +- .../tests/test_resource_monitor.py | 55 +- testing/mozbase/moztest/moztest/__init__.py | 3 +- .../moztest/moztest/adapters/__init__.py | 2 +- .../mozbase/moztest/moztest/adapters/unit.py | 95 +- testing/mozbase/moztest/moztest/resolve.py | 767 +- testing/mozbase/moztest/moztest/results.py | 234 +- .../moztest/moztest/selftest/fixtures.py | 27 +- .../moztest/moztest/selftest/output.py | 10 +- testing/mozbase/moztest/setup.py | 47 +- .../tests/data/srcdir/carrot/moz.build | 2 +- .../tests/data/srcdir/dragonfruit/moz.build | 2 +- .../moztest/tests/data/srcdir/fig/moz.build | 4 +- .../moztest/tests/data/srcdir/moz.build | 4 +- testing/mozbase/moztest/tests/test.py | 39 +- testing/mozbase/moztest/tests/test_resolve.py | 512 +- .../mozbase/mozversion/mozversion/errors.py | 3 +- .../mozversion/mozversion/mozversion.py | 74 +- testing/mozbase/mozversion/setup.py | 41 +- testing/mozbase/mozversion/tests/test_apk.py | 32 +- .../mozbase/mozversion/tests/test_binary.py | 84 +- testing/mozbase/setup_development.py | 112 +- testing/mozbase/versioninfo.py | 84 +- .../configs/android/android_common.py | 56 +- .../mozharness/configs/android/android_hw.py | 12 +- .../mozharness/configs/android/android_pgo.py | 14 +- .../configs/android/androidarm_4_3.py | 2 +- .../configs/android/androidx86_7_0.py | 2 +- testing/mozharness/configs/android/wrench.py | 2 +- .../mozharness/configs/awsy/linux_config.py | 7 +- .../mozharness/configs/awsy/macosx_config.py | 7 +- .../awsy/taskcluster_windows_config.py | 20 +- .../mozharness/configs/balrog/production.py | 25 +- testing/mozharness/configs/balrog/staging.py | 18 +- .../configs/builds/build_pool_specifics.py | 4 +- .../builds/releng_base_android_64_builds.py | 74 +- .../configs/builds/releng_base_firefox.py | 2 +- .../builds/releng_base_linux_32_builds.py | 70 +- .../builds/releng_base_linux_64_builds.py | 70 +- .../builds/releng_base_mac_64_cross_builds.py | 67 +- .../releng_base_windows_32_mingw_builds.py | 60 +- .../releng_base_windows_64_mingw_builds.py | 62 +- .../releng_sub_android_configs/64_aarch64.py | 4 +- .../64_aarch64_beta.py | 4 +- .../64_aarch64_beta_debug.py | 6 +- .../64_aarch64_debug.py | 6 +- .../releng_sub_android_configs/64_api_16.py | 4 +- .../64_api_16_beta.py | 4 +- .../64_api_16_beta_debug.py | 6 +- .../64_api_16_debug.py | 6 +- .../64_api_16_debug_ccov.py | 13 +- .../64_api_16_debug_searchfox.py | 10 +- .../64_api_16_gradle_dependencies.py | 15 +- .../64_api_16_partner_sample1.py | 8 +- .../64_api_16_profile_generate.py | 4 +- .../64_geckoview_docs.py | 29 +- .../releng_sub_android_configs/64_x86.py | 4 +- .../releng_sub_android_configs/64_x86_64.py | 4 +- .../64_x86_64_beta.py | 4 +- .../64_x86_64_beta_debug.py | 6 +- .../64_x86_64_debug.py | 6 +- .../64_x86_64_fuzzing_asan.py | 4 +- .../releng_sub_android_configs/64_x86_beta.py | 4 +- .../64_x86_beta_debug.py | 6 +- .../64_x86_debug.py | 6 +- .../64_x86_fuzzing_debug.py | 6 +- .../releng_sub_linux_configs/32_debug.py | 28 +- .../releng_sub_linux_configs/32_rusttests.py | 32 +- .../32_rusttests_debug.py | 32 +- .../64_add-on-devel.py | 24 +- .../releng_sub_linux_configs/64_asan.py | 34 +- .../64_asan_and_debug.py | 36 +- .../64_asan_reporter_tc.py | 30 +- .../releng_sub_linux_configs/64_asan_tc.py | 26 +- .../64_asan_tc_and_debug.py | 28 +- .../64_code_coverage_debug.py | 26 +- .../64_code_coverage_opt.py | 26 +- .../releng_sub_linux_configs/64_debug.py | 28 +- .../64_fuzzing_asan_tc.py | 30 +- .../64_fuzzing_debug.py | 30 +- .../64_fuzzing_tsan_tc.py | 26 +- .../64_noopt_debug.py | 28 +- .../releng_sub_linux_configs/64_rusttests.py | 30 +- .../64_rusttests_debug.py | 32 +- .../64_searchfox_and_debug.py | 44 +- .../releng_sub_linux_configs/64_source.py | 16 +- .../64_stat_and_debug.py | 42 +- .../releng_sub_linux_configs/64_tsan_tc.py | 26 +- .../releng_sub_linux_configs/64_valgrind.py | 36 +- .../releng_sub_mac_configs/64_add-on-devel.py | 24 +- .../64_code_coverage_debug.py | 26 +- .../64_code_coverage_opt.py | 24 +- .../releng_sub_mac_configs/64_cross_debug.py | 28 +- .../64_cross_debug_searchfox.py | 38 +- .../64_cross_fuzzing_asan.py | 32 +- .../64_cross_fuzzing_debug.py | 30 +- .../64_cross_noopt_debug.py | 28 +- .../builds/releng_sub_mac_configs/64_debug.py | 36 +- .../64_stat_and_debug.py | 38 +- .../32_add-on-devel.py | 32 +- .../releng_sub_windows_configs/32_debug.py | 34 +- .../32_mingwclang.py | 6 +- .../32_stat_and_debug.py | 36 +- .../64_add-on-devel.py | 30 +- .../releng_sub_windows_configs/64_debug.py | 32 +- .../64_mingwclang.py | 6 +- .../configs/builds/taskcluster_base_win32.py | 4 +- .../configs/builds/taskcluster_base_win64.py | 4 +- .../builds/taskcluster_base_windows.py | 62 +- .../builds/taskcluster_sub_win32/debug.py | 8 +- .../taskcluster_sub_win32/noopt_debug.py | 8 +- .../taskcluster_sub_win64/asan_debug.py | 8 +- .../asan_reporter_opt.py | 4 +- .../builds/taskcluster_sub_win64/ccov_opt.py | 6 +- .../builds/taskcluster_sub_win64/debug.py | 8 +- .../taskcluster_sub_win64/noopt_debug.py | 8 +- .../builds/taskcluster_sub_win64/plain_opt.py | 10 +- .../taskcluster_sub_win64/rusttests_opt.py | 14 +- .../taskcluster_sub_win64/searchfox_debug.py | 12 +- .../mozharness/configs/developer_config.py | 10 +- .../configs/firefox_ui_tests/qa_jenkins.py | 5 +- .../firefox_ui_tests/releng_release.py | 11 +- .../configs/firefox_ui_tests/taskcluster.py | 1 + .../firefox_ui_tests/taskcluster_windows.py | 7 +- .../mozharness/configs/l10n_bumper/jamun.py | 97 +- .../configs/l10n_bumper/mozilla-beta.py | 91 +- .../configs/l10n_bumper/mozilla-central.py | 92 +- .../configs/l10n_bumper/mozilla-esr68.py | 34 +- .../marionette/mac_taskcluster_config.py | 10 +- .../configs/marionette/prod_config.py | 26 +- .../configs/marionette/test_config.py | 15 +- .../configs/marionette/windows_config.py | 22 +- .../marionette/windows_taskcluster_config.py | 140 +- .../configs/merge_day/beta_to_release.py | 10 +- .../configs/merge_day/bump_central.py | 11 +- .../mozharness/configs/merge_day/bump_esr.py | 10 +- .../configs/merge_day/central_to_beta.py | 46 +- .../configs/merge_day/early_to_late_beta.py | 6 +- .../configs/merge_day/release_to_esr.py | 19 +- .../merge_day/staging_beta_migration.py | 5 +- .../mozharness/configs/openh264/linux32.py | 33 +- .../mozharness/configs/openh264/linux64.py | 33 +- .../mozharness/configs/openh264/macosx64.py | 55 +- testing/mozharness/configs/openh264/win32.py | 59 +- .../configs/openh264/win64-aarch64.py | 63 +- testing/mozharness/configs/openh264/win64.py | 59 +- .../configs/raptor/android_hw_config.py | 6 +- .../raptor/linux64_config_taskcluster.py | 6 +- .../mozharness/configs/raptor/linux_config.py | 4 +- .../mozharness/configs/raptor/mac_config.py | 4 +- .../configs/raptor/windows_config.py | 33 +- .../configs/raptor/windows_vm_config.py | 28 +- .../releases/dev_postrelease_fennec_beta.py | 2 +- .../dev_postrelease_fennec_release.py | 2 +- .../releases/dev_postrelease_firefox_beta.py | 2 +- .../dev_postrelease_firefox_release.py | 2 +- .../dev_postrelease_firefox_release_birch.py | 2 +- .../releases/dev_updates_firefox_beta.py | 1 + .../dev_updates_firefox_devedition.py | 1 + .../releases/dev_updates_firefox_release.py | 4 +- .../dev_updates_firefox_release_birch.py | 4 +- .../configs/releases/updates_firefox_beta.py | 1 + .../releases/updates_firefox_devedition.py | 1 + .../releases/updates_firefox_release.py | 4 +- .../mozharness/configs/remove_executables.py | 2 +- testing/mozharness/configs/repackage/base.py | 2 +- .../configs/repackage/linux32_signed.py | 6 +- .../configs/repackage/linux64_signed.py | 6 +- .../configs/repackage/osx_partner.py | 4 +- .../configs/repackage/osx_signed.py | 4 +- .../configs/repackage/win32_partner.py | 10 +- .../configs/repackage/win32_sfx_stub.py | 2 +- .../configs/repackage/win32_signed.py | 10 +- .../repackage/win64-aarch64_sfx_stub.py | 2 +- .../configs/repackage/win64_partner.py | 10 +- .../configs/repackage/win64_signed.py | 10 +- testing/mozharness/configs/servo/mac.py | 2 +- .../configs/single_locale/linux32.py | 1 + .../configs/single_locale/linux64.py | 1 + .../configs/single_locale/macosx64.py | 2 + .../single_locale/tc_android-api-16.py | 33 +- .../configs/single_locale/tc_common.py | 2 +- .../configs/single_locale/tc_linux32.py | 2 +- .../configs/single_locale/tc_linux_common.py | 2 +- .../configs/single_locale/tc_macosx64.py | 3 +- .../configs/single_locale/tc_win32.py | 7 +- .../configs/single_locale/tc_win64.py | 7 +- .../mozharness/configs/single_locale/win32.py | 1 + .../configs/single_locale/win64-aarch64.py | 1 + .../mozharness/configs/single_locale/win64.py | 1 + .../talos/linux64_config_taskcluster.py | 6 +- .../mozharness/configs/talos/linux_config.py | 4 +- .../mozharness/configs/talos/mac_config.py | 4 +- .../configs/talos/windows_config.py | 17 +- .../talos/windows_taskcluster_config.py | 12 +- .../configs/talos/windows_vm_config.py | 12 +- .../mozharness/configs/taskcluster_nightly.py | 5 +- testing/mozharness/configs/test/test.py | 27 +- .../mozharness/configs/test/test_override.py | 4 +- .../mozharness/configs/test/test_override2.py | 4 +- .../configs/unittests/linux_unittest.py | 148 +- .../configs/unittests/mac_unittest.py | 103 +- .../configs/unittests/win_unittest.py | 243 +- .../configs/web_platform_tests/prod_config.py | 13 +- .../web_platform_tests/prod_config_mac.py | 13 +- .../web_platform_tests/prod_config_windows.py | 15 +- .../prod_config_windows_taskcluster.py | 126 +- .../configs/web_platform_tests/test_config.py | 14 +- .../web_platform_tests/test_config_windows.py | 18 +- testing/mozharness/docs/conf.py | 152 +- .../examples/action_config_script.py | 114 +- testing/mozharness/examples/silent_script.py | 10 +- testing/mozharness/examples/venv.py | 38 +- testing/mozharness/examples/verbose_script.py | 31 +- .../external_tools/extract_and_run_command.py | 42 +- testing/mozharness/external_tools/gittool.py | 101 +- .../mouse_and_screen_resolution.py | 74 +- .../external_tools/packagesymbols.py | 43 +- .../external_tools/robustcheckout.py | 583 +- testing/mozharness/external_tools/tooltool.py | 954 +- testing/mozharness/mach_commands.py | 150 +- testing/mozharness/mozharness/__init__.py | 2 +- testing/mozharness/mozharness/base/config.py | 298 +- .../mozharness/mozharness/base/diskutils.py | 77 +- testing/mozharness/mozharness/base/errors.py | 246 +- testing/mozharness/mozharness/base/log.py | 247 +- .../mozharness/mozharness/base/parallel.py | 7 +- testing/mozharness/mozharness/base/python.py | 634 +- testing/mozharness/mozharness/base/script.py | 970 +- .../mozharness/mozharness/base/transfer.py | 6 +- .../mozharness/mozharness/base/vcs/gittool.py | 58 +- .../mozharness/base/vcs/mercurial.py | 225 +- .../mozharness/mozharness/base/vcs/vcsbase.py | 70 +- .../mozharness/lib/python/authentication.py | 7 +- .../mozharness/mozilla/automation.py | 38 +- .../mozharness/mozilla/bouncer/submitter.py | 39 +- .../mozharness/mozilla/checksums.py | 16 +- .../mozharness/mozilla/firefox/autoconfig.py | 64 +- .../mozharness/mozilla/l10n/locales.py | 72 +- .../mozilla/l10n/multi_locale_build.py | 131 +- .../mozharness/mozharness/mozilla/merkle.py | 46 +- .../mozharness/mozharness/mozilla/mozbase.py | 11 +- .../mozharness/mozilla/repo_manipulation.py | 136 +- .../mozharness/mozharness/mozilla/secrets.py | 29 +- .../mozharness/mozilla/structuredlog.py | 145 +- .../mozharness/mozilla/testing/android.py | 428 +- .../mozilla/testing/codecoverage.py | 410 +- .../mozilla/testing/firefox_ui_tests.py | 403 +- .../mozilla/testing/per_test_base.py | 314 +- .../mozharness/mozilla/testing/talos.py | 641 +- .../mozharness/mozilla/testing/try_tools.py | 150 +- .../mozharness/mozilla/testing/unittest.py | 120 +- .../mozilla/testing/verify_tools.py | 37 +- .../mozharness/mozharness/mozilla/tooltool.py | 80 +- .../mozharness/mozharness/mozilla/vcstools.py | 19 +- .../scripts/android_emulator_pgo.py | 158 +- .../scripts/android_emulator_unittest.py | 488 +- .../scripts/android_hardware_unittest.py | 434 +- testing/mozharness/scripts/android_wrench.py | 142 +- testing/mozharness/scripts/awsy_script.py | 327 +- testing/mozharness/scripts/configtest.py | 100 +- testing/mozharness/scripts/desktop_l10n.py | 321 +- .../scripts/desktop_partner_repacks.py | 212 +- .../scripts/firefox_ui_tests/functional.py | 2 +- .../scripts/firefox_ui_tests/update.py | 2 +- .../firefox_ui_tests/update_release.py | 269 +- .../mozharness/scripts/fx_desktop_build.py | 57 +- testing/mozharness/scripts/l10n_bumper.py | 271 +- .../scripts/merge_day/gecko_migration.py | 431 +- testing/mozharness/scripts/multil10n.py | 2 +- testing/mozharness/scripts/openh264_build.py | 422 +- testing/mozharness/scripts/raptor_script.py | 2 +- .../scripts/release/generate-checksums.py | 157 +- testing/mozharness/scripts/repackage.py | 145 +- testing/mozharness/scripts/talos_script.py | 2 +- .../scripts/telemetry/telemetry_client.py | 238 +- .../mozharness/scripts/web_platform_tests.py | 552 +- testing/mozharness/setup.py | 46 +- testing/mozharness/test/test_base_config.py | 291 +- .../mozharness/test/test_base_diskutils.py | 60 +- testing/mozharness/test/test_base_log.py | 13 +- testing/mozharness/test/test_base_parallel.py | 4 +- testing/mozharness/test/test_base_python.py | 36 +- testing/mozharness/test/test_base_script.py | 575 +- .../test/test_base_vcs_mercurial.py | 188 +- testing/mozharness/test/test_l10n_locales.py | 87 +- .../test/test_mozilla_automation.py | 10 +- .../test/test_mozilla_building_buildbase.py | 94 +- .../test/test_mozilla_structured.py | 56 +- testing/parse_build_tests_ccov.py | 71 +- testing/perfdocs/moz.build | 2 +- testing/performance/hooks_android_view.py | 55 +- testing/profiles/moz.build | 24 +- .../constants/raptor_tests_constants.py | 588 +- testing/raptor/logger/logger.py | 14 +- testing/raptor/mach_commands.py | 247 +- testing/raptor/moz.build | 2 +- testing/raptor/raptor/benchmark.py | 45 +- testing/raptor/raptor/browsertime/android.py | 67 +- testing/raptor/raptor/browsertime/base.py | 94 +- testing/raptor/raptor/browsertime/desktop.py | 12 +- testing/raptor/raptor/cmdline.py | 599 +- testing/raptor/raptor/control_server.py | 36 +- testing/raptor/raptor/cpu.py | 44 +- testing/raptor/raptor/filters.py | 54 +- testing/raptor/raptor/gecko_profile.py | 176 +- testing/raptor/raptor/gen_test_config.py | 22 +- testing/raptor/raptor/manifest.py | 448 +- testing/raptor/raptor/memory.py | 26 +- testing/raptor/raptor/output.py | 96 +- testing/raptor/raptor/outputhandler.py | 6 +- testing/raptor/raptor/performance_tuning.py | 204 +- testing/raptor/raptor/perftest.py | 54 +- testing/raptor/raptor/power.py | 56 +- testing/raptor/raptor/raptor.py | 9 +- testing/raptor/raptor/results.py | 84 +- testing/raptor/raptor/signal_handler.py | 1 + testing/raptor/raptor/utils.py | 46 +- testing/raptor/raptor/webextension/android.py | 37 +- testing/raptor/raptor/webextension/base.py | 31 +- testing/raptor/test/test_control_server.py | 65 +- testing/raptor/test/test_manifest.py | 464 +- testing/raptor/test/test_playback.py | 16 +- testing/raptor/test/test_raptor.py | 30 +- testing/raptor/test/test_utils.py | 50 +- testing/remotecppunittests.py | 188 +- testing/runcppunittests.py | 219 +- testing/runtimes/moz.build | 2 +- testing/specialpowers/moz.build | 28 +- testing/talos/INSTALL.py | 30 +- testing/talos/mach_commands.py | 101 +- testing/talos/moz.build | 2 +- testing/talos/setup.py | 82 +- testing/talos/talos/cmanager.py | 21 +- testing/talos/talos/cmanager_base.py | 3 +- testing/talos/talos/cmanager_linux.py | 46 +- testing/talos/talos/cmanager_mac.py | 36 +- testing/talos/talos/cmanager_win32.py | 139 +- testing/talos/talos/cmdline.py | 394 +- testing/talos/talos/config.py | 226 +- testing/talos/talos/ffsetup.py | 194 +- testing/talos/talos/filter.py | 54 +- testing/talos/talos/gecko_profile.py | 186 +- testing/talos/talos/heavy.py | 29 +- testing/talos/talos/mainthreadio.py | 116 +- testing/talos/talos/output.py | 176 +- testing/talos/talos/results.py | 241 +- testing/talos/talos/run_tests.py | 297 +- testing/talos/talos/scripts/report.py | 72 +- testing/talos/talos/talos_process.py | 77 +- testing/talos/talos/talosconfig.py | 65 +- testing/talos/talos/ttest.py | 232 +- testing/talos/talos/unittests/conftest.py | 16 +- testing/talos/talos/unittests/test_config.py | 1358 +- testing/talos/talos/unittests/test_test.py | 147 +- testing/talos/talos/utils.py | 79 +- testing/talos/talos/whitelist.py | 96 +- testing/talos/talos/xtalos/etlparser.py | 331 +- testing/talos/talos/xtalos/parse_xperf.py | 63 +- testing/talos/talos/xtalos/start_xperf.py | 76 +- testing/talos/talos/xtalos/xperf_analyzer.py | 459 +- testing/talos/talos/xtalos/xtalos.py | 141 +- testing/talos/talos_from_code.py | 78 +- testing/testinfo.py | 793 +- testing/tools/iceserver/iceserver.py | 407 +- testing/tools/mach_test_package_bootstrap.py | 180 +- testing/tools/minidumpwriter/moz.build | 12 +- testing/tools/screenshot/moz.build | 29 +- .../websocketprocessbridge.py | 28 +- testing/tps/create_venv.py | 187 +- testing/tps/mach_commands.py | 16 +- testing/tps/setup.py | 69 +- testing/tps/tps/__init__.py | 4 +- testing/tps/tps/cli.py | 204 +- testing/tps/tps/firefoxrunner.py | 24 +- testing/tps/tps/phase.py | 51 +- testing/tps/tps/testrunner.py | 347 +- testing/web-platform/mach_commands.py | 339 +- testing/web-platform/mach_commands_base.py | 32 +- .../mach_test_package_commands.py | 46 +- testing/web-platform/manifestdownload.py | 112 +- testing/web-platform/manifestupdate.py | 157 +- testing/web-platform/metasummary.py | 85 +- testing/web-platform/moz.build | 22 +- .../mozilla/tests/binast/serve.py | 14 +- .../mozilla/tests/webdriver/conftest.py | 4 +- .../tests/webdriver/send_alert_text.py | 6 +- .../take_full_screenshot/__init__.py | 8 +- .../webdriver/take_full_screenshot/iframe.py | 9 +- .../take_full_screenshot/screenshot.py | 10 +- testing/web-platform/test_metamerge.py | 12 +- testing/web-platform/unittestrunner.py | 42 +- testing/web-platform/update/__init__.py | 8 +- testing/web-platform/update/fetchlogs.py | 32 +- testing/web-platform/update/github.py | 27 +- testing/web-platform/update/tree.py | 17 +- testing/web-platform/update/update.py | 25 +- .../web-platform/update/updatecommandline.py | 31 +- testing/web-platform/update/upstream.py | 174 +- testing/web-platform/vcs.py | 19 +- testing/xpcshell/example/moz.build | 2 +- testing/xpcshell/mach_commands.py | 134 +- .../xpcshell/mach_test_package_commands.py | 24 +- testing/xpcshell/moz-http2/moz.build | 4 +- testing/xpcshell/moz.build | 6 +- testing/xpcshell/remotexpcshelltests.py | 253 +- testing/xpcshell/runxpcshelltests.py | 1072 +- testing/xpcshell/selftest.py | 364 +- testing/xpcshell/xpcshellcommandline.py | 506 +- toolkit/actors/moz.build | 106 +- .../components/aboutcheckerboard/moz.build | 6 +- toolkit/components/aboutmemory/moz.build | 10 +- toolkit/components/aboutperformance/moz.build | 8 +- toolkit/components/aboutprocesses/moz.build | 8 +- toolkit/components/alerts/moz.build | 30 +- toolkit/components/antitracking/moz.build | 100 +- toolkit/components/apppicker/moz.build | 6 +- toolkit/components/asyncshutdown/moz.build | 16 +- toolkit/components/autocomplete/moz.build | 32 +- .../backgroundhangmonitor/moz.build | 46 +- toolkit/components/bitsdownload/moz.build | 24 +- toolkit/components/browser/build/moz.build | 4 +- toolkit/components/browser/moz.build | 46 +- toolkit/components/build/moz.build | 14 +- toolkit/components/captivedetect/moz.build | 14 +- .../components/cascade_bloom_filter/moz.build | 22 +- toolkit/components/certviewer/moz.build | 16 +- toolkit/components/cleardata/moz.build | 24 +- .../test_service_worker_at_shutdown.py | 11 +- toolkit/components/clearsitedata/moz.build | 16 +- toolkit/components/cloudstorage/moz.build | 10 +- toolkit/components/commandlines/moz.build | 30 +- toolkit/components/contentprefs/moz.build | 22 +- .../components/contextualidentity/moz.build | 8 +- toolkit/components/corroborator/moz.build | 8 +- toolkit/components/crashes/moz.build | 27 +- toolkit/components/crashmonitor/moz.build | 12 +- toolkit/components/ctypes/moz.build | 16 +- toolkit/components/ctypes/tests/moz.build | 26 +- toolkit/components/downloads/moz.build | 46 +- .../components/enterprisepolicies/moz.build | 30 +- .../enterprisepolicies/tests/moz.build | 6 +- toolkit/components/extensions/moz.build | 150 +- .../components/extensions/schemas/moz.build | 2 +- .../components/extensions/storage/moz.build | 14 +- ..._serviceworkers_purged_on_pref_disabled.py | 20 +- .../extensions/webrequest/moz.build | 44 +- .../featuregates/gen_feature_definitions.py | 110 +- toolkit/components/featuregates/moz.build | 19 +- .../python/test_gen_feature_definitions.py | 148 +- toolkit/components/filewatcher/moz.build | 20 +- .../components/finalizationwitness/moz.build | 16 +- toolkit/components/find/moz.build | 20 +- toolkit/components/forgetaboutsite/moz.build | 10 +- toolkit/components/fuzzyfox/moz.build | 8 +- toolkit/components/gfx/moz.build | 10 +- .../glean_parser_ext/run_glean_parser.py | 16 +- .../build_scripts/glean_parser_ext/rust.py | 28 +- toolkit/components/glean/gtest/moz.build | 8 +- toolkit/components/glean/metrics_index.py | 4 +- toolkit/components/glean/moz.build | 54 +- .../glean/pytest/test_glean_parser_rust.py | 53 +- toolkit/components/glean/sphinx/glean.py | 8 +- toolkit/components/glean/xpcom/moz.build | 20 +- toolkit/components/httpsonlyerror/moz.build | 8 +- toolkit/components/kvstore/moz.build | 16 +- toolkit/components/lz4/moz.build | 14 +- .../components/maintenanceservice/moz.build | 46 +- toolkit/components/mediasniffer/moz.build | 16 +- toolkit/components/messaging-system/moz.build | 26 +- toolkit/components/moz.build | 208 +- toolkit/components/mozintl/moz.build | 20 +- toolkit/components/mozprotocol/moz.build | 12 +- toolkit/components/narrate/moz.build | 12 +- toolkit/components/normandy/moz.build | 18 +- .../normandy/test/browser/moz.build | 20 +- .../components/normandy/test/create_xpi.py | 2 +- toolkit/components/osfile/modules/moz.build | 30 +- toolkit/components/osfile/moz.build | 22 +- toolkit/components/parentalcontrols/moz.build | 26 +- toolkit/components/passwordmgr/moz.build | 88 +- toolkit/components/pdfjs/moz.build | 8 +- toolkit/components/perfmonitoring/moz.build | 23 +- toolkit/components/pictureinpicture/moz.build | 14 +- toolkit/components/places/moz.build | 120 +- .../components/places/tests/gtest/moz.build | 4 +- toolkit/components/places/tests/moz.build | 102 +- toolkit/components/printing/moz.build | 10 +- toolkit/components/printingui/ipc/moz.build | 30 +- toolkit/components/printingui/moz.build | 18 +- toolkit/components/processsingleton/moz.build | 12 +- toolkit/components/processtools/moz.build | 18 +- toolkit/components/promiseworker/moz.build | 12 +- .../components/promiseworker/worker/moz.build | 2 +- toolkit/components/prompts/moz.build | 20 +- toolkit/components/prompts/src/moz.build | 8 +- toolkit/components/reader/moz.build | 24 +- toolkit/components/reflect/moz.build | 12 +- toolkit/components/remote/moz.build | 52 +- .../components/remotebrowserutils/moz.build | 8 +- .../components/remotepagemanager/moz.build | 12 +- .../components/reputationservice/moz.build | 49 +- .../reputationservice/test/gtest/moz.build | 13 +- .../components/resistfingerprinting/moz.build | 16 +- .../resistfingerprinting/tests/moz.build | 6 +- toolkit/components/satchel/moz.build | 44 +- toolkit/components/search/moz.build | 42 +- toolkit/components/securityreporter/moz.build | 12 +- toolkit/components/sessionstore/moz.build | 26 +- toolkit/components/shell/moz.build | 4 +- toolkit/components/startup/moz.build | 18 +- toolkit/components/startup/public/moz.build | 5 +- toolkit/components/statusfilter/moz.build | 10 +- .../telemetry/build_scripts/gen_event_data.py | 109 +- .../telemetry/build_scripts/gen_event_enum.py | 8 +- .../build_scripts/gen_histogram_data.py | 135 +- .../build_scripts/gen_histogram_enum.py | 42 +- .../build_scripts/gen_histogram_phf.py | 27 +- .../build_scripts/gen_process_data.py | 14 +- .../build_scripts/gen_process_enum.py | 7 +- .../build_scripts/gen_scalar_data.py | 103 +- .../build_scripts/gen_scalar_enum.py | 2 +- .../build_scripts/gen_userinteraction_data.py | 23 +- .../build_scripts/gen_userinteraction_phf.py | 25 +- .../build_scripts/mozparsers/parse_events.py | 304 +- .../build_scripts/mozparsers/parse_scalars.py | 318 +- .../mozparsers/parse_user_interactions.py | 142 +- .../mozparsers/shared_telemetry_utils.py | 100 +- .../build_scripts/run_glean_parser.py | 2 +- .../telemetry/build_scripts/setup.py | 26 +- .../telemetry/geckoview/gtest/moz.build | 24 +- toolkit/components/telemetry/moz.build | 312 +- .../components/telemetry/pingsender/moz.build | 18 +- .../telemetry/tests/gtest/moz.build | 27 +- .../tests/integration/tests/conftest.py | 2 +- .../telemetry_harness/fog_ping_server.py | 7 +- .../harness/telemetry_harness/fog_testcase.py | 4 +- .../harness/telemetry_harness/ping_server.py | 8 +- .../harness/telemetry_harness/testcase.py | 18 +- .../tests/marionette/mach_commands.py | 21 +- .../client/test_deletion_request_ping.py | 6 +- .../client/test_fog_deletion_request_ping.py | 4 +- .../tests/client/test_main_tab_scalars.py | 8 +- .../test_search_counts_across_sessions.py | 28 +- .../unit/test_ping_server_received_ping.py | 4 +- toolkit/components/telemetry/tests/moz.build | 14 +- .../tests/python/test_gen_event_data_json.py | 8 +- .../tests/python/test_gen_scalar_data_json.py | 10 +- .../python/test_histogramtools_non_strict.py | 96 +- .../python/test_histogramtools_strict.py | 255 +- .../tests/python/test_parse_events.py | 47 +- .../tests/python/test_parse_scalars.py | 76 +- .../tests/python/test_usecounters.py | 26 +- toolkit/components/terminator/moz.build | 18 +- toolkit/components/thumbnails/moz.build | 32 +- toolkit/components/timermanager/moz.build | 14 +- toolkit/components/tooltiptext/moz.build | 10 +- toolkit/components/typeaheadfind/moz.build | 14 +- .../updateagent/UpdateUrlConstants.py | 10 +- toolkit/components/updateagent/moz.build | 12 +- toolkit/components/url-classifier/moz.build | 110 +- .../url-classifier/tests/gtest/moz.build | 46 +- .../components/url-classifier/tests/moz.build | 14 +- toolkit/components/urlformatter/moz.build | 16 +- toolkit/components/utils/moz.build | 28 +- toolkit/components/viaduct/moz.build | 26 +- toolkit/components/viewconfig/moz.build | 6 +- toolkit/components/viewsource/moz.build | 10 +- toolkit/components/windowcreator/moz.build | 16 +- .../components/windowcreator/test/moz.build | 6 +- toolkit/components/windowwatcher/moz.build | 52 +- .../components/windowwatcher/test/moz.build | 7 +- toolkit/components/workerloader/moz.build | 10 +- toolkit/components/xulstore/moz.build | 28 +- .../components/xulstore/tests/gtest/moz.build | 8 +- toolkit/content/moz.build | 348 +- .../tests/chrome/file_about_networking_wsh.py | 9 +- toolkit/content/tests/moz.build | 12 +- .../breakpad-windows-libxul/moz.build | 18 +- .../breakpad-windows-standalone/moz.build | 16 +- toolkit/crashreporter/client/moz.build | 98 +- .../generate_crash_reporter_sources.py | 58 +- toolkit/crashreporter/injector/moz.build | 16 +- .../crashreporter/minidump-analyzer/moz.build | 41 +- toolkit/crashreporter/moz.build | 156 +- toolkit/crashreporter/rust/moz.build | 2 +- toolkit/crashreporter/test/gtest/moz.build | 10 +- toolkit/crashreporter/test/moz.build | 76 +- toolkit/crashreporter/tools/symbolstore.py | 169 +- .../crashreporter/tools/unit-symbolstore.py | 79 +- toolkit/crashreporter/tools/upload_symbols.py | 147 +- toolkit/library/build/dependentlibs.py | 72 +- toolkit/library/build/moz.build | 28 +- toolkit/library/dummydll/moz.build | 8 +- toolkit/library/gen_buildid.py | 18 +- toolkit/library/gtest/moz.build | 18 +- toolkit/library/gtest/rust/moz.build | 9 +- toolkit/library/libxul.so-gdb.py | 8 +- toolkit/library/moz.build | 420 +- toolkit/library/rust/moz.build | 26 +- toolkit/locales/gen_multilocale.py | 2 +- toolkit/locales/generate_locale_ini.py | 2 +- toolkit/locales/generate_update_locale.py | 2 +- toolkit/locales/moz.build | 56 +- toolkit/modules/moz.build | 422 +- toolkit/modules/subprocess/moz.build | 30 +- .../test/xpcshell/data_test_script.py | 22 +- toolkit/moz.build | 109 +- toolkit/moz.configure | 2108 ++- toolkit/mozapps/defaultagent/moz.build | 42 +- toolkit/mozapps/defaultagent/rust/moz.build | 2 +- toolkit/mozapps/downloads/moz.build | 16 +- toolkit/mozapps/downloads/tests/moz.build | 4 +- .../mozapps/extensions/gen_built_in_addons.py | 25 +- toolkit/mozapps/extensions/internal/moz.build | 24 +- toolkit/mozapps/extensions/moz.build | 99 +- .../mozapps/extensions/test/browser/moz.build | 29 +- toolkit/mozapps/extensions/test/create_xpi.py | 9 +- toolkit/mozapps/extensions/test/moz.build | 18 +- toolkit/mozapps/handling/moz.build | 10 +- toolkit/mozapps/installer/find-dupes.py | 92 +- toolkit/mozapps/installer/informulate.py | 123 +- toolkit/mozapps/installer/l10n-repack.py | 81 +- toolkit/mozapps/installer/moz.build | 8 +- toolkit/mozapps/installer/packager.py | 206 +- toolkit/mozapps/installer/strip.py | 8 +- toolkit/mozapps/installer/unpack.py | 12 +- .../windows/nsis/preprocess-locale.py | 152 +- toolkit/mozapps/preferences/moz.build | 6 +- toolkit/mozapps/update/common/moz.build | 74 +- toolkit/mozapps/update/moz.build | 26 +- toolkit/mozapps/update/tests/moz.build | 130 +- .../mozapps/update/updater/bspatch/moz.build | 10 +- .../mozapps/update/updater/gen_cert_header.py | 34 +- toolkit/mozapps/update/updater/moz.build | 101 +- .../update/updater/updater-common.build | 102 +- .../update/updater/updater-dep/moz.build | 11 +- .../update/updater/updater-xpcshell/moz.build | 11 +- toolkit/pluginproblem/moz.build | 2 +- toolkit/profile/gtest/moz.build | 10 +- toolkit/profile/moz.build | 42 +- toolkit/system/androidproxy/moz.build | 10 +- toolkit/system/gnome/moz.build | 26 +- toolkit/system/osxproxy/moz.build | 14 +- toolkit/system/osxproxy/tests/gtest/moz.build | 10 +- toolkit/system/unixproxy/moz.build | 16 +- toolkit/system/windowsDHCPClient/moz.build | 16 +- .../windowsDHCPClient/tests/gtest/moz.build | 14 +- toolkit/system/windowsproxy/moz.build | 15 +- .../system/windowsproxy/tests/gtest/moz.build | 10 +- toolkit/themes/linux/global/moz.build | 2 +- toolkit/themes/linux/moz.build | 3 +- toolkit/themes/linux/mozapps/moz.build | 2 +- toolkit/themes/mobile/moz.build | 2 +- toolkit/themes/moz.build | 22 +- toolkit/themes/osx/global/moz.build | 2 +- toolkit/themes/osx/moz.build | 3 +- toolkit/themes/osx/mozapps/moz.build | 2 +- toolkit/themes/windows/global/moz.build | 2 +- toolkit/themes/windows/moz.build | 3 +- toolkit/themes/windows/mozapps/moz.build | 2 +- toolkit/xre/moz.build | 328 +- toolkit/xre/test/gtest/moz.build | 12 +- .../test/marionette/test_fission_autostart.py | 404 +- toolkit/xre/test/win/moz.build | 26 +- tools/code-coverage/moz.build | 28 +- tools/compare-locales/mach_commands.py | 90 +- .../minidump_stackwalk/curl-compat/moz.build | 6 +- .../minidump_stackwalk/moz.build | 36 +- tools/crashreporter/moz.configure | 2 +- tools/fuzzing/common/moz.build | 12 +- tools/fuzzing/faulty/moz.build | 13 +- tools/fuzzing/interface/harness/moz.build | 6 +- tools/fuzzing/interface/moz.build | 16 +- tools/fuzzing/ipc/moz.build | 14 +- tools/fuzzing/messagemanager/moz.build | 10 +- tools/fuzzing/moz.build | 34 +- tools/fuzzing/registry/moz.build | 8 +- tools/fuzzing/rust/moz.build | 8 +- tools/fuzzing/shmem/moz.build | 10 +- tools/github-sync/converter.py | 127 +- tools/github-sync/read-json.py | 8 +- tools/jprof/moz.build | 24 +- tools/jprof/split-profile.py | 19 +- tools/jprof/stub/moz.build | 8 +- tools/lint/black.yml | 55 +- tools/mach_commands.py | 412 +- tools/moz.build | 22 +- tools/performance/moz.build | 8 +- tools/phabricator/mach_commands.py | 18 +- tools/power/moz.build | 17 +- tools/profiler/moz.build | 202 +- tools/profiler/tests/gtest/moz.build | 42 +- tools/quitter/moz.build | 12 +- tools/rb/find_leakers.py | 58 +- tools/rb/fix_stacks.py | 34 +- tools/tryselect/cli.py | 163 +- tools/tryselect/mach_commands.py | 225 +- tools/tryselect/preset.py | 21 +- tools/tryselect/push.py | 100 +- tools/tryselect/selectors/again.py | 113 +- tools/tryselect/selectors/auto.py | 57 +- tools/tryselect/selectors/chooser/__init__.py | 68 +- tools/tryselect/selectors/chooser/app.py | 106 +- tools/tryselect/selectors/empty.py | 16 +- tools/tryselect/selectors/fuzzy.py | 322 +- tools/tryselect/selectors/preview.py | 52 +- tools/tryselect/selectors/release.py | 141 +- tools/tryselect/selectors/syntax.py | 476 +- tools/tryselect/task_config.py | 291 +- tools/tryselect/tasks.py | 51 +- tools/tryselect/test/conftest.py | 50 +- tools/tryselect/test/test_again.py | 10 +- tools/tryselect/test/test_auto.py | 4 +- tools/tryselect/test/test_chooser.py | 41 +- tools/tryselect/test/test_fuzzy.py | 18 +- .../test/test_mozharness_integration.py | 97 +- tools/tryselect/test/test_presets.py | 45 +- tools/tryselect/test/test_task_configs.py | 105 +- tools/tryselect/test/test_tasks.py | 38 +- tools/tryselect/util/dicttools.py | 8 +- tools/tryselect/util/estimates.py | 22 +- tools/tryselect/util/manage_estimates.py | 44 +- .../make_incremental_updates.py | 356 +- tools/update-packaging/moz.build | 1 + tools/update-programs/moz.configure | 13 +- tools/update-verify/python/util/commands.py | 10 +- .../release/compare-directories.py | 187 +- .../release/replace-updater-certs.py | 8 +- tools/update-verify/scripts/chunked-verify.py | 13 +- tools/vcs/mach_commands.py | 247 +- uriloader/base/moz.build | 34 +- uriloader/exthandler/moz.build | 169 +- uriloader/exthandler/tests/moz.build | 23 +- uriloader/moz.build | 14 +- uriloader/prefetch/moz.build | 34 +- uriloader/preload/gtest/moz.build | 13 +- uriloader/preload/moz.build | 22 +- view/moz.build | 18 +- widget/android/bindings/moz.build | 51 +- widget/android/jni/moz.build | 28 +- widget/android/moz.build | 271 +- widget/cocoa/moz.build | 261 +- widget/gtk/moz.build | 198 +- widget/gtk/mozgtk/gtk2/moz.build | 22 +- widget/gtk/mozgtk/gtk3/moz.build | 20 +- widget/gtk/mozgtk/moz.build | 2 +- widget/gtk/mozgtk/stub/moz.build | 8 +- widget/gtk/mozwayland/moz.build | 9 +- widget/gtk/wayland/moz.build | 30 +- widget/headless/moz.build | 38 +- widget/headless/tests/moz.build | 2 +- widget/moz.build | 456 +- widget/tests/gtest/moz.build | 6 +- widget/tests/moz.build | 8 +- widget/uikit/moz.build | 16 +- widget/windows/moz.build | 232 +- widget/windows/tests/moz.build | 21 +- widget/x11/moz.build | 6 +- xpcom/base/ErrorList.py | 180 +- xpcom/base/moz.build | 361 +- xpcom/build/Services.py | 173 +- xpcom/build/moz.build | 122 +- xpcom/components/moz.build | 87 +- xpcom/ds/Atom.py | 4 +- xpcom/ds/StaticAtoms.py | 223 +- xpcom/ds/moz.build | 238 +- xpcom/ds/test/test_dafsa.py | 66 +- xpcom/ds/tools/incremental_dafsa.py | 14 +- xpcom/ds/tools/make_dafsa.py | 63 +- xpcom/ds/tools/perfecthash.py | 156 +- xpcom/glue/moz.build | 6 +- xpcom/glue/standalone/moz.build | 26 +- xpcom/idl-parser/setup.py | 18 +- xpcom/idl-parser/xpidl/header.py | 315 +- xpcom/idl-parser/xpidl/jsonxpt.py | 230 +- xpcom/idl-parser/xpidl/moz.build | 4 +- xpcom/idl-parser/xpidl/runtests.py | 127 +- xpcom/idl-parser/xpidl/rust.py | 306 +- xpcom/idl-parser/xpidl/rust_macros.py | 55 +- xpcom/idl-parser/xpidl/xpidl.py | 1038 +- xpcom/io/moz.build | 224 +- xpcom/moz.build | 44 +- xpcom/reflect/moz.build | 3 +- xpcom/reflect/xptcall/md/moz.build | 8 +- xpcom/reflect/xptcall/md/test/moz.build | 8 +- xpcom/reflect/xptcall/md/unix/moz.build | 333 +- xpcom/reflect/xptcall/md/win32/moz.build | 61 +- xpcom/reflect/xptcall/md/win32/preprocess.py | 12 +- xpcom/reflect/xptcall/moz.build | 14 +- xpcom/reflect/xptinfo/moz.build | 10 +- xpcom/reflect/xptinfo/xptcodegen.py | 406 +- xpcom/rust/gtest/moz.build | 10 +- xpcom/string/moz.build | 80 +- xpcom/system/moz.build | 29 +- xpcom/tests/gtest/moz.build | 198 +- xpcom/tests/moz.build | 34 +- xpcom/tests/windows/moz.build | 8 +- xpcom/threads/moz.build | 196 +- xpcom/windbgdlg/moz.build | 4 +- xpfe/appshell/moz.build | 42 +- 3423 files changed, 129073 insertions(+), 164607 deletions(-) diff --git a/.ycm_extra_conf.py b/.ycm_extra_conf.py index 26b584e90532..16ec74c9d093 100644 --- a/.ycm_extra_conf.py +++ b/.ycm_extra_conf.py @@ -12,55 +12,56 @@ import sys old_bytecode = sys.dont_write_bytecode sys.dont_write_bytecode = True -path = os.path.abspath(os.path.join(os.path.dirname(__file__), "mach")) +path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'mach')) # If mach is not here, we're on the objdir go to the srcdir. if not os.path.exists(path): - with open(os.path.join(os.path.dirname(__file__), "mozinfo.json")) as info: + with open(os.path.join(os.path.dirname(__file__), 'mozinfo.json')) as info: config = json.loads(info.read()) - path = os.path.join(config["topsrcdir"], "mach") + path = os.path.join(config['topsrcdir'], 'mach') sys.dont_write_bytecode = old_bytecode - def _is_likely_cpp_header(filename): - if not filename.endswith(".h"): + if not filename.endswith('.h'): return False - if filename.endswith("Inlines.h") or filename.endswith("-inl.h"): + if filename.endswith('Inlines.h') or filename.endswith('-inl.h'): return True - cpp_file = filename[:-1] + "cpp" + cpp_file = filename[:-1] + 'cpp' return os.path.exists(cpp_file) def Settings(**kwargs): - if kwargs["language"] == "cfamily": - return FlagsForFile(kwargs["filename"]) + if kwargs[ 'language' ] == 'cfamily': + return FlagsForFile(kwargs['filename']) # This is useful for generic language server protocols, like rust-analyzer, # to discover the right project root instead of guessing based on where the # closest Cargo.toml is. return { - "project_directory": ".", + 'project_directory': '.', } def FlagsForFile(filename): - output = subprocess.check_output([path, "compileflags", filename]) - output = output.decode("utf-8") + output = subprocess.check_output([path, 'compileflags', filename]) + output = output.decode('utf-8') flag_list = shlex.split(output) # This flag is added by Fennec for android build and causes ycmd to fail to parse the file. # Removing this flag is a workaround until ycmd starts to handle this flag properly. # https://github.com/Valloric/YouCompleteMe/issues/1490 - final_flags = [x for x in flag_list if not x.startswith("-march=armv")] + final_flags = [x for x in flag_list if not x.startswith('-march=armv')] if _is_likely_cpp_header(filename): final_flags += ["-x", "c++"] - return {"flags": final_flags, "do_cache": True} - + return { + 'flags': final_flags, + 'do_cache': True + } -if __name__ == "__main__": +if __name__ == '__main__': print(FlagsForFile(sys.argv[1])) diff --git a/accessible/android/moz.build b/accessible/android/moz.build index 456a9d7ec642..7cb195352caf 100644 --- a/accessible/android/moz.build +++ b/accessible/android/moz.build @@ -4,39 +4,38 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -EXPORTS.mozilla.a11y += [ - "AccessibleWrap.h", - "HyperTextAccessibleWrap.h", - "SessionAccessibility.h", - "TraversalRule.h", +EXPORTS.mozilla.a11y += ['AccessibleWrap.h', + 'HyperTextAccessibleWrap.h', + 'SessionAccessibility.h', + 'TraversalRule.h', ] SOURCES += [ - "AccessibleWrap.cpp", - "DocAccessibleWrap.cpp", - "Platform.cpp", - "ProxyAccessibleWrap.cpp", - "RootAccessibleWrap.cpp", - "SessionAccessibility.cpp", - "TraversalRule.cpp", + 'AccessibleWrap.cpp', + 'DocAccessibleWrap.cpp', + 'Platform.cpp', + 'ProxyAccessibleWrap.cpp', + 'RootAccessibleWrap.cpp', + 'SessionAccessibility.cpp', + 'TraversalRule.cpp', ] LOCAL_INCLUDES += [ - "/accessible/base", - "/accessible/generic", - "/accessible/html", - "/accessible/ipc", - "/accessible/ipc/other", - "/accessible/xpcom", - "/accessible/xul", - "/dom/base", - "/widget", - "/widget/android", + '/accessible/base', + '/accessible/generic', + '/accessible/html', + '/accessible/ipc', + '/accessible/ipc/other', + '/accessible/xpcom', + '/accessible/xul', + '/dom/base', + '/widget', + '/widget/android', ] -FINAL_LIBRARY = "xul" +FINAL_LIBRARY = 'xul' -include("/ipc/chromium/chromium-config.mozbuild") +include('/ipc/chromium/chromium-config.mozbuild') -if CONFIG["CC_TYPE"] in ("clang", "gcc"): - CXXFLAGS += ["-Wno-error=shadow"] +if CONFIG['CC_TYPE'] in ('clang', 'gcc'): + CXXFLAGS += ['-Wno-error=shadow'] diff --git a/accessible/aom/moz.build b/accessible/aom/moz.build index 88b941435ee8..15bdeeaa792c 100644 --- a/accessible/aom/moz.build +++ b/accessible/aom/moz.build @@ -5,40 +5,40 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. EXPORTS.mozilla.dom += [ - "AccessibleNode.h", + 'AccessibleNode.h', ] UNIFIED_SOURCES += [ - "AccessibleNode.cpp", + 'AccessibleNode.cpp', ] LOCAL_INCLUDES += [ - "/accessible/base", - "/accessible/generic", + '/accessible/base', + '/accessible/generic', ] -if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk': LOCAL_INCLUDES += [ - "/accessible/atk", + '/accessible/atk', ] -elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows": +elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': LOCAL_INCLUDES += [ - "/accessible/windows/ia2", - "/accessible/windows/msaa", + '/accessible/windows/ia2', + '/accessible/windows/msaa', ] -elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa": +elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': LOCAL_INCLUDES += [ - "/accessible/mac", + '/accessible/mac', ] -elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android": +elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': LOCAL_INCLUDES += [ - "/accessible/android", + '/accessible/android', ] else: LOCAL_INCLUDES += [ - "/accessible/other", + '/accessible/other', ] -include("/ipc/chromium/chromium-config.mozbuild") +include('/ipc/chromium/chromium-config.mozbuild') -FINAL_LIBRARY = "xul" +FINAL_LIBRARY = 'xul' diff --git a/accessible/atk/moz.build b/accessible/atk/moz.build index 67fb1b9bc2c7..1029db426923 100644 --- a/accessible/atk/moz.build +++ b/accessible/atk/moz.build @@ -5,61 +5,61 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. EXPORTS.mozilla.a11y += [ - "AccessibleWrap.h", - "HyperTextAccessibleWrap.h", + 'AccessibleWrap.h', + 'HyperTextAccessibleWrap.h', ] SOURCES += [ - "AccessibleWrap.cpp", - "ApplicationAccessibleWrap.cpp", - "AtkSocketAccessible.cpp", - "DocAccessibleWrap.cpp", - "DOMtoATK.cpp", - "nsMaiHyperlink.cpp", - "nsMaiInterfaceAction.cpp", - "nsMaiInterfaceComponent.cpp", - "nsMaiInterfaceDocument.cpp", - "nsMaiInterfaceEditableText.cpp", - "nsMaiInterfaceHyperlinkImpl.cpp", - "nsMaiInterfaceHypertext.cpp", - "nsMaiInterfaceImage.cpp", - "nsMaiInterfaceSelection.cpp", - "nsMaiInterfaceTable.cpp", - "nsMaiInterfaceTableCell.cpp", - "nsMaiInterfaceText.cpp", - "nsMaiInterfaceValue.cpp", - "Platform.cpp", - "RootAccessibleWrap.cpp", - "UtilInterface.cpp", + 'AccessibleWrap.cpp', + 'ApplicationAccessibleWrap.cpp', + 'AtkSocketAccessible.cpp', + 'DocAccessibleWrap.cpp', + 'DOMtoATK.cpp', + 'nsMaiHyperlink.cpp', + 'nsMaiInterfaceAction.cpp', + 'nsMaiInterfaceComponent.cpp', + 'nsMaiInterfaceDocument.cpp', + 'nsMaiInterfaceEditableText.cpp', + 'nsMaiInterfaceHyperlinkImpl.cpp', + 'nsMaiInterfaceHypertext.cpp', + 'nsMaiInterfaceImage.cpp', + 'nsMaiInterfaceSelection.cpp', + 'nsMaiInterfaceTable.cpp', + 'nsMaiInterfaceTableCell.cpp', + 'nsMaiInterfaceText.cpp', + 'nsMaiInterfaceValue.cpp', + 'Platform.cpp', + 'RootAccessibleWrap.cpp', + 'UtilInterface.cpp', ] LOCAL_INCLUDES += [ - "/accessible/base", - "/accessible/generic", - "/accessible/html", - "/accessible/ipc", - "/accessible/ipc/other", - "/accessible/xpcom", - "/accessible/xul", - "/other-licenses/atk-1.0", + '/accessible/base', + '/accessible/generic', + '/accessible/html', + '/accessible/ipc', + '/accessible/ipc/other', + '/accessible/xpcom', + '/accessible/xul', + '/other-licenses/atk-1.0', ] -FINAL_LIBRARY = "xul" +FINAL_LIBRARY = 'xul' -if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": - CFLAGS += CONFIG["TK_CFLAGS"] - CXXFLAGS += CONFIG["TK_CFLAGS"] +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk': + CFLAGS += CONFIG['TK_CFLAGS'] + CXXFLAGS += CONFIG['TK_CFLAGS'] -if CONFIG["MOZ_ENABLE_DBUS"]: - CXXFLAGS += CONFIG["MOZ_DBUS_CFLAGS"] +if CONFIG['MOZ_ENABLE_DBUS']: + CXXFLAGS += CONFIG['MOZ_DBUS_CFLAGS'] -include("/ipc/chromium/chromium-config.mozbuild") +include('/ipc/chromium/chromium-config.mozbuild') -if CONFIG["CC_TYPE"] in ("clang", "gcc"): +if CONFIG['CC_TYPE'] in ('clang', 'gcc'): # Used in G_DEFINE_TYPE_EXTENDED macro, probably fixed in newer glib / # gobject headers. See bug 1243331 comment 3. CXXFLAGS += [ - "-Wno-error=unused-function", - "-Wno-error=shadow", - "-Wno-unused-local-typedefs", + '-Wno-error=unused-function', + '-Wno-error=shadow', + '-Wno-unused-local-typedefs', ] diff --git a/accessible/base/moz.build b/accessible/base/moz.build index 6eb2d96b04a4..e577a4af1318 100644 --- a/accessible/base/moz.build +++ b/accessible/base/moz.build @@ -4,114 +4,117 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -EXPORTS += ["AccEvent.h", "nsAccessibilityService.h"] +EXPORTS += [ + 'AccEvent.h', + 'nsAccessibilityService.h' +] EXPORTS.mozilla.a11y += [ - "AccTypes.h", - "DocManager.h", - "FocusManager.h", - "IDSet.h", - "Platform.h", - "RelationType.h", - "Role.h", - "SelectionManager.h", - "States.h", + 'AccTypes.h', + 'DocManager.h', + 'FocusManager.h', + 'IDSet.h', + 'Platform.h', + 'RelationType.h', + 'Role.h', + 'SelectionManager.h', + 'States.h', ] -if CONFIG["MOZ_DEBUG"]: +if CONFIG['MOZ_DEBUG']: EXPORTS.mozilla.a11y += [ - "Logging.h", + 'Logging.h', ] UNIFIED_SOURCES += [ - "AccessibleOrProxy.cpp", - "AccEvent.cpp", - "AccGroupInfo.cpp", - "AccIterator.cpp", - "ARIAMap.cpp", - "ARIAStateMap.cpp", - "Asserts.cpp", - "DocManager.cpp", - "EmbeddedObjCollector.cpp", - "EventQueue.cpp", - "EventTree.cpp", - "Filters.cpp", - "FocusManager.cpp", - "NotificationController.cpp", - "nsAccessibilityService.cpp", - "nsAccessiblePivot.cpp", - "nsAccUtils.cpp", - "nsCoreUtils.cpp", - "nsEventShell.cpp", - "nsTextEquivUtils.cpp", - "Pivot.cpp", - "SelectionManager.cpp", - "StyleInfo.cpp", - "TextAttrs.cpp", - "TextRange.cpp", - "TextUpdater.cpp", - "TreeWalker.cpp", + 'AccessibleOrProxy.cpp', + 'AccEvent.cpp', + 'AccGroupInfo.cpp', + 'AccIterator.cpp', + 'ARIAMap.cpp', + 'ARIAStateMap.cpp', + 'Asserts.cpp', + 'DocManager.cpp', + 'EmbeddedObjCollector.cpp', + 'EventQueue.cpp', + 'EventTree.cpp', + 'Filters.cpp', + 'FocusManager.cpp', + 'NotificationController.cpp', + 'nsAccessibilityService.cpp', + 'nsAccessiblePivot.cpp', + 'nsAccUtils.cpp', + 'nsCoreUtils.cpp', + 'nsEventShell.cpp', + 'nsTextEquivUtils.cpp', + 'Pivot.cpp', + 'SelectionManager.cpp', + 'StyleInfo.cpp', + 'TextAttrs.cpp', + 'TextRange.cpp', + 'TextUpdater.cpp', + 'TreeWalker.cpp', ] -if CONFIG["A11Y_LOG"]: +if CONFIG['A11Y_LOG']: UNIFIED_SOURCES += [ - "Logging.cpp", + 'Logging.cpp', ] LOCAL_INCLUDES += [ - "/accessible/generic", - "/accessible/html", - "/accessible/ipc", - "/dom/base", - "/dom/xul", + '/accessible/generic', + '/accessible/html', + '/accessible/ipc', + '/dom/base', + '/dom/xul', ] -if CONFIG["OS_ARCH"] == "WINNT": +if CONFIG['OS_ARCH'] == 'WINNT': LOCAL_INCLUDES += [ - "/accessible/ipc/win", + '/accessible/ipc/win', ] else: LOCAL_INCLUDES += [ - "/accessible/ipc/other", + '/accessible/ipc/other', ] LOCAL_INCLUDES += [ - "/accessible/xpcom", - "/accessible/xul", - "/dom/base", - "/ipc/chromium/src", - "/layout/generic", - "/layout/style", - "/layout/xul", - "/layout/xul/tree/", + '/accessible/xpcom', + '/accessible/xul', + '/dom/base', + '/ipc/chromium/src', + '/layout/generic', + '/layout/style', + '/layout/xul', + '/layout/xul/tree/', ] -if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk': LOCAL_INCLUDES += [ - "/accessible/atk", + '/accessible/atk', ] - CXXFLAGS += CONFIG["MOZ_CAIRO_CFLAGS"] -elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows": + CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS'] +elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': LOCAL_INCLUDES += [ - "/accessible/windows/ia2", - "/accessible/windows/msaa", + '/accessible/windows/ia2', + '/accessible/windows/msaa', ] -elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa": +elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': LOCAL_INCLUDES += [ - "/accessible/mac", + '/accessible/mac', ] -elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android": +elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': LOCAL_INCLUDES += [ - "/accessible/android", + '/accessible/android', ] else: LOCAL_INCLUDES += [ - "/accessible/other", + '/accessible/other', ] -FINAL_LIBRARY = "xul" +FINAL_LIBRARY = 'xul' -include("/ipc/chromium/chromium-config.mozbuild") +include('/ipc/chromium/chromium-config.mozbuild') -if CONFIG["CC_TYPE"] in ("clang", "gcc"): - CXXFLAGS += ["-Wno-error=shadow"] +if CONFIG['CC_TYPE'] in ('clang', 'gcc'): + CXXFLAGS += ['-Wno-error=shadow'] diff --git a/accessible/generic/moz.build b/accessible/generic/moz.build index 8612b7d6f661..7c0899dc409d 100644 --- a/accessible/generic/moz.build +++ b/accessible/generic/moz.build @@ -5,73 +5,73 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. EXPORTS.mozilla.a11y += [ - "Accessible.h", - "DocAccessible.h", - "HyperTextAccessible.h", - "OuterDocAccessible.h", + 'Accessible.h', + 'DocAccessible.h', + 'HyperTextAccessible.h', + 'OuterDocAccessible.h', ] UNIFIED_SOURCES += [ - "Accessible.cpp", - "ApplicationAccessible.cpp", - "ARIAGridAccessible.cpp", - "BaseAccessibles.cpp", - "DocAccessible.cpp", - "FormControlAccessible.cpp", - "HyperTextAccessible.cpp", - "ImageAccessible.cpp", - "OuterDocAccessible.cpp", - "RootAccessible.cpp", - "TableAccessible.cpp", - "TableCellAccessible.cpp", - "TextLeafAccessible.cpp", + 'Accessible.cpp', + 'ApplicationAccessible.cpp', + 'ARIAGridAccessible.cpp', + 'BaseAccessibles.cpp', + 'DocAccessible.cpp', + 'FormControlAccessible.cpp', + 'HyperTextAccessible.cpp', + 'ImageAccessible.cpp', + 'OuterDocAccessible.cpp', + 'RootAccessible.cpp', + 'TableAccessible.cpp', + 'TableCellAccessible.cpp', + 'TextLeafAccessible.cpp', ] LOCAL_INCLUDES += [ - "/accessible/base", - "/accessible/html", - "/accessible/xpcom", - "/accessible/xul", - "/dom/base", - "/dom/xul", - "/layout/generic", - "/layout/xul", + '/accessible/base', + '/accessible/html', + '/accessible/xpcom', + '/accessible/xul', + '/dom/base', + '/dom/xul', + '/layout/generic', + '/layout/xul', ] -if CONFIG["OS_ARCH"] == "WINNT": +if CONFIG['OS_ARCH'] == 'WINNT': LOCAL_INCLUDES += [ - "/accessible/ipc/win", + '/accessible/ipc/win', ] else: LOCAL_INCLUDES += [ - "/accessible/ipc/other", + '/accessible/ipc/other', ] -if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk': LOCAL_INCLUDES += [ - "/accessible/atk", + '/accessible/atk', ] -elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows": +elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': LOCAL_INCLUDES += [ - "/accessible/windows/ia2", - "/accessible/windows/msaa", + '/accessible/windows/ia2', + '/accessible/windows/msaa', ] -elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa": +elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': LOCAL_INCLUDES += [ - "/accessible/mac", + '/accessible/mac', ] -elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android": +elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': LOCAL_INCLUDES += [ - "/accessible/android", + '/accessible/android', ] else: LOCAL_INCLUDES += [ - "/accessible/other", + '/accessible/other', ] -FINAL_LIBRARY = "xul" +FINAL_LIBRARY = 'xul' -include("/ipc/chromium/chromium-config.mozbuild") +include('/ipc/chromium/chromium-config.mozbuild') -if CONFIG["CC_TYPE"] in ("clang", "gcc"): - CXXFLAGS += ["-Wno-error=shadow"] +if CONFIG['CC_TYPE'] in ('clang', 'gcc'): + CXXFLAGS += ['-Wno-error=shadow'] diff --git a/accessible/html/moz.build b/accessible/html/moz.build index 5b74f6741fb6..3f778b11a6a0 100644 --- a/accessible/html/moz.build +++ b/accessible/html/moz.build @@ -5,51 +5,51 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. UNIFIED_SOURCES += [ - "HTMLCanvasAccessible.cpp", - "HTMLElementAccessibles.cpp", - "HTMLFormControlAccessible.cpp", - "HTMLImageMapAccessible.cpp", - "HTMLLinkAccessible.cpp", - "HTMLListAccessible.cpp", - "HTMLSelectAccessible.cpp", - "HTMLTableAccessible.cpp", + 'HTMLCanvasAccessible.cpp', + 'HTMLElementAccessibles.cpp', + 'HTMLFormControlAccessible.cpp', + 'HTMLImageMapAccessible.cpp', + 'HTMLLinkAccessible.cpp', + 'HTMLListAccessible.cpp', + 'HTMLSelectAccessible.cpp', + 'HTMLTableAccessible.cpp', ] LOCAL_INCLUDES += [ - "/accessible/base", - "/accessible/generic", - "/accessible/xpcom", - "/layout/forms", - "/layout/generic", - "/layout/tables", - "/layout/xul", + '/accessible/base', + '/accessible/generic', + '/accessible/xpcom', + '/layout/forms', + '/layout/generic', + '/layout/tables', + '/layout/xul', ] -if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk': LOCAL_INCLUDES += [ - "/accessible/atk", + '/accessible/atk', ] -elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows": +elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': LOCAL_INCLUDES += [ - "/accessible/windows/ia2", - "/accessible/windows/msaa", + '/accessible/windows/ia2', + '/accessible/windows/msaa', ] -elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa": +elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': LOCAL_INCLUDES += [ - "/accessible/mac", + '/accessible/mac', ] -elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android": +elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': LOCAL_INCLUDES += [ - "/accessible/android", + '/accessible/android', ] else: LOCAL_INCLUDES += [ - "/accessible/other", + '/accessible/other', ] -include("/ipc/chromium/chromium-config.mozbuild") +include('/ipc/chromium/chromium-config.mozbuild') -FINAL_LIBRARY = "xul" +FINAL_LIBRARY = 'xul' -if CONFIG["CC_TYPE"] in ("clang", "gcc"): - CXXFLAGS += ["-Wno-error=shadow"] +if CONFIG['CC_TYPE'] in ('clang', 'gcc'): + CXXFLAGS += ['-Wno-error=shadow'] diff --git a/accessible/interfaces/gecko/moz.build b/accessible/interfaces/gecko/moz.build index bc0ecb3ef220..ea953ab41d87 100644 --- a/accessible/interfaces/gecko/moz.build +++ b/accessible/interfaces/gecko/moz.build @@ -4,36 +4,30 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -GeneratedFile( - "IGeckoCustom.h", - "IGeckoCustom_p.c", - "IGeckoCustom_i.c", - "IGeckoCustom_dlldata.c", - "IGeckoCustom.tlb", - inputs=["IGeckoCustom.idl"], - script="/build/midl.py", - entry_point="midl", - flags=["-dlldata", OBJDIR + "/IGeckoCustom_dlldata.c"], -) +GeneratedFile('IGeckoCustom.h', 'IGeckoCustom_p.c', 'IGeckoCustom_i.c', + 'IGeckoCustom_dlldata.c', 'IGeckoCustom.tlb', + inputs=['IGeckoCustom.idl'], + script='/build/midl.py', entry_point='midl', + flags=['-dlldata', OBJDIR + '/IGeckoCustom_dlldata.c']) SOURCES += [ - "!IGeckoCustom_dlldata.c", - "!IGeckoCustom_i.c", - "!IGeckoCustom_p.c", + '!IGeckoCustom_dlldata.c', + '!IGeckoCustom_i.c', + '!IGeckoCustom_p.c', ] EXPORTS += [ - "!IGeckoCustom.h", - "!IGeckoCustom_i.c", + '!IGeckoCustom.h', + '!IGeckoCustom_i.c', ] -FINAL_LIBRARY = "xul" +FINAL_LIBRARY = 'xul' # Suppress warnings from the MIDL generated code. -if CONFIG["CC_TYPE"] == "clang-cl": +if CONFIG['CC_TYPE'] == 'clang-cl': CFLAGS += [ - "-Wno-extern-initializer", - "-Wno-incompatible-pointer-types", - "-Wno-missing-braces", - "-Wno-unused-const-variable", + '-Wno-extern-initializer', + '-Wno-incompatible-pointer-types', + '-Wno-missing-braces', + '-Wno-unused-const-variable', ] diff --git a/accessible/interfaces/ia2/moz.build b/accessible/interfaces/ia2/moz.build index e3861a2fa2c1..00ad4add0cb2 100644 --- a/accessible/interfaces/ia2/moz.build +++ b/accessible/interfaces/ia2/moz.build @@ -4,128 +4,94 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -GeckoSharedLibrary("IA2Marshal", linkage=None) +GeckoSharedLibrary('IA2Marshal', linkage=None) -DEFINES["REGISTER_PROXY_DLL"] = True +DEFINES['REGISTER_PROXY_DLL'] = True -DEFFILE = "IA2Marshal.def" +DEFFILE = 'IA2Marshal.def' OS_LIBS += [ - "uuid", - "kernel32", - "rpcrt4", - "ole32", - "oleaut32", + 'uuid', + 'kernel32', + 'rpcrt4', + 'ole32', + 'oleaut32', ] midl_enums = [ - "AccessibleEventId", - "AccessibleRole", - "AccessibleStates", - "IA2CommonTypes", + 'AccessibleEventId', + 'AccessibleRole', + 'AccessibleStates', + 'IA2CommonTypes', ] midl_interfaces = [ - "Accessible2", - "Accessible2_2", - "Accessible2_3", - "AccessibleAction", - "AccessibleApplication", - "AccessibleComponent", - "AccessibleDocument", - "AccessibleEditableText", - "AccessibleHyperlink", - "AccessibleHypertext", - "AccessibleHypertext2", - "AccessibleImage", - "AccessibleRelation", - "AccessibleTable", - "AccessibleTable2", - "AccessibleTableCell", - "AccessibleText", - "AccessibleText2", - "AccessibleValue", + 'Accessible2', + 'Accessible2_2', + 'Accessible2_3', + 'AccessibleAction', + 'AccessibleApplication', + 'AccessibleComponent', + 'AccessibleDocument', + 'AccessibleEditableText', + 'AccessibleHyperlink', + 'AccessibleHypertext', + 'AccessibleHypertext2', + 'AccessibleImage', + 'AccessibleRelation', + 'AccessibleTable', + 'AccessibleTable2', + 'AccessibleTableCell', + 'AccessibleText', + 'AccessibleText2', + 'AccessibleValue', ] for enum in midl_enums: - GeneratedFile( - enum + ".h", - inputs=["/other-licenses/ia2/" + enum + ".idl"], - script="/build/midl.py", - entry_point="midl", - flags=["-app_config", "-I", TOPSRCDIR + "/other-licenses/ia2"], - ) + GeneratedFile(enum + '.h', inputs=['/other-licenses/ia2/' + enum + '.idl'], + script='/build/midl.py', entry_point='midl', + flags=['-app_config', '-I', TOPSRCDIR + '/other-licenses/ia2']) - EXPORTS += ["!" + enum + ".h"] + EXPORTS += ['!' + enum + '.h'] for iface in midl_interfaces: - GeneratedFile( - iface + ".h", - iface + "_p.c", - iface + "_i.c", - iface + "_dlldata.c", - inputs=["/other-licenses/ia2/" + iface + ".idl"], - script="/build/midl.py", - entry_point="midl", - flags=[ - "-app_config", - "-I", - TOPSRCDIR + "/other-licenses/ia2", - "-dlldata", - OBJDIR + "/" + iface + "_dlldata.c", - ], - ) - - EXPORTS += ["!" + iface + ".h", "!" + iface + "_i.c"] - - for p in [iface + "_p.c", iface + "_i.c"]: - SOURCES += ["!%s" % p] + GeneratedFile(iface + '.h', iface + '_p.c', iface + '_i.c', iface + '_dlldata.c', + inputs=['/other-licenses/ia2/' + iface + '.idl'], + script='/build/midl.py', entry_point='midl', + flags=['-app_config', '-I', TOPSRCDIR + '/other-licenses/ia2', + '-dlldata', OBJDIR + '/' + iface + '_dlldata.c']) + + EXPORTS += ['!' + iface + '.h', '!' + iface + '_i.c'] + + for p in [iface + '_p.c', iface + '_i.c']: + SOURCES += ['!%s' % p] # Give some symbols a unique name in each translation unit, to avoid # collisions caused by https://llvm.org/pr41817. - if CONFIG["CC_TYPE"] == "clang-cl": - SOURCES["!%s" % p].flags += [ - "-DObject_StubDesc=Object_StubDesc__%s" % p[:-2] - ] - SOURCES["!%s" % p].flags += [ - "-DUserMarshalRoutines=UserMarshalRoutines__%s" % p[:-2] - ] + if CONFIG['CC_TYPE'] == 'clang-cl': + SOURCES['!%s' % p].flags += ['-DObject_StubDesc=Object_StubDesc__%s' % p[:-2]] + SOURCES['!%s' % p].flags += ['-DUserMarshalRoutines=UserMarshalRoutines__%s' % p[:-2]] # Warning: the build system doesn't know about the dependency of IA2Marshal.rc on # IA2Typelib.tlb. We rely on the IA2Typelib.h output forcing the command to run # during export, before rc files are treated during compile. -GeneratedFile( - "IA2Typelib.h", - "IA2Typelib_i.c", - "IA2Typelib.tlb", - inputs=["IA2Typelib.idl"], - script="/build/midl.py", - entry_point="midl", - flags=[ - "-app_config", - "-I", - TOPSRCDIR + "/other-licenses/ia2", - "-D", - "_MIDL_DECLARE_WIREM_HANDLE", - ], -) - -GeneratedFile( - "dlldata.c", - inputs=["!" + iface + "_dlldata.c" for iface in midl_interfaces], - script="/build/midl.py", - entry_point="merge_dlldata", -) - -SOURCES += ["!dlldata.c"] - -RCINCLUDE = "IA2Marshal.rc" +GeneratedFile('IA2Typelib.h', 'IA2Typelib_i.c', 'IA2Typelib.tlb', + inputs=['IA2Typelib.idl'], script='/build/midl.py', entry_point='midl', + flags=['-app_config', '-I', TOPSRCDIR + '/other-licenses/ia2', + '-D', '_MIDL_DECLARE_WIREM_HANDLE']) + +GeneratedFile('dlldata.c', inputs=['!' + iface + '_dlldata.c' for iface in midl_interfaces], + script='/build/midl.py', entry_point='merge_dlldata') + +SOURCES += ['!dlldata.c'] + +RCINCLUDE = 'IA2Marshal.rc' # Suppress warnings from the MIDL generated code. -if CONFIG["CC_TYPE"] == "clang-cl": +if CONFIG['CC_TYPE'] == 'clang-cl': CFLAGS += [ - "-Wno-extern-initializer", - "-Wno-incompatible-pointer-types", - "-Wno-missing-braces", - "-Wno-unused-const-variable", + '-Wno-extern-initializer', + '-Wno-incompatible-pointer-types', + '-Wno-missing-braces', + '-Wno-unused-const-variable', ] diff --git a/accessible/interfaces/moz.build b/accessible/interfaces/moz.build index c5b6be6347d3..093b7d9eeb42 100644 --- a/accessible/interfaces/moz.build +++ b/accessible/interfaces/moz.build @@ -4,42 +4,42 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -if CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows" and CONFIG["COMPILE_ENVIRONMENT"]: - DIRS += ["gecko", "msaa", "ia2"] +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows' and CONFIG['COMPILE_ENVIRONMENT']: + DIRS += ['gecko', 'msaa', 'ia2'] -if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa": - XPIDL_SOURCES += ["nsIAccessibleMacInterface.idl"] +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': + XPIDL_SOURCES += ['nsIAccessibleMacInterface.idl'] XPIDL_SOURCES += [ - "nsIAccessibilityService.idl", - "nsIAccessible.idl", - "nsIAccessibleAnnouncementEvent.idl", - "nsIAccessibleApplication.idl", - "nsIAccessibleCaretMoveEvent.idl", - "nsIAccessibleDocument.idl", - "nsIAccessibleEditableText.idl", - "nsIAccessibleEvent.idl", - "nsIAccessibleHideEvent.idl", - "nsIAccessibleHyperLink.idl", - "nsIAccessibleHyperText.idl", - "nsIAccessibleImage.idl", - "nsIAccessibleObjectAttributeChangedEvent.idl", - "nsIAccessiblePivot.idl", - "nsIAccessibleRelation.idl", - "nsIAccessibleRole.idl", - "nsIAccessibleScrollingEvent.idl", - "nsIAccessibleSelectable.idl", - "nsIAccessibleStateChangeEvent.idl", - "nsIAccessibleStates.idl", - "nsIAccessibleTable.idl", - "nsIAccessibleTableChangeEvent.idl", - "nsIAccessibleText.idl", - "nsIAccessibleTextChangeEvent.idl", - "nsIAccessibleTextRange.idl", - "nsIAccessibleTextSelectionChangeEvent.idl", - "nsIAccessibleTypes.idl", - "nsIAccessibleValue.idl", - "nsIAccessibleVirtualCursorChangeEvent.idl", + 'nsIAccessibilityService.idl', + 'nsIAccessible.idl', + 'nsIAccessibleAnnouncementEvent.idl', + 'nsIAccessibleApplication.idl', + 'nsIAccessibleCaretMoveEvent.idl', + 'nsIAccessibleDocument.idl', + 'nsIAccessibleEditableText.idl', + 'nsIAccessibleEvent.idl', + 'nsIAccessibleHideEvent.idl', + 'nsIAccessibleHyperLink.idl', + 'nsIAccessibleHyperText.idl', + 'nsIAccessibleImage.idl', + 'nsIAccessibleObjectAttributeChangedEvent.idl', + 'nsIAccessiblePivot.idl', + 'nsIAccessibleRelation.idl', + 'nsIAccessibleRole.idl', + 'nsIAccessibleScrollingEvent.idl', + 'nsIAccessibleSelectable.idl', + 'nsIAccessibleStateChangeEvent.idl', + 'nsIAccessibleStates.idl', + 'nsIAccessibleTable.idl', + 'nsIAccessibleTableChangeEvent.idl', + 'nsIAccessibleText.idl', + 'nsIAccessibleTextChangeEvent.idl', + 'nsIAccessibleTextRange.idl', + 'nsIAccessibleTextSelectionChangeEvent.idl', + 'nsIAccessibleTypes.idl', + 'nsIAccessibleValue.idl', + 'nsIAccessibleVirtualCursorChangeEvent.idl', ] -XPIDL_MODULE = "accessibility" +XPIDL_MODULE = 'accessibility' diff --git a/accessible/interfaces/msaa/moz.build b/accessible/interfaces/msaa/moz.build index 7a1053317a37..72468dd00c5d 100644 --- a/accessible/interfaces/msaa/moz.build +++ b/accessible/interfaces/msaa/moz.build @@ -4,54 +4,48 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -GeckoSharedLibrary("AccessibleMarshal", linkage=None) +GeckoSharedLibrary('AccessibleMarshal', linkage=None) # Missing here, is the notion that changes to the idl files included by # ISimpleDOM.idl (e.g. ISimpleDOMNode.idl) should rebuild the outputs. -GeneratedFile( - "ISimpleDOM.h", - "ISimpleDOM_p.c", - "ISimpleDOM_i.c", - "ISimpleDOM_dlldata.c", - "ISimpleDOM.tlb", - inputs=["ISimpleDOM.idl"], - script="/build/midl.py", - entry_point="midl", - flags=["-I", SRCDIR, "-robust", "-dlldata", OBJDIR + "/ISimpleDOM_dlldata.c"], -) +GeneratedFile('ISimpleDOM.h', 'ISimpleDOM_p.c', 'ISimpleDOM_i.c', + 'ISimpleDOM_dlldata.c', 'ISimpleDOM.tlb', + inputs=['ISimpleDOM.idl'], + script='/build/midl.py', entry_point='midl', + flags=['-I', SRCDIR, '-robust', '-dlldata', OBJDIR + '/ISimpleDOM_dlldata.c']) SOURCES += [ - "!ISimpleDOM_dlldata.c", - "!ISimpleDOM_i.c", - "!ISimpleDOM_p.c", - "AccessibleMarshalThunk.c", + '!ISimpleDOM_dlldata.c', + '!ISimpleDOM_i.c', + '!ISimpleDOM_p.c', + 'AccessibleMarshalThunk.c', ] EXPORTS += [ - "!ISimpleDOM.h", - "!ISimpleDOM_i.c", + '!ISimpleDOM.h', + '!ISimpleDOM_i.c', ] -DEFINES["REGISTER_PROXY_DLL"] = True +DEFINES['REGISTER_PROXY_DLL'] = True # The following line is required to preserve compatibility with older versions # of AccessibleMarshal.dll. -DEFINES["PROXY_CLSID"] = "IID_ISimpleDOMNode" +DEFINES['PROXY_CLSID'] = 'IID_ISimpleDOMNode' -DEFFILE = "AccessibleMarshal.def" +DEFFILE = 'AccessibleMarshal.def' OS_LIBS += [ - "kernel32", - "rpcrt4", - "oleaut32", + 'kernel32', + 'rpcrt4', + 'oleaut32', ] -RCINCLUDE = "AccessibleMarshal.rc" +RCINCLUDE = 'AccessibleMarshal.rc' # Suppress warnings from the MIDL generated code. -if CONFIG["CC_TYPE"] == "clang-cl": +if CONFIG['CC_TYPE'] == 'clang-cl': CFLAGS += [ - "-Wno-extern-initializer", - "-Wno-incompatible-pointer-types", - "-Wno-missing-braces", - "-Wno-unused-const-variable", + '-Wno-extern-initializer', + '-Wno-incompatible-pointer-types', + '-Wno-missing-braces', + '-Wno-unused-const-variable', ] diff --git a/accessible/ipc/extension/android/moz.build b/accessible/ipc/extension/android/moz.build index 50871e326bce..ad4cbd6889a3 100644 --- a/accessible/ipc/extension/android/moz.build +++ b/accessible/ipc/extension/android/moz.build @@ -4,26 +4,26 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -if CONFIG["ACCESSIBILITY"]: - IPDL_SOURCES += ["PDocAccessiblePlatformExt.ipdl"] +if CONFIG['ACCESSIBILITY']: + IPDL_SOURCES += ['PDocAccessiblePlatformExt.ipdl'] EXPORTS.mozilla.a11y += [ - "DocAccessiblePlatformExtChild.h", - "DocAccessiblePlatformExtParent.h", + 'DocAccessiblePlatformExtChild.h', + 'DocAccessiblePlatformExtParent.h', ] SOURCES += [ - "DocAccessiblePlatformExtChild.cpp", - "DocAccessiblePlatformExtParent.cpp", + 'DocAccessiblePlatformExtChild.cpp', + 'DocAccessiblePlatformExtParent.cpp', ] LOCAL_INCLUDES += [ - "/accessible/android", - "/accessible/generic", - "/accessible/ipc/other", - "/widget/android", + '/accessible/android', + '/accessible/generic', + '/accessible/ipc/other', + '/widget/android', ] -include("/ipc/chromium/chromium-config.mozbuild") +include('/ipc/chromium/chromium-config.mozbuild') -FINAL_LIBRARY = "xul" +FINAL_LIBRARY = 'xul' diff --git a/accessible/ipc/extension/mac/moz.build b/accessible/ipc/extension/mac/moz.build index e7a7bf3bf8de..b3b75e12474f 100644 --- a/accessible/ipc/extension/mac/moz.build +++ b/accessible/ipc/extension/mac/moz.build @@ -4,25 +4,25 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -if CONFIG["ACCESSIBILITY"]: - IPDL_SOURCES += ["PDocAccessiblePlatformExt.ipdl"] +if CONFIG['ACCESSIBILITY']: + IPDL_SOURCES += ['PDocAccessiblePlatformExt.ipdl'] EXPORTS.mozilla.a11y += [ - "DocAccessiblePlatformExtChild.h", - "DocAccessiblePlatformExtParent.h", + 'DocAccessiblePlatformExtChild.h', + 'DocAccessiblePlatformExtParent.h', ] SOURCES += [ - "DocAccessiblePlatformExtChild.cpp", + 'DocAccessiblePlatformExtChild.cpp', ] LOCAL_INCLUDES += [ - "/accessible/base", - "/accessible/generic", - "/accessible/ipc/other", - "/accessible/mac", + '/accessible/base', + '/accessible/generic', + '/accessible/ipc/other', + '/accessible/mac', ] -include("/ipc/chromium/chromium-config.mozbuild") +include('/ipc/chromium/chromium-config.mozbuild') -FINAL_LIBRARY = "xul" +FINAL_LIBRARY = 'xul' diff --git a/accessible/ipc/extension/moz.build b/accessible/ipc/extension/moz.build index 3c82fd90b400..c532dfc83be8 100644 --- a/accessible/ipc/extension/moz.build +++ b/accessible/ipc/extension/moz.build @@ -4,11 +4,11 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -toolkit = CONFIG["MOZ_WIDGET_TOOLKIT"] +toolkit = CONFIG['MOZ_WIDGET_TOOLKIT'] -if toolkit == "android": - DIRS += ["android"] -elif toolkit == "cocoa": - DIRS += ["mac"] +if toolkit == 'android': + DIRS += ['android'] +elif toolkit == 'cocoa': + DIRS += ['mac'] else: - DIRS += ["other"] + DIRS += ['other'] diff --git a/accessible/ipc/extension/other/moz.build b/accessible/ipc/extension/other/moz.build index dbbc98702c4a..1a4030e4f45c 100644 --- a/accessible/ipc/extension/other/moz.build +++ b/accessible/ipc/extension/other/moz.build @@ -4,14 +4,14 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -if CONFIG["ACCESSIBILITY"]: - IPDL_SOURCES += ["PDocAccessiblePlatformExt.ipdl"] +if CONFIG['ACCESSIBILITY']: + IPDL_SOURCES += ['PDocAccessiblePlatformExt.ipdl'] EXPORTS.mozilla.a11y += [ - "DocAccessiblePlatformExtChild.h", - "DocAccessiblePlatformExtParent.h", + 'DocAccessiblePlatformExtChild.h', + 'DocAccessiblePlatformExtParent.h', ] -include("/ipc/chromium/chromium-config.mozbuild") +include('/ipc/chromium/chromium-config.mozbuild') -FINAL_LIBRARY = "xul" +FINAL_LIBRARY = 'xul' diff --git a/accessible/ipc/moz.build b/accessible/ipc/moz.build index b50625e40ee0..57d731005026 100644 --- a/accessible/ipc/moz.build +++ b/accessible/ipc/moz.build @@ -4,65 +4,65 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -if CONFIG["OS_ARCH"] == "WINNT": - DIRS += ["win"] +if CONFIG['OS_ARCH'] == 'WINNT': + DIRS += ['win'] LOCAL_INCLUDES += [ - "/accessible/ipc/win", - "/accessible/windows/ia2", - "/accessible/windows/msaa", + '/accessible/ipc/win', + '/accessible/windows/ia2', + '/accessible/windows/msaa', ] else: - DIRS += ["other", "extension"] + DIRS += ['other', 'extension'] LOCAL_INCLUDES += [ - "/accessible/ipc/other", + '/accessible/ipc/other', ] - if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": + if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk': LOCAL_INCLUDES += [ - "/accessible/atk", + '/accessible/atk', ] - elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa": + elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': LOCAL_INCLUDES += [ - "/accessible/mac", + '/accessible/mac', ] - elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android": + elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': LOCAL_INCLUDES += [ - "/accessible/android", + '/accessible/android', ] else: LOCAL_INCLUDES += [ - "/accessible/other", + '/accessible/other', ] EXPORTS.mozilla.a11y += [ - "IPCTypes.h", + 'IPCTypes.h', ] -if CONFIG["CC_TYPE"] in ("clang", "gcc"): - CXXFLAGS += ["-Wno-error=shadow"] +if CONFIG['CC_TYPE'] in ('clang', 'gcc'): + CXXFLAGS += ['-Wno-error=shadow'] -if CONFIG["ACCESSIBILITY"]: +if CONFIG['ACCESSIBILITY']: EXPORTS.mozilla.a11y += [ - "DocAccessibleChildBase.h", - "DocAccessibleParent.h", - "ProxyAccessibleBase.h", - "ProxyAccessibleShared.h", + 'DocAccessibleChildBase.h', + 'DocAccessibleParent.h', + 'ProxyAccessibleBase.h', + 'ProxyAccessibleShared.h', ] UNIFIED_SOURCES += [ - "DocAccessibleChildBase.cpp", - "DocAccessibleParent.cpp", - "ProxyAccessibleBase.cpp", + 'DocAccessibleChildBase.cpp', + 'DocAccessibleParent.cpp', + 'ProxyAccessibleBase.cpp', ] LOCAL_INCLUDES += [ - "/accessible/base", - "/accessible/generic", - "/accessible/xpcom", + '/accessible/base', + '/accessible/generic', + '/accessible/xpcom', ] -include("/ipc/chromium/chromium-config.mozbuild") +include('/ipc/chromium/chromium-config.mozbuild') -FINAL_LIBRARY = "xul" +FINAL_LIBRARY = 'xul' # Add libFuzzer configuration directives -include("/tools/fuzzing/libfuzzer-config.mozbuild") +include('/tools/fuzzing/libfuzzer-config.mozbuild') diff --git a/accessible/ipc/other/moz.build b/accessible/ipc/other/moz.build index db386c6eb3e5..129b9dffee3d 100644 --- a/accessible/ipc/other/moz.build +++ b/accessible/ipc/other/moz.build @@ -5,48 +5,48 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. -if CONFIG["ACCESSIBILITY"]: - IPDL_SOURCES += ["PDocAccessible.ipdl"] +if CONFIG['ACCESSIBILITY']: + IPDL_SOURCES += ['PDocAccessible.ipdl'] EXPORTS.mozilla.a11y += [ - "DocAccessibleChild.h", - "ProxyAccessible.h", + 'DocAccessibleChild.h', + 'ProxyAccessible.h', ] SOURCES += [ - "DocAccessibleChild.cpp", - "ProxyAccessible.cpp", + 'DocAccessibleChild.cpp', + 'ProxyAccessible.cpp', ] LOCAL_INCLUDES += [ - "../../base", - "../../generic", - "../../xpcom", + '../../base', + '../../generic', + '../../xpcom', ] - if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": + if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk': LOCAL_INCLUDES += [ - "/accessible/atk", + '/accessible/atk', ] - elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa": + elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': LOCAL_INCLUDES += [ - "/accessible/mac", + '/accessible/mac', ] - elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android": + elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': LOCAL_INCLUDES += [ - "/accessible/android", + '/accessible/android', ] else: LOCAL_INCLUDES += [ - "/accessible/other", + '/accessible/other', ] -include("/ipc/chromium/chromium-config.mozbuild") +include('/ipc/chromium/chromium-config.mozbuild') # Add libFuzzer configuration directives -include("/tools/fuzzing/libfuzzer-config.mozbuild") +include('/tools/fuzzing/libfuzzer-config.mozbuild') -if CONFIG["CC_TYPE"] in ("clang", "gcc"): - CXXFLAGS += ["-Wno-error=shadow"] +if CONFIG['CC_TYPE'] in ('clang', 'gcc'): + CXXFLAGS += ['-Wno-error=shadow'] -FINAL_LIBRARY = "xul" +FINAL_LIBRARY = 'xul' diff --git a/accessible/ipc/win/handler/moz.build b/accessible/ipc/win/handler/moz.build index 1c57026012dd..4e13b363ca6a 100644 --- a/accessible/ipc/win/handler/moz.build +++ b/accessible/ipc/win/handler/moz.build @@ -4,16 +4,16 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -SharedLibrary("AccessibleHandler") +SharedLibrary('AccessibleHandler') EXPORTS.mozilla.a11y += [ - "AccessibleHandler.h", - "HandlerDataCleanup.h", + 'AccessibleHandler.h', + 'HandlerDataCleanup.h', ] LOCAL_INCLUDES += [ - "/accessible/interfaces/ia2", - "/ipc/mscom/oop", + '/accessible/interfaces/ia2', + '/ipc/mscom/oop', ] # We want to generate distinct UUIDs on a per-channel basis, so we need @@ -21,103 +21,79 @@ LOCAL_INCLUDES += [ # These defines allow us to separate local builds from automated builds, # as well as separate beta from release. flags = [] -if CONFIG["MOZ_UPDATE_CHANNEL"] == "default": - flags += ["-DUSE_LOCAL_UUID"] -elif CONFIG["MOZ_UPDATE_CHANNEL"] == "beta": - flags += ["-DUSE_BETA_UUID"] - -GeneratedFile( - "HandlerData.h", - "HandlerData_p.c", - "HandlerData_i.c", - "HandlerData_c.c", - "HandlerData_dlldata.c", - "HandlerData.tlb", - inputs=["HandlerData.idl"], - script="/build/midl.py", - entry_point="midl", - flags=flags - + [ - "-I", - TOPOBJDIR, - "-I", - TOPOBJDIR + "/dist/include", - "-I", - TOPSRCDIR + "/other-licenses/ia2", - "-I", - SRCDIR, - "-acf", - SRCDIR + "/HandlerData.acf", - "-dlldata", - OBJDIR + "/HandlerData_dlldata.c", - ], -) +if CONFIG['MOZ_UPDATE_CHANNEL'] == 'default': + flags += ['-DUSE_LOCAL_UUID'] +elif CONFIG['MOZ_UPDATE_CHANNEL'] == 'beta': + flags += ['-DUSE_BETA_UUID'] + +GeneratedFile('HandlerData.h', 'HandlerData_p.c', 'HandlerData_i.c', 'HandlerData_c.c', + 'HandlerData_dlldata.c', 'HandlerData.tlb', + inputs=['HandlerData.idl'], + script='/build/midl.py', entry_point='midl', + flags=flags + ['-I', TOPOBJDIR, '-I', TOPOBJDIR + '/dist/include', + '-I', TOPSRCDIR + '/other-licenses/ia2', '-I', SRCDIR, + '-acf', SRCDIR + '/HandlerData.acf', + '-dlldata', OBJDIR + '/HandlerData_dlldata.c']) SOURCES += [ - "!HandlerData_c.c", - "!HandlerData_dlldata.c", - "!HandlerData_i.c", - "!HandlerData_p.c", - "AccessibleHandler.cpp", - "AccessibleHandlerControl.cpp", - "HandlerChildEnumerator.cpp", - "HandlerRelation.cpp", - "HandlerTextLeaf.cpp", + '!HandlerData_c.c', + '!HandlerData_dlldata.c', + '!HandlerData_i.c', + '!HandlerData_p.c', + 'AccessibleHandler.cpp', + 'AccessibleHandlerControl.cpp', + 'HandlerChildEnumerator.cpp', + 'HandlerRelation.cpp', + 'HandlerTextLeaf.cpp', ] EXPORTS += [ - "!HandlerData.h", - "!HandlerData_i.c", + '!HandlerData.h', + '!HandlerData_i.c', ] # Give some symbols a unique name in each translation unit, to avoid # collisions caused by https://llvm.org/pr41817. -if CONFIG["CC_TYPE"] == "clang-cl": - SOURCES["!HandlerData_p.c"].flags += [ - "-DHandlerData__MIDL_ProcFormatString=HandlerData__MIDL_ProcFormatString__HandlerData_p" - ] - SOURCES["!HandlerData_p.c"].flags += [ - "-DHandlerData__MIDL_TypeFormatString=HandlerData__MIDL_TypeFormatString__HandlerData_p" - ] - for p in ("dlldata", "c", "i", "p"): - SOURCES["!HandlerData_%s.c" % p].flags += [ - "-DUserMarshalRoutines=UserMarshalRoutines__HandlerData_%s" % p - ] +if CONFIG['CC_TYPE'] == 'clang-cl': + SOURCES['!HandlerData_p.c'].flags += ['-DHandlerData__MIDL_ProcFormatString=HandlerData__MIDL_ProcFormatString__HandlerData_p'] + SOURCES['!HandlerData_p.c'].flags += ['-DHandlerData__MIDL_TypeFormatString=HandlerData__MIDL_TypeFormatString__HandlerData_p'] + for p in ('dlldata', 'c', 'i', 'p'): + SOURCES['!HandlerData_%s.c' % p].flags += ['-DUserMarshalRoutines=UserMarshalRoutines__HandlerData_%s' % p] -DEFFILE = "AccessibleHandler.def" +DEFFILE = 'AccessibleHandler.def' USE_LIBS += [ - "mscom_oop", + 'mscom_oop', ] OS_LIBS += [ - "rpcrt4", - "oleacc", + 'rpcrt4', + 'oleacc', ] -RCINCLUDE = "AccessibleHandler.rc" +RCINCLUDE = 'AccessibleHandler.rc' # Suppress warnings from the MIDL generated code. -if CONFIG["CC_TYPE"] == "clang-cl": +if CONFIG['CC_TYPE'] == 'clang-cl': CFLAGS += [ - "-Wno-extern-initializer", - "-Wno-incompatible-pointer-types", - "-Wno-missing-braces", - "-Wno-unused-const-variable", + '-Wno-extern-initializer', + '-Wno-incompatible-pointer-types', + '-Wno-missing-braces', + '-Wno-unused-const-variable', ] # Since we are defining our own COM entry points (DllRegisterServer et al), # but we still want to be able to delegate some work to the generated code, # we add the prefix "Proxy" to all of the generated counterparts. -DEFINES["ENTRY_PREFIX"] = "Proxy" -DEFINES["REGISTER_PROXY_DLL"] = True -LIBRARY_DEFINES["MOZ_MSCOM_REMARSHAL_NO_HANDLER"] = True +DEFINES['ENTRY_PREFIX'] = 'Proxy' +DEFINES['REGISTER_PROXY_DLL'] = True +LIBRARY_DEFINES['MOZ_MSCOM_REMARSHAL_NO_HANDLER'] = True # This DLL may be loaded into other processes, so we need static libs for # Windows 7 and Windows 8. USE_STATIC_LIBS = True -LIBRARY_DEFINES["UNICODE"] = True -LIBRARY_DEFINES["_UNICODE"] = True -LIBRARY_DEFINES["MOZ_NO_MOZALLOC"] = True +LIBRARY_DEFINES['UNICODE'] = True +LIBRARY_DEFINES['_UNICODE'] = True +LIBRARY_DEFINES['MOZ_NO_MOZALLOC'] = True DisableStlWrapping() diff --git a/accessible/ipc/win/moz.build b/accessible/ipc/win/moz.build index ab6b3beb7836..acc640b7292c 100644 --- a/accessible/ipc/win/moz.build +++ b/accessible/ipc/win/moz.build @@ -4,69 +4,67 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -if CONFIG["COMPILE_ENVIRONMENT"] and CONFIG["ACCESSIBILITY"]: +if CONFIG['COMPILE_ENVIRONMENT'] and CONFIG['ACCESSIBILITY']: DIRS += [ - "handler", - "typelib", + 'handler', + 'typelib', ] -if CONFIG["ACCESSIBILITY"]: - IPDL_SOURCES += ["PDocAccessible.ipdl"] +if CONFIG['ACCESSIBILITY']: + IPDL_SOURCES += ['PDocAccessible.ipdl'] - if not CONFIG["HAVE_64BIT_BUILD"]: + if not CONFIG['HAVE_64BIT_BUILD']: EXPORTS += [ - "IAccessible32.manifest", + 'IAccessible32.manifest', ] EXPORTS += [ - "IAccessible64.manifest", + 'IAccessible64.manifest', ] EXPORTS.mozilla.a11y += [ - "COMPtrTypes.h", - "DocAccessibleChild.h", - "HandlerProvider.h", - "PlatformChild.h", - "ProxyAccessible.h", + 'COMPtrTypes.h', + 'DocAccessibleChild.h', + 'HandlerProvider.h', + 'PlatformChild.h', + 'ProxyAccessible.h' ] SOURCES += [ - "!./handler/HandlerData_c.c", - "COMPtrTypes.cpp", - "DocAccessibleChild.cpp", - "HandlerProvider.cpp", - "PlatformChild.cpp", - "ProxyAccessible.cpp", + '!./handler/HandlerData_c.c', + 'COMPtrTypes.cpp', + 'DocAccessibleChild.cpp', + 'HandlerProvider.cpp', + 'PlatformChild.cpp', + 'ProxyAccessible.cpp', ] # Give some symbols a unique name in each translation unit, to avoid # collisions caused by https://llvm.org/pr41817. - if CONFIG["CC_TYPE"] == "clang-cl": - SOURCES["!./handler/HandlerData_c.c"].flags += [ - "-DUserMarshalRoutines=UserMarshalRoutines__HandlerData_c" - ] + if CONFIG['CC_TYPE'] == 'clang-cl': + SOURCES['!./handler/HandlerData_c.c'].flags += ['-DUserMarshalRoutines=UserMarshalRoutines__HandlerData_c'] LOCAL_INCLUDES += [ - "/accessible/base", - "/accessible/generic", - "/accessible/windows/ia2", - "/accessible/windows/msaa", - "/accessible/xpcom", + '/accessible/base', + '/accessible/generic', + '/accessible/windows/ia2', + '/accessible/windows/msaa', + '/accessible/xpcom', ] # Suppress warnings from the MIDL generated code. - if CONFIG["CC_TYPE"] == "clang-cl": + if CONFIG['CC_TYPE'] == 'clang-cl': CFLAGS += [ - "-Wno-extern-initializer", - "-Wno-incompatible-pointer-types", - "-Wno-missing-braces", - "-Wno-unused-const-variable", + '-Wno-extern-initializer', + '-Wno-incompatible-pointer-types', + '-Wno-missing-braces', + '-Wno-unused-const-variable', ] CXXFLAGS += [ - "-Wno-missing-braces", + '-Wno-missing-braces', ] -include("/ipc/chromium/chromium-config.mozbuild") +include('/ipc/chromium/chromium-config.mozbuild') -FINAL_LIBRARY = "xul" +FINAL_LIBRARY = 'xul' diff --git a/accessible/ipc/win/typelib/moz.build b/accessible/ipc/win/typelib/moz.build index 2992deda1a5b..5d5496b81e75 100644 --- a/accessible/ipc/win/typelib/moz.build +++ b/accessible/ipc/win/typelib/moz.build @@ -5,12 +5,9 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. FINAL_TARGET_FILES += [ - "!Accessible.tlb", + '!Accessible.tlb', ] -GeneratedFile( - "Accessible.tlb", - inputs=["Accessible.idl"], - script="/build/midl.py", - entry_point="midl", -) +GeneratedFile('Accessible.tlb', + inputs=['Accessible.idl'], + script='/build/midl.py', entry_point='midl') diff --git a/accessible/mac/SelectorMapGen.py b/accessible/mac/SelectorMapGen.py index 5864120fbc41..65ca1e3a15a6 100755 --- a/accessible/mac/SelectorMapGen.py +++ b/accessible/mac/SelectorMapGen.py @@ -28,9 +28,8 @@ def gen_mm(fd, protocol_file): fd.write("#import \n\n") fd.write("namespace mozilla {\nnamespace a11y {\nnamespace mac {\n\n") - sections = re.findall( - r"#pragma mark - (\w+)\n(.*?)(?=(?:#pragma mark|@end))", protocol, re.DOTALL - ) + sections = re.findall(r"#pragma mark - (\w+)\n(.*?)(?=(?:#pragma mark|@end))", + protocol, re.DOTALL) for name, text in sections: write_map(fd, name, text) @@ -39,9 +38,8 @@ def gen_mm(fd, protocol_file): def gen_h(fd, protocol_file): protocol = open(protocol_file).read() - sections = re.findall( - r"#pragma mark - (\w+)\n(.*?)(?=(?:#pragma mark|@end))", protocol, re.DOTALL - ) + sections = re.findall(r"#pragma mark - (\w+)\n(.*?)(?=(?:#pragma mark|@end))", + protocol, re.DOTALL) fd.write("/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */\n\n") fd.write("#ifndef _MacSelectorMap_H_\n") @@ -57,7 +55,6 @@ def gen_h(fd, protocol_file): # For debugging if __name__ == "__main__": import sys - gen_mm(sys.stdout, "accessible/mac/MOXAccessibleProtocol.h") gen_h(sys.stdout, "accessible/mac/MOXAccessibleProtocol.h") diff --git a/accessible/mac/moz.build b/accessible/mac/moz.build index 7fafafee1986..8f39d28b98f5 100644 --- a/accessible/mac/moz.build +++ b/accessible/mac/moz.build @@ -5,69 +5,63 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. EXPORTS += [ - "mozAccessibleProtocol.h", + 'mozAccessibleProtocol.h', ] EXPORTS.mozilla.a11y += [ - "AccessibleWrap.h", - "HyperTextAccessibleWrap.h", - "RangeTypes.h", + 'AccessibleWrap.h', + 'HyperTextAccessibleWrap.h', + 'RangeTypes.h', ] UNIFIED_SOURCES += [ - "AccessibleWrap.mm", - "DocAccessibleWrap.mm", - "GeckoTextMarker.mm", - "HyperTextAccessibleWrap.mm", - "MacUtils.mm", - "MOXAccessibleBase.mm", - "MOXLandmarkAccessibles.mm", - "MOXMathAccessibles.mm", - "MOXSearchInfo.mm", - "MOXTextMarkerDelegate.mm", - "MOXWebAreaAccessible.mm", - "mozAccessible.mm", - "mozActionElements.mm", - "mozHTMLAccessible.mm", - "mozRootAccessible.mm", - "mozSelectableElements.mm", - "mozTableAccessible.mm", - "mozTextAccessible.mm", - "Platform.mm", - "RootAccessibleWrap.mm", - "RotorRules.mm", + 'AccessibleWrap.mm', + 'DocAccessibleWrap.mm', + 'GeckoTextMarker.mm', + 'HyperTextAccessibleWrap.mm', + 'MacUtils.mm', + 'MOXAccessibleBase.mm', + 'MOXLandmarkAccessibles.mm', + 'MOXMathAccessibles.mm', + 'MOXSearchInfo.mm', + 'MOXTextMarkerDelegate.mm', + 'MOXWebAreaAccessible.mm', + 'mozAccessible.mm', + 'mozActionElements.mm', + 'mozHTMLAccessible.mm', + 'mozRootAccessible.mm', + 'mozSelectableElements.mm', + 'mozTableAccessible.mm', + 'mozTextAccessible.mm', + 'Platform.mm', + 'RootAccessibleWrap.mm', + 'RotorRules.mm', ] SOURCES += [ - "!MacSelectorMap.mm", + '!MacSelectorMap.mm', ] LOCAL_INCLUDES += [ - "/accessible/base", - "/accessible/generic", - "/accessible/html", - "/accessible/ipc", - "/accessible/ipc/other", - "/accessible/xul", - "/layout/generic", - "/layout/xul", - "/widget", - "/widget/cocoa", + '/accessible/base', + '/accessible/generic', + '/accessible/html', + '/accessible/ipc', + '/accessible/ipc/other', + '/accessible/xul', + '/layout/generic', + '/layout/xul', + '/widget', + '/widget/cocoa', ] -GeneratedFile( - "MacSelectorMap.h", - script="/accessible/mac/SelectorMapGen.py", - entry_point="gen_h", - inputs=["MOXAccessibleProtocol.h"], -) -GeneratedFile( - "MacSelectorMap.mm", - script="/accessible/mac/SelectorMapGen.py", - entry_point="gen_mm", - inputs=["MOXAccessibleProtocol.h"], -) +GeneratedFile('MacSelectorMap.h', + script='/accessible/mac/SelectorMapGen.py', entry_point='gen_h', + inputs=['MOXAccessibleProtocol.h']) +GeneratedFile('MacSelectorMap.mm', + script='/accessible/mac/SelectorMapGen.py', entry_point='gen_mm', + inputs=['MOXAccessibleProtocol.h']) -FINAL_LIBRARY = "xul" +FINAL_LIBRARY = 'xul' -include("/ipc/chromium/chromium-config.mozbuild") +include('/ipc/chromium/chromium-config.mozbuild') diff --git a/accessible/moz.build b/accessible/moz.build index f0ddf25cb396..2fc823a6781f 100644 --- a/accessible/moz.build +++ b/accessible/moz.build @@ -4,39 +4,46 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -toolkit = CONFIG["MOZ_WIDGET_TOOLKIT"] +toolkit = CONFIG['MOZ_WIDGET_TOOLKIT'] -if toolkit == "gtk": - DIRS += ["atk"] -elif toolkit == "windows": - DIRS += ["windows"] -elif toolkit == "cocoa": - DIRS += ["mac"] -elif toolkit == "android": - DIRS += ["android"] +if toolkit == 'gtk': + DIRS += ['atk'] +elif toolkit == 'windows': + DIRS += ['windows'] +elif toolkit == 'cocoa': + DIRS += ['mac'] +elif toolkit == 'android': + DIRS += ['android'] else: - DIRS += ["other"] + DIRS += ['other'] -DIRS += ["aom", "base", "generic", "html", "interfaces", "ipc", "xpcom"] +DIRS += [ 'aom', + 'base', + 'generic', + 'html', + 'interfaces', + 'ipc', + 'xpcom' +] -if CONFIG["MOZ_XUL"]: - DIRS += ["xul"] +if CONFIG['MOZ_XUL']: + DIRS += ['xul'] -TEST_DIRS += ["tests/mochitest"] +TEST_DIRS += ['tests/mochitest'] BROWSER_CHROME_MANIFESTS += [ - "tests/browser/bounds/browser.ini", - "tests/browser/browser.ini", - "tests/browser/e10s/browser.ini", - "tests/browser/events/browser.ini", - "tests/browser/fission/browser.ini", - "tests/browser/general/browser.ini", - "tests/browser/hittest/browser.ini", - "tests/browser/mac/browser.ini", - "tests/browser/scroll/browser.ini", - "tests/browser/states/browser.ini", - "tests/browser/telemetry/browser.ini", - "tests/browser/tree/browser.ini", + 'tests/browser/bounds/browser.ini', + 'tests/browser/browser.ini', + 'tests/browser/e10s/browser.ini', + 'tests/browser/events/browser.ini', + 'tests/browser/fission/browser.ini', + 'tests/browser/general/browser.ini', + 'tests/browser/hittest/browser.ini', + 'tests/browser/mac/browser.ini', + 'tests/browser/scroll/browser.ini', + 'tests/browser/states/browser.ini', + 'tests/browser/telemetry/browser.ini', + 'tests/browser/tree/browser.ini' ] with Files("**"): diff --git a/accessible/other/moz.build b/accessible/other/moz.build index 1e4fc8cabc3b..4887a4abb697 100644 --- a/accessible/other/moz.build +++ b/accessible/other/moz.build @@ -5,23 +5,23 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. EXPORTS.mozilla.a11y += [ - "AccessibleWrap.h", - "HyperTextAccessibleWrap.h", + 'AccessibleWrap.h', + 'HyperTextAccessibleWrap.h', ] SOURCES += [ - "AccessibleWrap.cpp", - "Platform.cpp", + 'AccessibleWrap.cpp', + 'Platform.cpp', ] LOCAL_INCLUDES += [ - "/accessible/base", - "/accessible/generic", - "/accessible/html", - "/accessible/xul", + '/accessible/base', + '/accessible/generic', + '/accessible/html', + '/accessible/xul', ] -FINAL_LIBRARY = "xul" +FINAL_LIBRARY = 'xul' -if CONFIG["CC_TYPE"] in ("clang", "gcc"): - CXXFLAGS += ["-Wno-error=shadow"] +if CONFIG['CC_TYPE'] in ('clang', 'gcc'): + CXXFLAGS += ['-Wno-error=shadow'] diff --git a/accessible/tests/mochitest/moz.build b/accessible/tests/mochitest/moz.build index d3efffb62b92..ad92136301ff 100644 --- a/accessible/tests/mochitest/moz.build +++ b/accessible/tests/mochitest/moz.build @@ -5,33 +5,33 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. A11Y_MANIFESTS += [ - "a11y.ini", - "actions/a11y.ini", - "aom/a11y.ini", - "attributes/a11y.ini", - "bounds/a11y.ini", - "editabletext/a11y.ini", - "elm/a11y.ini", - "events/a11y.ini", - "events/docload/a11y.ini", - "focus/a11y.ini", - "hittest/a11y.ini", - "hyperlink/a11y.ini", - "hypertext/a11y.ini", - "name/a11y.ini", - "pivot/a11y.ini", - "relations/a11y.ini", - "role/a11y.ini", - "scroll/a11y.ini", - "selectable/a11y.ini", - "states/a11y.ini", - "table/a11y.ini", - "text/a11y.ini", - "textattrs/a11y.ini", - "textcaret/a11y.ini", - "textrange/a11y.ini", - "textselection/a11y.ini", - "tree/a11y.ini", - "treeupdate/a11y.ini", - "value/a11y.ini", + 'a11y.ini', + 'actions/a11y.ini', + 'aom/a11y.ini', + 'attributes/a11y.ini', + 'bounds/a11y.ini', + 'editabletext/a11y.ini', + 'elm/a11y.ini', + 'events/a11y.ini', + 'events/docload/a11y.ini', + 'focus/a11y.ini', + 'hittest/a11y.ini', + 'hyperlink/a11y.ini', + 'hypertext/a11y.ini', + 'name/a11y.ini', + 'pivot/a11y.ini', + 'relations/a11y.ini', + 'role/a11y.ini', + 'scroll/a11y.ini', + 'selectable/a11y.ini', + 'states/a11y.ini', + 'table/a11y.ini', + 'text/a11y.ini', + 'textattrs/a11y.ini', + 'textcaret/a11y.ini', + 'textrange/a11y.ini', + 'textselection/a11y.ini', + 'tree/a11y.ini', + 'treeupdate/a11y.ini', + 'value/a11y.ini', ] diff --git a/accessible/windows/ia2/moz.build b/accessible/windows/ia2/moz.build index 7357fe48a871..ed8096178fbe 100644 --- a/accessible/windows/ia2/moz.build +++ b/accessible/windows/ia2/moz.build @@ -5,54 +5,54 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. EXPORTS += [ - "ia2Accessible.h", - "ia2AccessibleAction.h", - "ia2AccessibleComponent.h", - "ia2AccessibleEditableText.h", - "ia2AccessibleHyperlink.h", - "ia2AccessibleHypertext.h", - "ia2AccessibleText.h", - "ia2AccessibleValue.h", + 'ia2Accessible.h', + 'ia2AccessibleAction.h', + 'ia2AccessibleComponent.h', + 'ia2AccessibleEditableText.h', + 'ia2AccessibleHyperlink.h', + 'ia2AccessibleHypertext.h', + 'ia2AccessibleText.h', + 'ia2AccessibleValue.h', ] UNIFIED_SOURCES += [ - "ia2Accessible.cpp", - "ia2AccessibleAction.cpp", - "ia2AccessibleComponent.cpp", - "ia2AccessibleEditableText.cpp", - "ia2AccessibleHyperlink.cpp", - "ia2AccessibleHypertext.cpp", - "ia2AccessibleImage.cpp", - "ia2AccessibleRelation.cpp", - "ia2AccessibleText.cpp", - "ia2AccessibleValue.cpp", + 'ia2Accessible.cpp', + 'ia2AccessibleAction.cpp', + 'ia2AccessibleComponent.cpp', + 'ia2AccessibleEditableText.cpp', + 'ia2AccessibleHyperlink.cpp', + 'ia2AccessibleHypertext.cpp', + 'ia2AccessibleImage.cpp', + 'ia2AccessibleRelation.cpp', + 'ia2AccessibleText.cpp', + 'ia2AccessibleValue.cpp', ] # These files cannot be built in unified mode because they both include # AccessibleTable2_i.c. SOURCES += [ - "ia2AccessibleTable.cpp", - "ia2AccessibleTableCell.cpp", + 'ia2AccessibleTable.cpp', + 'ia2AccessibleTableCell.cpp', ] LOCAL_INCLUDES += [ - "/accessible/base", - "/accessible/generic", - "/accessible/html", - "/accessible/windows", - "/accessible/windows/msaa", - "/accessible/xpcom", - "/accessible/xul", + '/accessible/base', + '/accessible/generic', + '/accessible/html', + '/accessible/windows', + '/accessible/windows/msaa', + '/accessible/xpcom', + '/accessible/xul', ] -FINAL_LIBRARY = "xul" +FINAL_LIBRARY = 'xul' # The Windows MIDL code generator creates things like: # # #endif !_MIDL_USE_GUIDDEF_ # # which clang-cl complains about. MSVC doesn't, so turn this warning off. -if CONFIG["CC_TYPE"] == "clang-cl": - CXXFLAGS += ["-Wno-extra-tokens"] +if CONFIG['CC_TYPE'] == 'clang-cl': + CXXFLAGS += ['-Wno-extra-tokens'] -include("/ipc/chromium/chromium-config.mozbuild") +include('/ipc/chromium/chromium-config.mozbuild') diff --git a/accessible/windows/moz.build b/accessible/windows/moz.build index c5c2f9ff2fed..4a62560a43c3 100644 --- a/accessible/windows/moz.build +++ b/accessible/windows/moz.build @@ -4,8 +4,8 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DIRS += ["msaa", "ia2", "sdn", "uia"] +DIRS += ['msaa', 'ia2', 'sdn', 'uia'] EXPORTS.mozilla.a11y += [ - "ProxyWrappers.h", + 'ProxyWrappers.h', ] diff --git a/accessible/windows/msaa/moz.build b/accessible/windows/msaa/moz.build index 5b8163f2fd94..9b91e0f6cd1b 100644 --- a/accessible/windows/msaa/moz.build +++ b/accessible/windows/msaa/moz.build @@ -5,71 +5,71 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. EXPORTS += [ - "IUnknownImpl.h", + 'IUnknownImpl.h', ] EXPORTS.mozilla.a11y += [ - "AccessibleWrap.h", - "Compatibility.h", - "HyperTextAccessibleWrap.h", - "LazyInstantiator.h", - "MsaaIdGenerator.h", - "nsWinUtils.h", + 'AccessibleWrap.h', + 'Compatibility.h', + 'HyperTextAccessibleWrap.h', + 'LazyInstantiator.h', + 'MsaaIdGenerator.h', + 'nsWinUtils.h', ] UNIFIED_SOURCES += [ - "AccessibleWrap.cpp", - "ApplicationAccessibleWrap.cpp", - "ARIAGridAccessibleWrap.cpp", - "Compatibility.cpp", - "CompatibilityUIA.cpp", - "DocAccessibleWrap.cpp", - "EnumVariant.cpp", - "GeckoCustom.cpp", - "HTMLTableAccessibleWrap.cpp", - "HTMLWin32ObjectAccessible.cpp", - "HyperTextAccessibleWrap.cpp", - "ImageAccessibleWrap.cpp", - "IUnknownImpl.cpp", - "MsaaIdGenerator.cpp", - "nsWinUtils.cpp", - "Platform.cpp", - "RootAccessibleWrap.cpp", - "TextLeafAccessibleWrap.cpp", + 'AccessibleWrap.cpp', + 'ApplicationAccessibleWrap.cpp', + 'ARIAGridAccessibleWrap.cpp', + 'Compatibility.cpp', + 'CompatibilityUIA.cpp', + 'DocAccessibleWrap.cpp', + 'EnumVariant.cpp', + 'GeckoCustom.cpp', + 'HTMLTableAccessibleWrap.cpp', + 'HTMLWin32ObjectAccessible.cpp', + 'HyperTextAccessibleWrap.cpp', + 'ImageAccessibleWrap.cpp', + 'IUnknownImpl.cpp', + 'MsaaIdGenerator.cpp', + 'nsWinUtils.cpp', + 'Platform.cpp', + 'RootAccessibleWrap.cpp', + 'TextLeafAccessibleWrap.cpp', ] SOURCES += [ # This file cannot be built in unified mode because it redefines _WIN32_WINNT - "LazyInstantiator.cpp", + 'LazyInstantiator.cpp', # This file cannot be built in unified mode because it includes ISimpleDOMNode_i.c. - "ServiceProvider.cpp", + 'ServiceProvider.cpp', ] OS_LIBS += [ - "ntdll", + 'ntdll', ] -if CONFIG["MOZ_XUL"]: +if CONFIG['MOZ_XUL']: UNIFIED_SOURCES += [ - "XULListboxAccessibleWrap.cpp", - "XULMenuAccessibleWrap.cpp", - "XULTreeGridAccessibleWrap.cpp", + 'XULListboxAccessibleWrap.cpp', + 'XULMenuAccessibleWrap.cpp', + 'XULTreeGridAccessibleWrap.cpp', ] LOCAL_INCLUDES += [ - "/accessible/base", - "/accessible/generic", - "/accessible/html", - "/accessible/ipc", - "/accessible/ipc/win", - "/accessible/windows", - "/accessible/windows/ia2", - "/accessible/windows/sdn", - "/accessible/windows/uia", - "/accessible/xpcom", - "/accessible/xul", - "/dom/base", - "/layout/style", + '/accessible/base', + '/accessible/generic', + '/accessible/html', + '/accessible/ipc', + '/accessible/ipc/win', + '/accessible/windows', + '/accessible/windows/ia2', + '/accessible/windows/sdn', + '/accessible/windows/uia', + '/accessible/xpcom', + '/accessible/xul', + '/dom/base', + '/layout/style', ] # The Windows MIDL code generator creates things like: @@ -77,9 +77,9 @@ LOCAL_INCLUDES += [ # #endif !_MIDL_USE_GUIDDEF_ # # which clang-cl complains about. MSVC doesn't, so turn this warning off. -if CONFIG["CC_TYPE"] == "clang-cl": - CXXFLAGS += ["-Wno-extra-tokens"] +if CONFIG['CC_TYPE'] == 'clang-cl': + CXXFLAGS += ['-Wno-extra-tokens'] -include("/ipc/chromium/chromium-config.mozbuild") +include('/ipc/chromium/chromium-config.mozbuild') -FINAL_LIBRARY = "xul" +FINAL_LIBRARY = 'xul' diff --git a/accessible/windows/sdn/moz.build b/accessible/windows/sdn/moz.build index 8d76b7482ef3..ae0d5e20dcb0 100644 --- a/accessible/windows/sdn/moz.build +++ b/accessible/windows/sdn/moz.build @@ -5,20 +5,20 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. UNIFIED_SOURCES += [ - "sdnAccessible.cpp", - "sdnDocAccessible.cpp", - "sdnTextAccessible.cpp", + 'sdnAccessible.cpp', + 'sdnDocAccessible.cpp', + 'sdnTextAccessible.cpp', ] LOCAL_INCLUDES += [ - "/accessible/base", - "/accessible/generic", - "/accessible/html", - "/accessible/windows/msaa", - "/accessible/xpcom", - "/accessible/xul", + '/accessible/base', + '/accessible/generic', + '/accessible/html', + '/accessible/windows/msaa', + '/accessible/xpcom', + '/accessible/xul', ] -include("/ipc/chromium/chromium-config.mozbuild") +include('/ipc/chromium/chromium-config.mozbuild') -FINAL_LIBRARY = "xul" +FINAL_LIBRARY = 'xul' diff --git a/accessible/windows/uia/moz.build b/accessible/windows/uia/moz.build index 058aacc579ef..afc150e11989 100644 --- a/accessible/windows/uia/moz.build +++ b/accessible/windows/uia/moz.build @@ -5,18 +5,18 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. SOURCES += [ - "uiaRawElmProvider.cpp", + 'uiaRawElmProvider.cpp', ] LOCAL_INCLUDES += [ - "/accessible/base", - "/accessible/generic", - "/accessible/html", - "/accessible/windows/msaa", - "/accessible/xpcom", - "/accessible/xul", + '/accessible/base', + '/accessible/generic', + '/accessible/html', + '/accessible/windows/msaa', + '/accessible/xpcom', + '/accessible/xul', ] -include("/ipc/chromium/chromium-config.mozbuild") +include('/ipc/chromium/chromium-config.mozbuild') -FINAL_LIBRARY = "xul" +FINAL_LIBRARY = 'xul' diff --git a/accessible/xpcom/AccEventGen.py b/accessible/xpcom/AccEventGen.py index ef253bd2a914..633063031dc1 100755 --- a/accessible/xpcom/AccEventGen.py +++ b/accessible/xpcom/AccEventGen.py @@ -14,13 +14,8 @@ from xpidl import xpidl # Load the webidl configuration file. glbl = {} -exec( - open( - mozpath.join(buildconfig.topsrcdir, "dom", "bindings", "Bindings.conf") - ).read(), - glbl, -) -webidlconfig = glbl["DOMInterfaces"] +exec(open(mozpath.join(buildconfig.topsrcdir, 'dom', 'bindings', 'Bindings.conf')).read(), glbl) +webidlconfig = glbl['DOMInterfaces'] # Instantiate the parser. p = xpidl.IDLParser() @@ -31,14 +26,13 @@ def findIDL(includePath, interfaceFileName): path = mozpath.join(d, interfaceFileName) if os.path.exists(path): return path - raise BaseException( - "No IDL file found for interface %s " - "in include path %r" % (interfaceFileName, includePath) - ) + raise BaseException("No IDL file found for interface %s " + "in include path %r" + % (interfaceFileName, includePath)) def loadEventIDL(parser, includePath, eventname): - eventidl = "nsIAccessible%s.idl" % eventname + eventidl = ("nsIAccessible%s.idl" % eventname) idlFile = findIDL(includePath, eventidl) idl = p.parse(open(idlFile).read(), idlFile) idl.resolve(includePath, p, webidlconfig) @@ -49,7 +43,7 @@ class Configuration: def __init__(self, filename): config = {} exec(open(filename).read(), config) - self.simple_events = config.get("simple_events", []) + self.simple_events = config.get('simple_events', []) def firstCap(str): @@ -57,28 +51,26 @@ def firstCap(str): def writeAttributeParams(a): - return "%s a%s" % (a.realtype.nativeType("in"), firstCap(a.name)) + return ("%s a%s" % (a.realtype.nativeType('in'), firstCap(a.name))) def print_header_file(fd, conf, incdirs): idl_paths = set() fd.write("/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */\n") - fd.write( - "#ifndef _mozilla_a11y_generated_AccEvents_h_\n" - "#define _mozilla_a11y_generated_AccEvents_h_\n\n" - ) - fd.write('#include "nscore.h"\n') - fd.write('#include "nsCOMPtr.h"\n') - fd.write('#include "nsCycleCollectionParticipant.h"\n') - fd.write('#include "nsString.h"\n') + fd.write("#ifndef _mozilla_a11y_generated_AccEvents_h_\n" + "#define _mozilla_a11y_generated_AccEvents_h_\n\n") + fd.write("#include \"nscore.h\"\n") + fd.write("#include \"nsCOMPtr.h\"\n") + fd.write("#include \"nsCycleCollectionParticipant.h\"\n") + fd.write("#include \"nsString.h\"\n") for e in conf.simple_events: - fd.write('#include "nsIAccessible%s.h"\n' % e) + fd.write("#include \"nsIAccessible%s.h\"\n" % e) for e in conf.simple_events: idl, idl_path = loadEventIDL(p, incdirs, e) idl_paths.add(idl_path) for iface in filter(lambda p: p.kind == "interface", idl.productions): - classname = "xpcAcc%s" % e + classname = ("xpcAcc%s" % e) baseinterfaces = interfaces(iface) fd.write("\nclass %s final : public %s\n" % (classname, iface.name)) @@ -122,7 +114,7 @@ def interfaceAttributeTypes(idl): def print_cpp(idl, fd, conf, eventname): for p in idl.productions: - if p.kind == "interface": + if p.kind == 'interface': write_cpp(eventname, p, fd) @@ -143,7 +135,7 @@ def print_cpp_file(fd, conf, incdirs): types.extend(interfaceAttributeTypes(idl)) for c in types: - fd.write('#include "%s.h"\n' % c) + fd.write("#include \"%s.h\"\n" % c) fd.write("\n") for e in conf.simple_events: @@ -155,40 +147,37 @@ def print_cpp_file(fd, conf, incdirs): def attributeVariableTypeAndName(a): - if a.realtype.nativeType("in").endswith("*"): - l = [ - "nsCOMPtr<%s> m%s;" - % (a.realtype.nativeType("in").strip("* "), firstCap(a.name)) - ] - elif a.realtype.nativeType("in").count("nsAString"): + if a.realtype.nativeType('in').endswith('*'): + l = ["nsCOMPtr<%s> m%s;" % (a.realtype.nativeType('in').strip('* '), + firstCap(a.name))] + elif a.realtype.nativeType('in').count("nsAString"): l = ["nsString m%s;" % firstCap(a.name)] - elif a.realtype.nativeType("in").count("nsACString"): + elif a.realtype.nativeType('in').count("nsACString"): l = ["nsCString m%s;" % firstCap(a.name)] else: - l = ["%sm%s;" % (a.realtype.nativeType("in"), firstCap(a.name))] + l = ["%sm%s;" % (a.realtype.nativeType('in'), + firstCap(a.name))] return ", ".join(l) def writeAttributeGetter(fd, classname, a): fd.write("NS_IMETHODIMP\n") fd.write("%s::Get%s(" % (classname, firstCap(a.name))) - if a.realtype.nativeType("in").endswith("*"): - fd.write( - "%s** a%s" % (a.realtype.nativeType("in").strip("* "), firstCap(a.name)) - ) - elif a.realtype.nativeType("in").count("nsAString"): + if a.realtype.nativeType('in').endswith('*'): + fd.write("%s** a%s" % (a.realtype.nativeType('in').strip('* '), firstCap(a.name))) + elif a.realtype.nativeType('in').count("nsAString"): fd.write("nsAString& a%s" % firstCap(a.name)) - elif a.realtype.nativeType("in").count("nsACString"): + elif a.realtype.nativeType('in').count("nsACString"): fd.write("nsACString& a%s" % firstCap(a.name)) else: - fd.write("%s*a%s" % (a.realtype.nativeType("in"), firstCap(a.name))) + fd.write("%s*a%s" % (a.realtype.nativeType('in'), firstCap(a.name))) fd.write(")\n") fd.write("{\n") - if a.realtype.nativeType("in").endswith("*"): + if a.realtype.nativeType('in').endswith('*'): fd.write(" NS_IF_ADDREF(*a%s = m%s);\n" % (firstCap(a.name), firstCap(a.name))) - elif a.realtype.nativeType("in").count("nsAString"): + elif a.realtype.nativeType('in').count("nsAString"): fd.write(" a%s = m%s;\n" % (firstCap(a.name), firstCap(a.name))) - elif a.realtype.nativeType("in").count("nsACString"): + elif a.realtype.nativeType('in').count("nsACString"): fd.write(" a%s = m%s;\n" % (firstCap(a.name), firstCap(a.name))) else: fd.write(" *a%s = m%s;\n" % (firstCap(a.name), firstCap(a.name))) @@ -218,9 +207,7 @@ def allAttributes(iface): def write_cpp(eventname, iface, fd): classname = "xpcAcc%s" % eventname attributes = allAttributes(iface) - ccattributes = filter( - lambda m: m.realtype.nativeType("in").endswith("*"), attributes - ) + ccattributes = filter(lambda m: m.realtype.nativeType('in').endswith('*'), attributes) fd.write("NS_IMPL_CYCLE_COLLECTION(%s" % classname) for c in ccattributes: fd.write(", m%s" % firstCap(c.name)) @@ -241,8 +228,8 @@ def write_cpp(eventname, iface, fd): def get_conf(conf_file): conf = Configuration(conf_file) inc_dir = [ - mozpath.join(buildconfig.topsrcdir, "accessible", "interfaces"), - mozpath.join(buildconfig.topsrcdir, "xpcom", "base"), + mozpath.join(buildconfig.topsrcdir, 'accessible', 'interfaces'), + mozpath.join(buildconfig.topsrcdir, 'xpcom', 'base'), ] return conf, inc_dir @@ -251,8 +238,6 @@ def gen_files(fd, conf_file): deps = set() conf, inc_dir = get_conf(conf_file) deps.update(print_header_file(fd, conf, inc_dir)) - with open( - os.path.join(os.path.dirname(fd.name), "xpcAccEvents.cpp"), "w" - ) as cpp_fd: + with open(os.path.join(os.path.dirname(fd.name), 'xpcAccEvents.cpp'), 'w') as cpp_fd: deps.update(print_cpp_file(cpp_fd, conf, inc_dir)) return deps diff --git a/accessible/xpcom/moz.build b/accessible/xpcom/moz.build index f45f3abcb230..97d906eb72a2 100644 --- a/accessible/xpcom/moz.build +++ b/accessible/xpcom/moz.build @@ -5,77 +5,76 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. UNIFIED_SOURCES += [ - "nsAccessibleRelation.cpp", - "xpcAccessibilityService.cpp", - "xpcAccessible.cpp", - "xpcAccessibleApplication.cpp", - "xpcAccessibleDocument.cpp", - "xpcAccessibleGeneric.cpp", - "xpcAccessibleHyperLink.cpp", - "xpcAccessibleHyperText.cpp", - "xpcAccessibleImage.cpp", - "xpcAccessibleSelectable.cpp", - "xpcAccessibleTable.cpp", - "xpcAccessibleTableCell.cpp", - "xpcAccessibleTextRange.cpp", - "xpcAccessibleValue.cpp", + 'nsAccessibleRelation.cpp', + 'xpcAccessibilityService.cpp', + 'xpcAccessible.cpp', + 'xpcAccessibleApplication.cpp', + 'xpcAccessibleDocument.cpp', + 'xpcAccessibleGeneric.cpp', + 'xpcAccessibleHyperLink.cpp', + 'xpcAccessibleHyperText.cpp', + 'xpcAccessibleImage.cpp', + 'xpcAccessibleSelectable.cpp', + 'xpcAccessibleTable.cpp', + 'xpcAccessibleTableCell.cpp', + 'xpcAccessibleTextRange.cpp', + 'xpcAccessibleValue.cpp', ] SOURCES += [ - "!xpcAccEvents.cpp", + '!xpcAccEvents.cpp', ] EXPORTS += [ - "!xpcAccEvents.h", - "xpcAccessibilityService.h", + '!xpcAccEvents.h', + 'xpcAccessibilityService.h', ] LOCAL_INCLUDES += [ - "/accessible/base", - "/accessible/generic", + '/accessible/base', + '/accessible/generic', ] -if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk': LOCAL_INCLUDES += [ - "/accessible/atk", + '/accessible/atk', ] -elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows": +elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': LOCAL_INCLUDES += [ - "/accessible/windows/msaa", + '/accessible/windows/msaa', ] -elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa": +elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': LOCAL_INCLUDES += [ - "/accessible/ipc", - "/accessible/ipc/other", - "/accessible/mac", + '/accessible/ipc', + '/accessible/ipc/other', + '/accessible/mac', + ] + UNIFIED_SOURCES += [ + 'xpcAccessibleMacInterface.mm' ] - UNIFIED_SOURCES += ["xpcAccessibleMacInterface.mm"] EXPORTS += [ - "xpcAccessibleMacInterface.h", + 'xpcAccessibleMacInterface.h', ] -elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android": +elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': LOCAL_INCLUDES += [ - "/accessible/android", + '/accessible/android', ] else: LOCAL_INCLUDES += [ - "/accessible/other", + '/accessible/other', ] GeneratedFile( - "xpcAccEvents.h", - "xpcAccEvents.cpp", - script="AccEventGen.py", - entry_point="gen_files", + 'xpcAccEvents.h', 'xpcAccEvents.cpp', + script='AccEventGen.py', entry_point='gen_files', inputs=[ - "AccEvents.conf", - ], -) + 'AccEvents.conf', + ]) -FINAL_LIBRARY = "xul" +FINAL_LIBRARY = 'xul' -include("/ipc/chromium/chromium-config.mozbuild") +include('/ipc/chromium/chromium-config.mozbuild') -if CONFIG["CC_TYPE"] in ("clang", "gcc"): - CXXFLAGS += ["-Wno-error=shadow"] +if CONFIG['CC_TYPE'] in ('clang', 'gcc'): + CXXFLAGS += ['-Wno-error=shadow'] diff --git a/accessible/xul/moz.build b/accessible/xul/moz.build index 72a55cccea08..aa816eef0513 100644 --- a/accessible/xul/moz.build +++ b/accessible/xul/moz.build @@ -5,55 +5,55 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. UNIFIED_SOURCES += [ - "XULAlertAccessible.cpp", - "XULComboboxAccessible.cpp", - "XULElementAccessibles.cpp", - "XULFormControlAccessible.cpp", - "XULListboxAccessible.cpp", - "XULMenuAccessible.cpp", - "XULSelectControlAccessible.cpp", - "XULTabAccessible.cpp", - "XULTreeAccessible.cpp", - "XULTreeGridAccessible.cpp", + 'XULAlertAccessible.cpp', + 'XULComboboxAccessible.cpp', + 'XULElementAccessibles.cpp', + 'XULFormControlAccessible.cpp', + 'XULListboxAccessible.cpp', + 'XULMenuAccessible.cpp', + 'XULSelectControlAccessible.cpp', + 'XULTabAccessible.cpp', + 'XULTreeAccessible.cpp', + 'XULTreeGridAccessible.cpp', ] LOCAL_INCLUDES += [ - "/accessible/base", - "/accessible/generic", - "/accessible/html", - "/accessible/xpcom", - "/dom/base", - "/dom/xul", - "/layout/generic", - "/layout/xul", - "/layout/xul/tree", + '/accessible/base', + '/accessible/generic', + '/accessible/html', + '/accessible/xpcom', + '/dom/base', + '/dom/xul', + '/layout/generic', + '/layout/xul', + '/layout/xul/tree', ] -if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk': LOCAL_INCLUDES += [ - "/accessible/atk", + '/accessible/atk', ] -elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows": +elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': LOCAL_INCLUDES += [ - "/accessible/windows/ia2", - "/accessible/windows/msaa", + '/accessible/windows/ia2', + '/accessible/windows/msaa', ] -elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa": +elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': LOCAL_INCLUDES += [ - "/accessible/mac", + '/accessible/mac', ] -elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android": +elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': LOCAL_INCLUDES += [ - "/accessible/android", + '/accessible/android', ] else: LOCAL_INCLUDES += [ - "/accessible/other", + '/accessible/other', ] -include("/ipc/chromium/chromium-config.mozbuild") +include('/ipc/chromium/chromium-config.mozbuild') -FINAL_LIBRARY = "xul" +FINAL_LIBRARY = 'xul' -if CONFIG["CC_TYPE"] in ("clang", "gcc"): - CXXFLAGS += ["-Wno-error=shadow"] +if CONFIG['CC_TYPE'] in ('clang', 'gcc'): + CXXFLAGS += ['-Wno-error=shadow'] diff --git a/browser/actors/moz.build b/browser/actors/moz.build index 1f9f8ef1c032..f00621df222e 100644 --- a/browser/actors/moz.build +++ b/browser/actors/moz.build @@ -29,61 +29,61 @@ with Files("WebRTCChild.jsm"): BUG_COMPONENT = ("Firefox", "Site Permissions") FINAL_TARGET_FILES.actors += [ - "AboutNewInstallChild.jsm", - "AboutNewInstallParent.jsm", - "AboutNewTabChild.jsm", - "AboutNewTabParent.jsm", - "AboutPluginsChild.jsm", - "AboutPluginsParent.jsm", - "AboutPrivateBrowsingChild.jsm", - "AboutPrivateBrowsingParent.jsm", - "AboutProtectionsChild.jsm", - "AboutProtectionsParent.jsm", - "AboutReaderChild.jsm", - "AboutReaderParent.jsm", - "AboutTabCrashedChild.jsm", - "AboutTabCrashedParent.jsm", - "BlockedSiteChild.jsm", - "BlockedSiteParent.jsm", - "BrowserProcessChild.jsm", - "BrowserTabChild.jsm", - "BrowserTabParent.jsm", - "ClickHandlerChild.jsm", - "ClickHandlerParent.jsm", - "ContentMetaChild.jsm", - "ContentMetaParent.jsm", - "ContentSearchChild.jsm", - "ContentSearchParent.jsm", - "ContextMenuChild.jsm", - "ContextMenuParent.jsm", - "DecoderDoctorChild.jsm", - "DecoderDoctorParent.jsm", - "DOMFullscreenChild.jsm", - "DOMFullscreenParent.jsm", - "EncryptedMediaChild.jsm", - "EncryptedMediaParent.jsm", - "FormValidationChild.jsm", - "FormValidationParent.jsm", - "LightweightThemeChild.jsm", - "LinkHandlerChild.jsm", - "LinkHandlerParent.jsm", - "NetErrorChild.jsm", - "NetErrorParent.jsm", - "PageInfoChild.jsm", - "PageStyleChild.jsm", - "PageStyleParent.jsm", - "PluginChild.jsm", - "PluginParent.jsm", - "PointerLockChild.jsm", - "PointerLockParent.jsm", - "PromptParent.jsm", - "RefreshBlockerChild.jsm", - "RefreshBlockerParent.jsm", - "RFPHelperChild.jsm", - "RFPHelperParent.jsm", - "SearchTelemetryChild.jsm", - "SearchTelemetryParent.jsm", - "SwitchDocumentDirectionChild.jsm", - "WebRTCChild.jsm", - "WebRTCParent.jsm", + 'AboutNewInstallChild.jsm', + 'AboutNewInstallParent.jsm', + 'AboutNewTabChild.jsm', + 'AboutNewTabParent.jsm', + 'AboutPluginsChild.jsm', + 'AboutPluginsParent.jsm', + 'AboutPrivateBrowsingChild.jsm', + 'AboutPrivateBrowsingParent.jsm', + 'AboutProtectionsChild.jsm', + 'AboutProtectionsParent.jsm', + 'AboutReaderChild.jsm', + 'AboutReaderParent.jsm', + 'AboutTabCrashedChild.jsm', + 'AboutTabCrashedParent.jsm', + 'BlockedSiteChild.jsm', + 'BlockedSiteParent.jsm', + 'BrowserProcessChild.jsm', + 'BrowserTabChild.jsm', + 'BrowserTabParent.jsm', + 'ClickHandlerChild.jsm', + 'ClickHandlerParent.jsm', + 'ContentMetaChild.jsm', + 'ContentMetaParent.jsm', + 'ContentSearchChild.jsm', + 'ContentSearchParent.jsm', + 'ContextMenuChild.jsm', + 'ContextMenuParent.jsm', + 'DecoderDoctorChild.jsm', + 'DecoderDoctorParent.jsm', + 'DOMFullscreenChild.jsm', + 'DOMFullscreenParent.jsm', + 'EncryptedMediaChild.jsm', + 'EncryptedMediaParent.jsm', + 'FormValidationChild.jsm', + 'FormValidationParent.jsm', + 'LightweightThemeChild.jsm', + 'LinkHandlerChild.jsm', + 'LinkHandlerParent.jsm', + 'NetErrorChild.jsm', + 'NetErrorParent.jsm', + 'PageInfoChild.jsm', + 'PageStyleChild.jsm', + 'PageStyleParent.jsm', + 'PluginChild.jsm', + 'PluginParent.jsm', + 'PointerLockChild.jsm', + 'PointerLockParent.jsm', + 'PromptParent.jsm', + 'RefreshBlockerChild.jsm', + 'RefreshBlockerParent.jsm', + 'RFPHelperChild.jsm', + 'RFPHelperParent.jsm', + 'SearchTelemetryChild.jsm', + 'SearchTelemetryParent.jsm', + 'SwitchDocumentDirectionChild.jsm', + 'WebRTCChild.jsm', + 'WebRTCParent.jsm', ] diff --git a/browser/app/macbuild/Contents/moz.build b/browser/app/macbuild/Contents/moz.build index b8b28926de46..daf51c25cbf5 100644 --- a/browser/app/macbuild/Contents/moz.build +++ b/browser/app/macbuild/Contents/moz.build @@ -6,20 +6,14 @@ defs = [] -for s in ( - "MOZ_GECKODRIVER", - "MOZ_ASAN", - "MOZ_TSAN", - "MOZ_CRASHREPORTER", - "MOZ_APP_NAME", -): +for s in ('MOZ_GECKODRIVER', 'MOZ_ASAN', 'MOZ_TSAN', 'MOZ_CRASHREPORTER', + 'MOZ_APP_NAME'): if CONFIG[s]: - defs.append("-D%s=%s" % (s, "1" if CONFIG[s] is True else CONFIG[s])) + defs.append('-D%s=%s' % (s, '1' if CONFIG[s] is True else CONFIG[s])) GeneratedFile( - "MacOS-files.txt", - script="/python/mozbuild/mozbuild/action/preprocessor.py", - entry_point="generate", - inputs=["MacOS-files.in"], - flags=defs, -) + 'MacOS-files.txt', + script='/python/mozbuild/mozbuild/action/preprocessor.py', + entry_point='generate', + inputs=['MacOS-files.in'], + flags=defs) diff --git a/browser/app/macversion.py b/browser/app/macversion.py index 3d9aaaa94ac5..f57b5dc85f0d 100644 --- a/browser/app/macversion.py +++ b/browser/app/macversion.py @@ -10,17 +10,17 @@ import sys import re o = OptionParser() -o.add_option("--buildid", dest="buildid") -o.add_option("--version", dest="version") +o.add_option('--buildid', dest='buildid') +o.add_option('--version', dest='version') (options, args) = o.parse_args() if not options.buildid: - print("--buildid is required", file=sys.stderr) + print('--buildid is required', file=sys.stderr) sys.exit(1) if not options.version: - print("--version is required", file=sys.stderr) + print('--version is required', file=sys.stderr) sys.exit(1) # We want to build a version number that matches the format allowed for @@ -29,19 +29,18 @@ if not options.version: # builds), but also so that newly-built older versions (e.g. beta build) aren't # considered "newer" than previously-built newer versions (e.g. a trunk nightly) -define, MOZ_BUILDID, buildid = ( - io.open(options.buildid, "r", encoding="utf-8").read().split() -) +define, MOZ_BUILDID, buildid = io.open( + options.buildid, 'r', encoding='utf-8').read().split() # extract only the major version (i.e. "14" from "14.0b1") -majorVersion = re.match(r"^(\d+)[^\d].*", options.version).group(1) +majorVersion = re.match(r'^(\d+)[^\d].*', options.version).group(1) # last two digits of the year twodigityear = buildid[2:4] month = buildid[4:6] -if month[0] == "0": +if month[0] == '0': month = month[1] day = buildid[6:8] -if day[0] == "0": +if day[0] == '0': day = day[1] -print("%s.%s.%s" % (majorVersion + twodigityear, month, day)) +print('%s.%s.%s' % (majorVersion + twodigityear, month, day)) diff --git a/browser/app/moz.build b/browser/app/moz.build index 9da2da337663..d6b25cbd92ab 100644 --- a/browser/app/moz.build +++ b/browser/app/moz.build @@ -29,90 +29,90 @@ with Files("profile/channel-prefs.js"): with Files("profile/firefox.js"): BUG_COMPONENT = ("Firefox", "General") -if CONFIG["MOZ_MACBUNDLE_NAME"]: - DIRS += ["macbuild/Contents"] +if CONFIG['MOZ_MACBUNDLE_NAME']: + DIRS += ['macbuild/Contents'] -if CONFIG["MOZ_NO_PIE_COMPAT"]: - GeckoProgram(CONFIG["MOZ_APP_NAME"] + "-bin") +if CONFIG['MOZ_NO_PIE_COMPAT']: + GeckoProgram(CONFIG['MOZ_APP_NAME'] + '-bin') - DIRS += ["no-pie"] + DIRS += ['no-pie'] else: - GeckoProgram(CONFIG["MOZ_APP_NAME"]) + GeckoProgram(CONFIG['MOZ_APP_NAME']) SOURCES += [ - "nsBrowserApp.cpp", + 'nsBrowserApp.cpp', ] # Neither channel-prefs.js nor firefox.exe want to end up in dist/bin/browser. DIST_SUBDIR = "" LOCAL_INCLUDES += [ - "!/build", - "/toolkit/xre", - "/xpcom/base", - "/xpcom/build", + '!/build', + '/toolkit/xre', + '/xpcom/base', + '/xpcom/build', ] -if CONFIG["LIBFUZZER"]: - USE_LIBS += ["fuzzer"] +if CONFIG['LIBFUZZER']: + USE_LIBS += [ 'fuzzer' ] LOCAL_INCLUDES += [ - "/tools/fuzzing/libfuzzer", + '/tools/fuzzing/libfuzzer', ] -if CONFIG["ENABLE_GECKODRIVER"]: - DEFINES["MOZ_GECKODRIVER"] = True +if CONFIG['ENABLE_GECKODRIVER']: + DEFINES['MOZ_GECKODRIVER'] = True -if CONFIG["CC_TYPE"] == "clang-cl": +if CONFIG['CC_TYPE'] == 'clang-cl': # Always enter a Windows program through wmain, whether or not we're # a console application. - WIN32_EXE_LDFLAGS += ["-ENTRY:wmainCRTStartup"] + WIN32_EXE_LDFLAGS += ['-ENTRY:wmainCRTStartup'] -if CONFIG["OS_ARCH"] == "WINNT": - RCINCLUDE = "splash.rc" +if CONFIG['OS_ARCH'] == 'WINNT': + RCINCLUDE = 'splash.rc' DIRS += [ - "winlauncher", + 'winlauncher', ] USE_LIBS += [ - "winlauncher", + 'winlauncher', ] LOCAL_INCLUDES += [ - "/browser/app/winlauncher", + '/browser/app/winlauncher', ] DELAYLOAD_DLLS += [ - "oleaut32.dll", - "ole32.dll", - "rpcrt4.dll", - "version.dll", + 'oleaut32.dll', + 'ole32.dll', + 'rpcrt4.dll', + 'version.dll', ] - if CONFIG["CC_TYPE"] == "clang-cl": - libpath_flag = "-LIBPATH:" + if CONFIG['CC_TYPE'] == 'clang-cl': + libpath_flag = '-LIBPATH:' else: - libpath_flag = "-L" + libpath_flag = '-L' WIN32_EXE_LDFLAGS += [ - libpath_flag + OBJDIR + "/winlauncher/freestanding", + libpath_flag + OBJDIR + '/winlauncher/freestanding', ] -if CONFIG["MOZ_SANDBOX"] and CONFIG["OS_ARCH"] == "Darwin": +if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_ARCH'] == 'Darwin': USE_LIBS += [ - "mozsandbox", + 'mozsandbox', ] -if CONFIG["MOZ_SANDBOX"] and CONFIG["OS_ARCH"] == "WINNT": +if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_ARCH'] == 'WINNT': # For sandbox includes and the include dependencies those have LOCAL_INCLUDES += [ - "/security/sandbox/chromium", - "/security/sandbox/chromium-shim", + '/security/sandbox/chromium', + '/security/sandbox/chromium-shim', ] USE_LIBS += [ - "sandbox_s", + 'sandbox_s', ] DELAYLOAD_DLLS += [ - "winmm.dll", - "user32.dll", + 'winmm.dll', + 'user32.dll', ] # Control the default heap size. @@ -123,29 +123,23 @@ if CONFIG["MOZ_SANDBOX"] and CONFIG["OS_ARCH"] == "WINNT": # The heap will grow if need be. # # Set it to 256k. See bug 127069. -if CONFIG["OS_ARCH"] == "WINNT" and CONFIG["CC_TYPE"] not in ("clang", "gcc"): - LDFLAGS += ["/HEAP:0x40000"] +if CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['CC_TYPE'] not in ('clang', 'gcc'): + LDFLAGS += ['/HEAP:0x40000'] DisableStlWrapping() -if CONFIG["HAVE_CLOCK_MONOTONIC"]: - OS_LIBS += CONFIG["REALTIME_LIBS"] +if CONFIG['HAVE_CLOCK_MONOTONIC']: + OS_LIBS += CONFIG['REALTIME_LIBS'] -if CONFIG["MOZ_LINUX_32_SSE2_STARTUP_ERROR"]: - DEFINES["MOZ_LINUX_32_SSE2_STARTUP_ERROR"] = True - COMPILE_FLAGS["OS_CXXFLAGS"] = [ - f - for f in COMPILE_FLAGS.get("OS_CXXFLAGS", []) - if not f.startswith("-march=") and f not in ("-msse", "-msse2", "-mfpmath=sse") +if CONFIG['MOZ_LINUX_32_SSE2_STARTUP_ERROR']: + DEFINES['MOZ_LINUX_32_SSE2_STARTUP_ERROR'] = True + COMPILE_FLAGS['OS_CXXFLAGS'] = [ + f for f in COMPILE_FLAGS.get('OS_CXXFLAGS', []) + if not f.startswith('-march=') and f not in ('-msse', '-msse2', '-mfpmath=sse') ] + [ - "-mno-sse", - "-mno-sse2", - "-mfpmath=387", + '-mno-sse', '-mno-sse2', '-mfpmath=387', ] -for icon in ("firefox", "document", "newwindow", "newtab", "pbmode"): - DEFINES[icon.upper() + "_ICO"] = '"%s/%s/%s.ico"' % ( - TOPSRCDIR, - CONFIG["MOZ_BRANDING_DIRECTORY"], - icon, - ) +for icon in ('firefox', 'document', 'newwindow', 'newtab', 'pbmode'): + DEFINES[icon.upper() + '_ICO'] = '"%s/%s/%s.ico"' % ( + TOPSRCDIR, CONFIG['MOZ_BRANDING_DIRECTORY'], icon) diff --git a/browser/app/no-pie/moz.build b/browser/app/no-pie/moz.build index 74aa89409d19..4c9c884327c3 100644 --- a/browser/app/no-pie/moz.build +++ b/browser/app/no-pie/moz.build @@ -4,21 +4,25 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -Program(CONFIG["MOZ_APP_NAME"]) +Program(CONFIG['MOZ_APP_NAME']) SOURCES += [ - "NoPie.c", + 'NoPie.c', ] # For some reason, LTO messes things up. We don't care anyways. CFLAGS += [ - "-fno-lto", + '-fno-lto', ] # Use OS_LIBS instead of LDFLAGS to "force" the flag to come after -pie # from MOZ_PROGRAM_LDFLAGS. -if CONFIG["CC_TYPE"] == "clang": +if CONFIG['CC_TYPE'] == 'clang': # clang < 5.0 doesn't support -no-pie. - OS_LIBS += ["-nopie"] + OS_LIBS += [ + '-nopie' + ] else: - OS_LIBS += ["-no-pie"] + OS_LIBS += [ + '-no-pie' + ] diff --git a/browser/app/winlauncher/freestanding/gen_ntdll_freestanding_lib.py b/browser/app/winlauncher/freestanding/gen_ntdll_freestanding_lib.py index a69261cc3ae3..6a91f63fbce7 100644 --- a/browser/app/winlauncher/freestanding/gen_ntdll_freestanding_lib.py +++ b/browser/app/winlauncher/freestanding/gen_ntdll_freestanding_lib.py @@ -20,11 +20,11 @@ def main(output_fd, def_file, llvm_dlltool, *llvm_dlltool_args): try: cmd = [llvm_dlltool] cmd.extend(llvm_dlltool_args) - cmd += ["-d", def_file, "-l", tmp_output] + cmd += ['-d', def_file, '-l', tmp_output] subprocess.check_call(cmd) - with open(tmp_output, "rb") as tmplib: + with open(tmp_output, 'rb') as tmplib: output_fd.write(tmplib.read()) finally: os.remove(tmp_output) diff --git a/browser/app/winlauncher/freestanding/moz.build b/browser/app/winlauncher/freestanding/moz.build index 5e2dac70ea1e..460f8ec4cb0b 100644 --- a/browser/app/winlauncher/freestanding/moz.build +++ b/browser/app/winlauncher/freestanding/moz.build @@ -4,7 +4,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -Library("winlauncher-freestanding") +Library('winlauncher-freestanding') FORCE_STATIC_LIB = True @@ -14,43 +14,43 @@ FORCE_STATIC_LIB = True NO_PGO = True UNIFIED_SOURCES += [ - "DllBlocklist.cpp", - "FunctionTableResolver.cpp", - "LoaderPrivateAPI.cpp", - "ModuleLoadFrame.cpp", + 'DllBlocklist.cpp', + 'FunctionTableResolver.cpp', + 'LoaderPrivateAPI.cpp', + 'ModuleLoadFrame.cpp', ] # This library must be compiled in a freestanding environment, as its code must # not assume that it has access to any runtime libraries. -if CONFIG["CC_TYPE"] == "clang-cl": - CXXFLAGS += ["-Xclang"] +if CONFIG['CC_TYPE'] == 'clang-cl': + CXXFLAGS += ['-Xclang'] CXXFLAGS += [ - "-ffreestanding", + '-ffreestanding', ] # Forcibly include Freestanding.h into all source files in this library. -if CONFIG["CC_TYPE"] == "clang-cl": - CXXFLAGS += ["-FI"] +if CONFIG['CC_TYPE'] == 'clang-cl': + CXXFLAGS += ['-FI'] else: - CXXFLAGS += ["-include"] + CXXFLAGS += ['-include'] -CXXFLAGS += [SRCDIR + "/Freestanding.h"] +CXXFLAGS += [ SRCDIR + '/Freestanding.h' ] OS_LIBS += [ - "ntdll", - "ntdll_freestanding", + 'ntdll', + 'ntdll_freestanding', ] -if CONFIG["COMPILE_ENVIRONMENT"] and CONFIG["LLVM_DLLTOOL"]: +if CONFIG['COMPILE_ENVIRONMENT'] and CONFIG['LLVM_DLLTOOL']: GeneratedFile( - "%sntdll_freestanding.%s" % (CONFIG["LIB_PREFIX"], CONFIG["LIB_SUFFIX"]), - script="gen_ntdll_freestanding_lib.py", - inputs=["ntdll_freestanding.def"], - flags=[CONFIG["LLVM_DLLTOOL"]] + CONFIG["LLVM_DLLTOOL_FLAGS"], - ) + '%sntdll_freestanding.%s' % (CONFIG['LIB_PREFIX'], + CONFIG['LIB_SUFFIX']), + script='gen_ntdll_freestanding_lib.py', + inputs=['ntdll_freestanding.def'], + flags=[CONFIG['LLVM_DLLTOOL']] + CONFIG['LLVM_DLLTOOL_FLAGS']) DisableStlWrapping() -with Files("**"): - BUG_COMPONENT = ("Firefox", "Launcher Process") +with Files('**'): + BUG_COMPONENT = ('Firefox', 'Launcher Process') diff --git a/browser/app/winlauncher/moz.build b/browser/app/winlauncher/moz.build index 585e88354731..499396b3774b 100644 --- a/browser/app/winlauncher/moz.build +++ b/browser/app/winlauncher/moz.build @@ -4,48 +4,48 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -Library("winlauncher") +Library('winlauncher') FORCE_STATIC_LIB = True UNIFIED_SOURCES += [ - "/ipc/mscom/ProcessRuntime.cpp", - "/widget/windows/WindowsConsole.cpp", - "DllBlocklistInit.cpp", - "ErrorHandler.cpp", - "LauncherProcessWin.cpp", - "LaunchUnelevated.cpp", - "NtLoaderAPI.cpp", + '/ipc/mscom/ProcessRuntime.cpp', + '/widget/windows/WindowsConsole.cpp', + 'DllBlocklistInit.cpp', + 'ErrorHandler.cpp', + 'LauncherProcessWin.cpp', + 'LaunchUnelevated.cpp', + 'NtLoaderAPI.cpp', ] OS_LIBS += [ - "oleaut32", - "ole32", - "rpcrt4", - "version", + 'oleaut32', + 'ole32', + 'rpcrt4', + 'version', ] DIRS += [ - "freestanding", + 'freestanding', ] USE_LIBS += [ - "winlauncher-freestanding", + 'winlauncher-freestanding', ] TEST_DIRS += [ - "test", + 'test', ] -if CONFIG["MOZ_LAUNCHER_PROCESS"]: +if CONFIG['MOZ_LAUNCHER_PROCESS']: UNIFIED_SOURCES += [ - "/toolkit/xre/LauncherRegistryInfo.cpp", - "/toolkit/xre/WinTokenUtils.cpp", + '/toolkit/xre/LauncherRegistryInfo.cpp', + '/toolkit/xre/WinTokenUtils.cpp', ] - for var in ("MOZ_APP_BASENAME", "MOZ_APP_VENDOR"): + for var in ('MOZ_APP_BASENAME', 'MOZ_APP_VENDOR'): DEFINES[var] = '"%s"' % CONFIG[var] DisableStlWrapping() -with Files("**"): - BUG_COMPONENT = ("Firefox", "Launcher Process") +with Files('**'): + BUG_COMPONENT = ('Firefox', 'Launcher Process') diff --git a/browser/app/winlauncher/test/moz.build b/browser/app/winlauncher/test/moz.build index 0416be16c055..e53a113279d6 100644 --- a/browser/app/winlauncher/test/moz.build +++ b/browser/app/winlauncher/test/moz.build @@ -8,22 +8,22 @@ DisableStlWrapping() GeckoCppUnitTests( [ - "TestSafeThreadLocal", - "TestSameBinary", + 'TestSafeThreadLocal', + 'TestSameBinary', ], - linkage=None, + linkage=None ) LOCAL_INCLUDES += [ - "/browser/app/winlauncher", + '/browser/app/winlauncher', ] OS_LIBS += [ - "ntdll", + 'ntdll', ] -if CONFIG["CC_TYPE"] in ("gcc", "clang"): +if CONFIG['CC_TYPE'] in ('gcc', 'clang'): # This allows us to use wmain as the entry point on mingw LDFLAGS += [ - "-municode", + '-municode', ] diff --git a/browser/base/gen_aboutneterror_codes.py b/browser/base/gen_aboutneterror_codes.py index a333d206fa15..572a6c821bbf 100644 --- a/browser/base/gen_aboutneterror_codes.py +++ b/browser/base/gen_aboutneterror_codes.py @@ -11,10 +11,8 @@ import sys def find_error_ids(filename, known_strings): - with open(filename, "r", encoding="utf-8") as f: - known_strings += [ - m.id.name for m in parse(f.read()).body if isinstance(m, Message) - ] + with open(filename, 'r', encoding="utf-8") as f: + known_strings += [m.id.name for m in parse(f.read()).body if isinstance(m, Message)] def main(output, *filenames): @@ -22,11 +20,11 @@ def main(output, *filenames): for filename in filenames: find_error_ids(filename, known_strings) - output.write("const KNOWN_ERROR_MESSAGE_IDS = new Set([\n") + output.write('const KNOWN_ERROR_MESSAGE_IDS = new Set([\n') for known_string in known_strings: output.write(' "{}",\n'.format(known_string)) - output.write("]);\n") + output.write(']);\n') -if __name__ == "__main__": +if __name__ == '__main__': sys.exit(main(sys.stdout, *sys.argv[1:])) diff --git a/browser/base/moz.build b/browser/base/moz.build index 393ec02bf30a..fdfa93d4623a 100644 --- a/browser/base/moz.build +++ b/browser/base/moz.build @@ -7,80 +7,80 @@ with Files("**"): BUG_COMPONENT = ("Firefox", "General") -SPHINX_TREES["sslerrorreport"] = "content/docs/sslerrorreport" -SPHINX_TREES["tabbrowser"] = "content/docs/tabbrowser" +SPHINX_TREES['sslerrorreport'] = 'content/docs/sslerrorreport' +SPHINX_TREES['tabbrowser'] = 'content/docs/tabbrowser' -with Files("content/docs/sslerrorreport/**"): - SCHEDULES.exclusive = ["docs"] +with Files('content/docs/sslerrorreport/**'): + SCHEDULES.exclusive = ['docs'] MOCHITEST_CHROME_MANIFESTS += [ - "content/test/chrome/chrome.ini", + 'content/test/chrome/chrome.ini', ] BROWSER_CHROME_MANIFESTS += [ - "content/test/about/browser.ini", - "content/test/alerts/browser.ini", - "content/test/backforward/browser.ini", - "content/test/caps/browser.ini", - "content/test/captivePortal/browser.ini", - "content/test/contextMenu/browser.ini", - "content/test/favicons/browser.ini", - "content/test/forms/browser.ini", - "content/test/fullscreen/browser.ini", - "content/test/general/browser.ini", - "content/test/historySwipeAnimation/browser.ini", - "content/test/keyboard/browser.ini", - "content/test/menubar/browser.ini", - "content/test/metaTags/browser.ini", - "content/test/outOfProcess/browser.ini", - "content/test/pageActions/browser.ini", - "content/test/pageinfo/browser.ini", - "content/test/pageStyle/browser.ini", - "content/test/performance/browser.ini", - "content/test/performance/hidpi/browser.ini", - "content/test/performance/io/browser.ini", - "content/test/performance/lowdpi/browser.ini", - "content/test/permissions/browser.ini", - "content/test/plugins/browser.ini", - "content/test/popupNotifications/browser.ini", - "content/test/popups/browser.ini", - "content/test/protectionsUI/browser.ini", - "content/test/referrer/browser.ini", - "content/test/sanitize/browser.ini", - "content/test/sidebar/browser.ini", - "content/test/siteIdentity/browser.ini", - "content/test/static/browser.ini", - "content/test/statuspanel/browser.ini", - "content/test/sync/browser.ini", - "content/test/tabcrashed/browser.ini", - "content/test/tabdialogs/browser.ini", - "content/test/tabMediaIndicator/browser.ini", - "content/test/tabPrompts/browser.ini", - "content/test/tabs/browser.ini", - "content/test/touch/browser.ini", - "content/test/webextensions/browser.ini", - "content/test/webrtc/browser.ini", - "content/test/webrtc/legacyIndicator/browser.ini", - "content/test/zoom/browser.ini", + 'content/test/about/browser.ini', + 'content/test/alerts/browser.ini', + 'content/test/backforward/browser.ini', + 'content/test/caps/browser.ini', + 'content/test/captivePortal/browser.ini', + 'content/test/contextMenu/browser.ini', + 'content/test/favicons/browser.ini', + 'content/test/forms/browser.ini', + 'content/test/fullscreen/browser.ini', + 'content/test/general/browser.ini', + 'content/test/historySwipeAnimation/browser.ini', + 'content/test/keyboard/browser.ini', + 'content/test/menubar/browser.ini', + 'content/test/metaTags/browser.ini', + 'content/test/outOfProcess/browser.ini', + 'content/test/pageActions/browser.ini', + 'content/test/pageinfo/browser.ini', + 'content/test/pageStyle/browser.ini', + 'content/test/performance/browser.ini', + 'content/test/performance/hidpi/browser.ini', + 'content/test/performance/io/browser.ini', + 'content/test/performance/lowdpi/browser.ini', + 'content/test/permissions/browser.ini', + 'content/test/plugins/browser.ini', + 'content/test/popupNotifications/browser.ini', + 'content/test/popups/browser.ini', + 'content/test/protectionsUI/browser.ini', + 'content/test/referrer/browser.ini', + 'content/test/sanitize/browser.ini', + 'content/test/sidebar/browser.ini', + 'content/test/siteIdentity/browser.ini', + 'content/test/static/browser.ini', + 'content/test/statuspanel/browser.ini', + 'content/test/sync/browser.ini', + 'content/test/tabcrashed/browser.ini', + 'content/test/tabdialogs/browser.ini', + 'content/test/tabMediaIndicator/browser.ini', + 'content/test/tabPrompts/browser.ini', + 'content/test/tabs/browser.ini', + 'content/test/touch/browser.ini', + 'content/test/webextensions/browser.ini', + 'content/test/webrtc/browser.ini', + 'content/test/webrtc/legacyIndicator/browser.ini', + 'content/test/zoom/browser.ini', ] -PERFTESTS_MANIFESTS += ["content/test/perftest.ini"] +PERFTESTS_MANIFESTS += [ + 'content/test/perftest.ini' +] + +DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION'] +DEFINES['MOZ_APP_VERSION_DISPLAY'] = CONFIG['MOZ_APP_VERSION_DISPLAY'] -DEFINES["MOZ_APP_VERSION"] = CONFIG["MOZ_APP_VERSION"] -DEFINES["MOZ_APP_VERSION_DISPLAY"] = CONFIG["MOZ_APP_VERSION_DISPLAY"] +DEFINES['APP_LICENSE_BLOCK'] = '%s/content/overrides/app-license.html' % SRCDIR -DEFINES["APP_LICENSE_BLOCK"] = "%s/content/overrides/app-license.html" % SRCDIR +if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk', 'cocoa'): + DEFINES['CONTEXT_COPY_IMAGE_CONTENTS'] = 1 -if CONFIG["MOZ_WIDGET_TOOLKIT"] in ("windows", "gtk", "cocoa"): - DEFINES["CONTEXT_COPY_IMAGE_CONTENTS"] = 1 +if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk'): + DEFINES['MENUBAR_CAN_AUTOHIDE'] = 1 -if CONFIG["MOZ_WIDGET_TOOLKIT"] in ("windows", "gtk"): - DEFINES["MENUBAR_CAN_AUTOHIDE"] = 1 +JAR_MANIFESTS += ['jar.mn'] -JAR_MANIFESTS += ["jar.mn"] +GeneratedFile('content/aboutNetErrorCodes.js', script='gen_aboutneterror_codes.py', + inputs=['/browser/locales/en-US/browser/nsserrors.ftl']) -GeneratedFile( - "content/aboutNetErrorCodes.js", - script="gen_aboutneterror_codes.py", - inputs=["/browser/locales/en-US/browser/nsserrors.ftl"], -) diff --git a/browser/branding/aurora/content/moz.build b/browser/branding/aurora/content/moz.build index d988c0ff9b16..eb4454d28f88 100644 --- a/browser/branding/aurora/content/moz.build +++ b/browser/branding/aurora/content/moz.build @@ -4,4 +4,4 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] \ No newline at end of file diff --git a/browser/branding/aurora/locales/moz.build b/browser/branding/aurora/locales/moz.build index fff7035065b0..8bad13124d5a 100644 --- a/browser/branding/aurora/locales/moz.build +++ b/browser/branding/aurora/locales/moz.build @@ -4,6 +4,6 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DEFINES["MOZ_DISTRIBUTION_ID_UNQUOTED"] = CONFIG["MOZ_DISTRIBUTION_ID"] +DEFINES['MOZ_DISTRIBUTION_ID_UNQUOTED'] = CONFIG['MOZ_DISTRIBUTION_ID'] -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] \ No newline at end of file diff --git a/browser/branding/aurora/moz.build b/browser/branding/aurora/moz.build index dd081ac44496..9045cee11bb8 100644 --- a/browser/branding/aurora/moz.build +++ b/browser/branding/aurora/moz.build @@ -4,10 +4,10 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DIRS += ["content", "locales"] +DIRS += ['content', 'locales'] -DIST_SUBDIR = "browser" -export("DIST_SUBDIR") +DIST_SUBDIR = 'browser' +export('DIST_SUBDIR') -include("../branding-common.mozbuild") +include('../branding-common.mozbuild') FirefoxBranding() diff --git a/browser/branding/nightly/content/moz.build b/browser/branding/nightly/content/moz.build index d988c0ff9b16..eb4454d28f88 100644 --- a/browser/branding/nightly/content/moz.build +++ b/browser/branding/nightly/content/moz.build @@ -4,4 +4,4 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] \ No newline at end of file diff --git a/browser/branding/nightly/locales/moz.build b/browser/branding/nightly/locales/moz.build index fff7035065b0..8bad13124d5a 100644 --- a/browser/branding/nightly/locales/moz.build +++ b/browser/branding/nightly/locales/moz.build @@ -4,6 +4,6 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DEFINES["MOZ_DISTRIBUTION_ID_UNQUOTED"] = CONFIG["MOZ_DISTRIBUTION_ID"] +DEFINES['MOZ_DISTRIBUTION_ID_UNQUOTED'] = CONFIG['MOZ_DISTRIBUTION_ID'] -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] \ No newline at end of file diff --git a/browser/branding/nightly/moz.build b/browser/branding/nightly/moz.build index dd081ac44496..9045cee11bb8 100644 --- a/browser/branding/nightly/moz.build +++ b/browser/branding/nightly/moz.build @@ -4,10 +4,10 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DIRS += ["content", "locales"] +DIRS += ['content', 'locales'] -DIST_SUBDIR = "browser" -export("DIST_SUBDIR") +DIST_SUBDIR = 'browser' +export('DIST_SUBDIR') -include("../branding-common.mozbuild") +include('../branding-common.mozbuild') FirefoxBranding() diff --git a/browser/branding/official/content/moz.build b/browser/branding/official/content/moz.build index d988c0ff9b16..eb4454d28f88 100644 --- a/browser/branding/official/content/moz.build +++ b/browser/branding/official/content/moz.build @@ -4,4 +4,4 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] \ No newline at end of file diff --git a/browser/branding/official/locales/moz.build b/browser/branding/official/locales/moz.build index d988c0ff9b16..eb4454d28f88 100644 --- a/browser/branding/official/locales/moz.build +++ b/browser/branding/official/locales/moz.build @@ -4,4 +4,4 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] \ No newline at end of file diff --git a/browser/branding/official/moz.build b/browser/branding/official/moz.build index dd081ac44496..9045cee11bb8 100644 --- a/browser/branding/official/moz.build +++ b/browser/branding/official/moz.build @@ -4,10 +4,10 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DIRS += ["content", "locales"] +DIRS += ['content', 'locales'] -DIST_SUBDIR = "browser" -export("DIST_SUBDIR") +DIST_SUBDIR = 'browser' +export('DIST_SUBDIR') -include("../branding-common.mozbuild") +include('../branding-common.mozbuild') FirefoxBranding() diff --git a/browser/branding/unofficial/content/moz.build b/browser/branding/unofficial/content/moz.build index d988c0ff9b16..eb4454d28f88 100644 --- a/browser/branding/unofficial/content/moz.build +++ b/browser/branding/unofficial/content/moz.build @@ -4,4 +4,4 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] \ No newline at end of file diff --git a/browser/branding/unofficial/locales/moz.build b/browser/branding/unofficial/locales/moz.build index fff7035065b0..8bad13124d5a 100644 --- a/browser/branding/unofficial/locales/moz.build +++ b/browser/branding/unofficial/locales/moz.build @@ -4,6 +4,6 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DEFINES["MOZ_DISTRIBUTION_ID_UNQUOTED"] = CONFIG["MOZ_DISTRIBUTION_ID"] +DEFINES['MOZ_DISTRIBUTION_ID_UNQUOTED'] = CONFIG['MOZ_DISTRIBUTION_ID'] -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] \ No newline at end of file diff --git a/browser/branding/unofficial/moz.build b/browser/branding/unofficial/moz.build index dd081ac44496..9045cee11bb8 100644 --- a/browser/branding/unofficial/moz.build +++ b/browser/branding/unofficial/moz.build @@ -4,10 +4,10 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DIRS += ["content", "locales"] +DIRS += ['content', 'locales'] -DIST_SUBDIR = "browser" -export("DIST_SUBDIR") +DIST_SUBDIR = 'browser' +export('DIST_SUBDIR') -include("../branding-common.mozbuild") +include('../branding-common.mozbuild') FirefoxBranding() diff --git a/browser/components/about/moz.build b/browser/components/about/moz.build index 9be34f57b927..a178cd21d2e8 100644 --- a/browser/components/about/moz.build +++ b/browser/components/about/moz.build @@ -8,25 +8,25 @@ with Files("**"): BUG_COMPONENT = ("Firefox", "General") EXPORTS.mozilla.browser += [ - "AboutRedirector.h", + 'AboutRedirector.h', ] -XPCSHELL_TESTS_MANIFESTS += ["test/unit/xpcshell.ini"] +XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini'] SOURCES += [ - "AboutRedirector.cpp", + 'AboutRedirector.cpp', ] XPCOM_MANIFESTS += [ - "components.conf", + 'components.conf', ] -FINAL_LIBRARY = "browsercomps" +FINAL_LIBRARY = 'browsercomps' LOCAL_INCLUDES += [ - "../build", - "/dom/base", - "/ipc/chromium/src", + '../build', + '/dom/base', + '/ipc/chromium/src', ] -include("/ipc/chromium/chromium-config.mozbuild") +include('/ipc/chromium/chromium-config.mozbuild') diff --git a/browser/components/aboutconfig/moz.build b/browser/components/aboutconfig/moz.build index 47182555bb72..7ff4b7ef8522 100644 --- a/browser/components/aboutconfig/moz.build +++ b/browser/components/aboutconfig/moz.build @@ -4,6 +4,6 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -BROWSER_CHROME_MANIFESTS += ["test/browser/browser.ini"] +BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini'] -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] diff --git a/browser/components/aboutlogins/moz.build b/browser/components/aboutlogins/moz.build index ef815d609986..d912a6f407b7 100644 --- a/browser/components/aboutlogins/moz.build +++ b/browser/components/aboutlogins/moz.build @@ -4,20 +4,20 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] -with Files("**"): - BUG_COMPONENT = ("Firefox", "about:logins") +with Files('**'): + BUG_COMPONENT = ('Firefox', 'about:logins') EXTRA_JS_MODULES += [ - "LoginBreaches.jsm", + 'LoginBreaches.jsm', ] FINAL_TARGET_FILES.actors += [ - "AboutLoginsChild.jsm", - "AboutLoginsParent.jsm", + 'AboutLoginsChild.jsm', + 'AboutLoginsParent.jsm', ] -BROWSER_CHROME_MANIFESTS += ["tests/browser/browser.ini"] -MOCHITEST_CHROME_MANIFESTS += ["tests/chrome/chrome.ini"] -XPCSHELL_TESTS_MANIFESTS += ["tests/unit/xpcshell.ini"] +BROWSER_CHROME_MANIFESTS += ['tests/browser/browser.ini'] +MOCHITEST_CHROME_MANIFESTS += ['tests/chrome/chrome.ini'] +XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini'] diff --git a/browser/components/attribution/moz.build b/browser/components/attribution/moz.build index 9d8a560eda80..1cd9952495ae 100644 --- a/browser/components/attribution/moz.build +++ b/browser/components/attribution/moz.build @@ -7,31 +7,31 @@ with Files("**"): BUG_COMPONENT = ("Toolkit", "Telemetry") -XPCSHELL_TESTS_MANIFESTS += ["test/xpcshell/xpcshell.ini"] +XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell/xpcshell.ini'] -BROWSER_CHROME_MANIFESTS += ["test/browser/browser.ini"] +BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini'] EXTRA_JS_MODULES += [ - "AttributionCode.jsm", + 'AttributionCode.jsm', ] -if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa": +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': XPIDL_SOURCES += [ - "nsIMacAttribution.idl", + 'nsIMacAttribution.idl', ] - XPIDL_MODULE = "attribution" + XPIDL_MODULE = 'attribution' EXPORTS += [ - "nsMacAttribution.h", + 'nsMacAttribution.h', ] SOURCES += [ - "nsMacAttribution.cpp", + 'nsMacAttribution.cpp', ] - FINAL_LIBRARY = "browsercomps" + FINAL_LIBRARY = 'browsercomps' EXTRA_JS_MODULES += [ - "MacAttribution.jsm", + 'MacAttribution.jsm', ] diff --git a/browser/components/build/moz.build b/browser/components/build/moz.build index 901c6ddfed8d..170f181bf871 100644 --- a/browser/components/build/moz.build +++ b/browser/components/build/moz.build @@ -8,15 +8,15 @@ with Files("**"): BUG_COMPONENT = ("Firefox Build System", "General") XPCOM_MANIFESTS += [ - "components.conf", + 'components.conf', ] -Library("browsercomps") -FINAL_LIBRARY = "xul" +Library('browsercomps') +FINAL_LIBRARY = 'xul' LOCAL_INCLUDES += [ - "../about", - "../migration", - "../sessionstore", - "../shell", + '../about', + '../migration', + '../sessionstore', + '../shell', ] diff --git a/browser/components/contextualidentity/moz.build b/browser/components/contextualidentity/moz.build index 4101066ad3c8..9364d1f2e5e3 100644 --- a/browser/components/contextualidentity/moz.build +++ b/browser/components/contextualidentity/moz.build @@ -5,10 +5,10 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. BROWSER_CHROME_MANIFESTS += [ - "test/browser/browser.ini", + 'test/browser/browser.ini', ] -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] -with Files("**"): - BUG_COMPONENT = ("Core", "DOM: Security") +with Files('**'): + BUG_COMPONENT = ('Core', 'DOM: Security') diff --git a/browser/components/customizableui/content/moz.build b/browser/components/customizableui/content/moz.build index d988c0ff9b16..eb4454d28f88 100644 --- a/browser/components/customizableui/content/moz.build +++ b/browser/components/customizableui/content/moz.build @@ -4,4 +4,4 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] \ No newline at end of file diff --git a/browser/components/customizableui/moz.build b/browser/components/customizableui/moz.build index e5cc2498e7c3..98c4b06ad313 100644 --- a/browser/components/customizableui/moz.build +++ b/browser/components/customizableui/moz.build @@ -5,23 +5,23 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. DIRS += [ - "content", + 'content', ] -BROWSER_CHROME_MANIFESTS += ["test/browser.ini"] +BROWSER_CHROME_MANIFESTS += ['test/browser.ini'] TESTING_JS_MODULES += [ - "test/CustomizableUITestUtils.jsm", + 'test/CustomizableUITestUtils.jsm', ] EXTRA_JS_MODULES += [ - "CustomizableUI.jsm", - "CustomizableWidgets.jsm", - "CustomizeMode.jsm", - "DragPositionManager.jsm", - "PanelMultiView.jsm", - "SearchWidgetTracker.jsm", + 'CustomizableUI.jsm', + 'CustomizableWidgets.jsm', + 'CustomizeMode.jsm', + 'DragPositionManager.jsm', + 'PanelMultiView.jsm', + 'SearchWidgetTracker.jsm', ] -with Files("**"): - BUG_COMPONENT = ("Firefox", "Toolbars and Customization") +with Files('**'): + BUG_COMPONENT = ('Firefox', 'Toolbars and Customization') diff --git a/browser/components/doh/moz.build b/browser/components/doh/moz.build index 0cdc2dff9261..c3de603a2f71 100644 --- a/browser/components/doh/moz.build +++ b/browser/components/doh/moz.build @@ -4,15 +4,15 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -with Files("**"): - BUG_COMPONENT = ("Firefox", "Security") +with Files('**'): + BUG_COMPONENT = ('Firefox', 'Security') EXTRA_JS_MODULES += [ - "DoHConfig.jsm", - "DoHController.jsm", - "DoHHeuristics.jsm", - "TRRPerformance.jsm", + 'DoHConfig.jsm', + 'DoHController.jsm', + 'DoHHeuristics.jsm', + 'TRRPerformance.jsm', ] -XPCSHELL_TESTS_MANIFESTS += ["test/unit/xpcshell.ini"] -BROWSER_CHROME_MANIFESTS += ["test/browser/browser.ini"] +XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini'] +BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini'] diff --git a/browser/components/downloads/moz.build b/browser/components/downloads/moz.build index b98c027fd897..8ec54f33a1dd 100644 --- a/browser/components/downloads/moz.build +++ b/browser/components/downloads/moz.build @@ -4,27 +4,27 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -with Files("*"): - BUG_COMPONENT = ("Firefox", "Downloads Panel") +with Files('*'): + BUG_COMPONENT = ('Firefox', 'Downloads Panel') -BROWSER_CHROME_MANIFESTS += ["test/browser/browser.ini"] +BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini'] -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] EXTRA_JS_MODULES += [ - "DownloadsCommon.jsm", - "DownloadsSubview.jsm", - "DownloadsTaskbar.jsm", - "DownloadsViewableInternally.jsm", - "DownloadsViewUI.jsm", + 'DownloadsCommon.jsm', + 'DownloadsSubview.jsm', + 'DownloadsTaskbar.jsm', + 'DownloadsViewableInternally.jsm', + 'DownloadsViewUI.jsm', ] -toolkit = CONFIG["MOZ_WIDGET_TOOLKIT"] +toolkit = CONFIG['MOZ_WIDGET_TOOLKIT'] -if toolkit == "cocoa": - EXTRA_JS_MODULES += ["DownloadsMacFinderProgress.jsm"] +if toolkit == 'cocoa': + EXTRA_JS_MODULES += ['DownloadsMacFinderProgress.jsm'] -with Files("**"): - BUG_COMPONENT = ("Firefox", "Downloads Panel") +with Files('**'): + BUG_COMPONENT = ('Firefox', 'Downloads Panel') -XPCSHELL_TESTS_MANIFESTS += ["test/unit/xpcshell.ini"] +XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini'] diff --git a/browser/components/enterprisepolicies/helpers/moz.build b/browser/components/enterprisepolicies/helpers/moz.build index 648745cd3fbf..947d92c31d84 100644 --- a/browser/components/enterprisepolicies/helpers/moz.build +++ b/browser/components/enterprisepolicies/helpers/moz.build @@ -8,7 +8,7 @@ with Files("**"): BUG_COMPONENT = ("Firefox", "Enterprise Policies") EXTRA_JS_MODULES.policies += [ - "BookmarksPolicies.jsm", - "ProxyPolicies.jsm", - "WebsiteFilter.jsm", + 'BookmarksPolicies.jsm', + 'ProxyPolicies.jsm', + 'WebsiteFilter.jsm', ] diff --git a/browser/components/enterprisepolicies/moz.build b/browser/components/enterprisepolicies/moz.build index e7ae4b19c5b7..165bcb0eb97d 100644 --- a/browser/components/enterprisepolicies/moz.build +++ b/browser/components/enterprisepolicies/moz.build @@ -7,19 +7,21 @@ with Files("**"): BUG_COMPONENT = ("Firefox", "Enterprise Policies") -SPHINX_TREES["docs"] = "docs" +SPHINX_TREES['docs'] = 'docs' DIRS += [ - "helpers", - "schemas", + 'helpers', + 'schemas', ] -TEST_DIRS += ["tests"] +TEST_DIRS += [ + 'tests' +] EXTRA_JS_MODULES.policies += [ - "Policies.jsm", + 'Policies.jsm', ] -FINAL_LIBRARY = "browsercomps" +FINAL_LIBRARY = 'browsercomps' -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] diff --git a/browser/components/enterprisepolicies/schemas/moz.build b/browser/components/enterprisepolicies/schemas/moz.build index 19e17705e798..54c07f173169 100644 --- a/browser/components/enterprisepolicies/schemas/moz.build +++ b/browser/components/enterprisepolicies/schemas/moz.build @@ -8,5 +8,5 @@ with Files("**"): BUG_COMPONENT = ("Firefox", "Enterprise Policies") EXTRA_PP_JS_MODULES.policies += [ - "schema.jsm", + 'schema.jsm', ] diff --git a/browser/components/enterprisepolicies/tests/moz.build b/browser/components/enterprisepolicies/tests/moz.build index abb21770236d..023442ca9949 100644 --- a/browser/components/enterprisepolicies/tests/moz.build +++ b/browser/components/enterprisepolicies/tests/moz.build @@ -5,14 +5,14 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. BROWSER_CHROME_MANIFESTS += [ - "browser/browser.ini", - "browser/disable_app_update/browser.ini", - "browser/disable_default_bookmarks/browser.ini", - "browser/disable_developer_tools/browser.ini", - "browser/disable_forget_button/browser.ini", - "browser/disable_fxscreenshots/browser.ini", - "browser/hardware_acceleration/browser.ini", - "browser/managedbookmarks/browser.ini", + 'browser/browser.ini', + 'browser/disable_app_update/browser.ini', + 'browser/disable_default_bookmarks/browser.ini', + 'browser/disable_developer_tools/browser.ini', + 'browser/disable_forget_button/browser.ini', + 'browser/disable_fxscreenshots/browser.ini', + 'browser/hardware_acceleration/browser.ini', + 'browser/managedbookmarks/browser.ini', ] -XPCSHELL_TESTS_MANIFESTS += ["xpcshell/xpcshell.ini"] +XPCSHELL_TESTS_MANIFESTS += ['xpcshell/xpcshell.ini'] diff --git a/browser/components/extensions/moz.build b/browser/components/extensions/moz.build index 5c1ac44fc569..e25ba29dcbc7 100644 --- a/browser/components/extensions/moz.build +++ b/browser/components/extensions/moz.build @@ -7,25 +7,25 @@ with Files("**"): BUG_COMPONENT = ("WebExtensions", "Untriaged") -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] EXTRA_COMPONENTS += [ - "extensions-browser.manifest", + 'extensions-browser.manifest', ] EXTRA_JS_MODULES += [ - "ExtensionControlledPopup.jsm", - "ExtensionPopups.jsm", + 'ExtensionControlledPopup.jsm', + 'ExtensionPopups.jsm', ] -DIRS += ["schemas"] +DIRS += ['schemas'] BROWSER_CHROME_MANIFESTS += [ - "test/browser/browser-private.ini", - "test/browser/browser.ini", + 'test/browser/browser-private.ini', + 'test/browser/browser.ini', ] -MOCHITEST_MANIFESTS += ["test/mochitest/mochitest.ini"] +MOCHITEST_MANIFESTS += ['test/mochitest/mochitest.ini'] XPCSHELL_TESTS_MANIFESTS += [ - "test/xpcshell/xpcshell.ini", + 'test/xpcshell/xpcshell.ini', ] diff --git a/browser/components/extensions/schemas/moz.build b/browser/components/extensions/schemas/moz.build index d988c0ff9b16..aac3a838c4c2 100644 --- a/browser/components/extensions/schemas/moz.build +++ b/browser/components/extensions/schemas/moz.build @@ -4,4 +4,4 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] diff --git a/browser/components/fxmonitor/moz.build b/browser/components/fxmonitor/moz.build index 1315cd4f5b07..9ecbb6d36829 100644 --- a/browser/components/fxmonitor/moz.build +++ b/browser/components/fxmonitor/moz.build @@ -4,13 +4,14 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -with Files("**"): - BUG_COMPONENT = ("Firefox", "Firefox Monitor") +with Files('**'): + BUG_COMPONENT = ('Firefox', 'Firefox Monitor') EXTRA_JS_MODULES += [ - "FirefoxMonitor.jsm", + 'FirefoxMonitor.jsm', ] -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] + +BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini'] -BROWSER_CHROME_MANIFESTS += ["test/browser/browser.ini"] diff --git a/browser/components/installerprefs/moz.build b/browser/components/installerprefs/moz.build index 853f2d888a80..064c580224cd 100644 --- a/browser/components/installerprefs/moz.build +++ b/browser/components/installerprefs/moz.build @@ -4,15 +4,15 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -with Files("**"): - BUG_COMPONENT = ("Firefox", "Installer") +with Files('**'): + BUG_COMPONENT = ('Firefox', 'Installer') -XPCSHELL_TESTS_MANIFESTS += ["test/unit/xpcshell.ini"] +XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini'] EXTRA_JS_MODULES += [ - "InstallerPrefs.jsm", + 'InstallerPrefs.jsm', ] XPCOM_MANIFESTS += [ - "components.conf", + 'components.conf', ] diff --git a/browser/components/ion/moz.build b/browser/components/ion/moz.build index 24736258a6f2..44c5110bbde1 100644 --- a/browser/components/ion/moz.build +++ b/browser/components/ion/moz.build @@ -4,14 +4,14 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -BROWSER_CHROME_MANIFESTS += ["test/browser/browser.ini"] +BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini'] -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] -with Files("**"): - BUG_COMPONENT = ("Firefox", "General") +with Files('**'): + BUG_COMPONENT = ('Firefox', 'General') TESTING_JS_MODULES += [ - "schemas/IonContentSchema.json", - "schemas/IonStudyAddonsSchema.json", + 'schemas/IonContentSchema.json', + 'schemas/IonStudyAddonsSchema.json', ] diff --git a/browser/components/migration/moz.build b/browser/components/migration/moz.build index 778c7f938bf2..e56a3329dc17 100644 --- a/browser/components/migration/moz.build +++ b/browser/components/migration/moz.build @@ -4,64 +4,64 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -XPCSHELL_TESTS_MANIFESTS += ["tests/unit/xpcshell.ini"] +XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini'] -MARIONETTE_UNIT_MANIFESTS += ["tests/marionette/manifest.ini"] +MARIONETTE_UNIT_MANIFESTS += ['tests/marionette/manifest.ini'] -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] XPIDL_SOURCES += [ - "nsIBrowserProfileMigrator.idl", + 'nsIBrowserProfileMigrator.idl', ] -XPIDL_MODULE = "migration" +XPIDL_MODULE = 'migration' EXTRA_JS_MODULES += [ - "ChromeMigrationUtils.jsm", - "ChromeProfileMigrator.jsm", - "FirefoxProfileMigrator.jsm", - "MigrationUtils.jsm", - "ProfileMigrator.jsm", + 'ChromeMigrationUtils.jsm', + 'ChromeProfileMigrator.jsm', + 'FirefoxProfileMigrator.jsm', + 'MigrationUtils.jsm', + 'ProfileMigrator.jsm', ] -if CONFIG["OS_ARCH"] == "WINNT": - if CONFIG["ENABLE_TESTS"]: +if CONFIG['OS_ARCH'] == 'WINNT': + if CONFIG['ENABLE_TESTS']: DIRS += [ - "tests/unit/insertIEHistory", + 'tests/unit/insertIEHistory', ] SOURCES += [ - "nsIEHistoryEnumerator.cpp", + 'nsIEHistoryEnumerator.cpp', ] EXTRA_JS_MODULES += [ - "360seProfileMigrator.jsm", - "ChromeWindowsLoginCrypto.jsm", - "EdgeProfileMigrator.jsm", - "ESEDBReader.jsm", - "IEProfileMigrator.jsm", - "MSMigrationUtils.jsm", + '360seProfileMigrator.jsm', + 'ChromeWindowsLoginCrypto.jsm', + 'EdgeProfileMigrator.jsm', + 'ESEDBReader.jsm', + 'IEProfileMigrator.jsm', + 'MSMigrationUtils.jsm', ] -if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa": +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': EXPORTS += [ - "nsKeychainMigrationUtils.h", + 'nsKeychainMigrationUtils.h', ] EXTRA_JS_MODULES += [ - "ChromeMacOSLoginCrypto.jsm", - "SafariProfileMigrator.jsm", + 'ChromeMacOSLoginCrypto.jsm', + 'SafariProfileMigrator.jsm', ] SOURCES += [ - "nsKeychainMigrationUtils.mm", + 'nsKeychainMigrationUtils.mm', ] XPIDL_SOURCES += [ - "nsIKeychainMigrationUtils.idl", + 'nsIKeychainMigrationUtils.idl', ] XPCOM_MANIFESTS += [ - "components.conf", + 'components.conf', ] -FINAL_LIBRARY = "browsercomps" +FINAL_LIBRARY = 'browsercomps' -with Files("**"): - BUG_COMPONENT = ("Firefox", "Migration") +with Files('**'): + BUG_COMPONENT = ('Firefox', 'Migration') diff --git a/browser/components/migration/tests/unit/insertIEHistory/moz.build b/browser/components/migration/tests/unit/insertIEHistory/moz.build index 33c261c74688..76ac757fb221 100644 --- a/browser/components/migration/tests/unit/insertIEHistory/moz.build +++ b/browser/components/migration/tests/unit/insertIEHistory/moz.build @@ -4,14 +4,14 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -FINAL_TARGET = "_tests/xpcshell/browser/components/migration/tests/unit" +FINAL_TARGET = '_tests/xpcshell/browser/components/migration/tests/unit' -Program("InsertIEHistory") +Program('InsertIEHistory') OS_LIBS += [ - "ole32", + 'ole32', ] SOURCES += [ - "InsertIEHistory.cpp", + 'InsertIEHistory.cpp', ] NO_PGO = True diff --git a/browser/components/moz.build b/browser/components/moz.build index ba617de9d82f..d9906d053f6b 100644 --- a/browser/components/moz.build +++ b/browser/components/moz.build @@ -22,86 +22,88 @@ with Files("tests/unit/test_distribution.js"): with Files("safebrowsing/**"): BUG_COMPONENT = ("Toolkit", "Safe Browsing") -with Files("controlcenter/**"): - BUG_COMPONENT = ("Firefox", "General") +with Files('controlcenter/**'): + BUG_COMPONENT = ('Firefox', 'General') DIRS += [ - "about", - "aboutconfig", - "aboutlogins", - "attribution", - "contextualidentity", - "customizableui", - "doh", - "downloads", - "enterprisepolicies", - "extensions", - "fxmonitor", - "migration", - "newtab", - "originattributes", - "ion", - "places", - "pocket", - "preferences", - "privatebrowsing", - "prompts", - "protections", - "protocolhandler", - "resistfingerprinting", - "search", - "sessionstore", - "shell", - "ssb", - "syncedtabs", - "uitour", - "urlbar", - "translation", + 'about', + 'aboutconfig', + 'aboutlogins', + 'attribution', + 'contextualidentity', + 'customizableui', + 'doh', + 'downloads', + 'enterprisepolicies', + 'extensions', + 'fxmonitor', + 'migration', + 'newtab', + 'originattributes', + 'ion', + 'places', + 'pocket', + 'preferences', + 'privatebrowsing', + 'prompts', + 'protections', + 'protocolhandler', + 'resistfingerprinting', + 'search', + 'sessionstore', + 'shell', + 'ssb', + 'syncedtabs', + 'uitour', + 'urlbar', + 'translation', ] -DIRS += ["build"] +DIRS += ['build'] -if CONFIG["NIGHTLY_BUILD"]: +if CONFIG['NIGHTLY_BUILD']: DIRS += [ - "payments", + 'payments', ] -if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa": - DIRS += ["touchbar"] -elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows": - DIRS += ["installerprefs"] +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': + DIRS += ['touchbar'] +elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': + DIRS += ['installerprefs'] XPIDL_SOURCES += [ - "nsIBrowserHandler.idl", + 'nsIBrowserHandler.idl', ] -XPIDL_MODULE = "browsercompsbase" +XPIDL_MODULE = 'browsercompsbase' XPCOM_MANIFESTS += [ - "components.conf", + 'components.conf', ] EXTRA_COMPONENTS += [ - "BrowserComponents.manifest", - "tests/startupRecorder.js", - "tests/testComponents.manifest", + 'BrowserComponents.manifest', + 'tests/startupRecorder.js', + 'tests/testComponents.manifest', ] EXTRA_JS_MODULES += [ - "BrowserContentHandler.jsm", - "BrowserGlue.jsm", - "distribution.js", + 'BrowserContentHandler.jsm', + 'BrowserGlue.jsm', + 'distribution.js', ] BROWSER_CHROME_MANIFESTS += [ - "safebrowsing/content/test/browser.ini", - "tests/browser/browser.ini", + 'safebrowsing/content/test/browser.ini', + 'tests/browser/browser.ini', ] -if CONFIG["MOZ_UPDATER"]: +if CONFIG['MOZ_UPDATER']: BROWSER_CHROME_MANIFESTS += [ - "tests/browser/whats_new_page/browser.ini", + 'tests/browser/whats_new_page/browser.ini', ] -XPCSHELL_TESTS_MANIFESTS += ["tests/unit/xpcshell.ini"] +XPCSHELL_TESTS_MANIFESTS += [ + 'tests/unit/xpcshell.ini' +] diff --git a/browser/components/newtab/moz.build b/browser/components/newtab/moz.build index 73a6d512841e..8b2d7476c40c 100644 --- a/browser/components/newtab/moz.build +++ b/browser/components/newtab/moz.build @@ -8,36 +8,36 @@ with Files("**"): BUG_COMPONENT = ("Firefox", "New Tab Page") BROWSER_CHROME_MANIFESTS += [ - "test/browser/abouthomecache/browser.ini", - "test/browser/browser.ini", + 'test/browser/abouthomecache/browser.ini', + 'test/browser/browser.ini', ] -SPHINX_TREES["docs"] = "docs" -SPHINX_TREES["content-src/asrouter/docs"] = "content-src/asrouter/docs" +SPHINX_TREES['docs'] = 'docs' +SPHINX_TREES['content-src/asrouter/docs'] = 'content-src/asrouter/docs' XPCSHELL_TESTS_MANIFESTS += [ - "test/xpcshell/xpcshell.ini", + 'test/xpcshell/xpcshell.ini', ] XPIDL_SOURCES += [ - "nsIAboutNewTabService.idl", + 'nsIAboutNewTabService.idl', ] -XPIDL_MODULE = "browser-newtab" +XPIDL_MODULE = 'browser-newtab' EXTRA_JS_MODULES += [ - "AboutNewTabService.jsm", + 'AboutNewTabService.jsm', ] FINAL_TARGET_FILES.actors += [ - "aboutwelcome/AboutWelcomeChild.jsm", - "aboutwelcome/AboutWelcomeParent.jsm", - "actors/ASRouterChild.jsm", - "actors/ASRouterParent.jsm", + 'aboutwelcome/AboutWelcomeChild.jsm', + 'aboutwelcome/AboutWelcomeParent.jsm', + 'actors/ASRouterChild.jsm', + 'actors/ASRouterParent.jsm', ] XPCOM_MANIFESTS += [ - "components.conf", + 'components.conf', ] -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] diff --git a/browser/components/originattributes/moz.build b/browser/components/originattributes/moz.build index 707d61ce1a12..502e5f2b1d6c 100644 --- a/browser/components/originattributes/moz.build +++ b/browser/components/originattributes/moz.build @@ -5,10 +5,12 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. BROWSER_CHROME_MANIFESTS += [ - "test/browser/browser.ini", + 'test/browser/browser.ini', ] -MOCHITEST_MANIFESTS += ["test/mochitest/mochitest.ini"] +MOCHITEST_MANIFESTS += [ + 'test/mochitest/mochitest.ini' +] -with Files("**"): - BUG_COMPONENT = ("Core", "DOM: Security") +with Files('**'): + BUG_COMPONENT = ('Core', 'DOM: Security') diff --git a/browser/components/payments/moz.build b/browser/components/payments/moz.build index 6c764f85fa99..1b4604c754db 100644 --- a/browser/components/payments/moz.build +++ b/browser/components/payments/moz.build @@ -4,33 +4,33 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -BROWSER_CHROME_MANIFESTS += ["test/browser/browser.ini"] +BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini'] -with Files("**"): - BUG_COMPONENT = ("Firefox", "WebPayments UI") +with Files('**'): + BUG_COMPONENT = ('Firefox', 'WebPayments UI') EXTRA_JS_MODULES += [ - "PaymentUIService.jsm", + 'PaymentUIService.jsm', ] XPCOM_MANIFESTS += [ - "components.conf", + 'components.conf', ] -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] MOCHITEST_MANIFESTS += [ - "test/mochitest/formautofill/mochitest.ini", - "test/mochitest/mochitest.ini", + 'test/mochitest/formautofill/mochitest.ini', + 'test/mochitest/mochitest.ini', ] -SPHINX_TREES["docs"] = "docs" +SPHINX_TREES['docs'] = 'docs' -with Files("docs/**"): - SCHEDULES.exclusive = ["docs"] +with Files('docs/**'): + SCHEDULES.exclusive = ['docs'] TESTING_JS_MODULES += [ - "test/PaymentTestUtils.jsm", + 'test/PaymentTestUtils.jsm', ] -XPCSHELL_TESTS_MANIFESTS += ["test/unit/xpcshell.ini"] +XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini'] diff --git a/browser/components/payments/server.py b/browser/components/payments/server.py index 7cb8380260a0..9b85bd0b572f 100644 --- a/browser/components/payments/server.py +++ b/browser/components/payments/server.py @@ -11,13 +11,14 @@ class RequestHandler(SimpleHTTPRequestHandler, object): def translate_path(self, path): # Map autofill paths to their own directory autofillPath = "/formautofill" - if path.startswith(autofillPath): - path = "browser/extensions/formautofill/content" + path[len(autofillPath) :] + if (path.startswith(autofillPath)): + path = "browser/extensions/formautofill/content" + \ + path[len(autofillPath):] else: path = "browser/components/payments/res" + path return super(RequestHandler, self).translate_path(path) -if __name__ == "__main__": +if __name__ == '__main__': BaseHTTPServer.test(RequestHandler, BaseHTTPServer.HTTPServer) diff --git a/browser/components/places/moz.build b/browser/components/places/moz.build index ee7920749860..e6f88b318c9d 100644 --- a/browser/components/places/moz.build +++ b/browser/components/places/moz.build @@ -4,15 +4,15 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -XPCSHELL_TESTS_MANIFESTS += ["tests/unit/xpcshell.ini"] -MOCHITEST_CHROME_MANIFESTS += ["tests/chrome/chrome.ini"] -BROWSER_CHROME_MANIFESTS += ["tests/browser/browser.ini"] +XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini'] +MOCHITEST_CHROME_MANIFESTS += ['tests/chrome/chrome.ini'] +BROWSER_CHROME_MANIFESTS += ['tests/browser/browser.ini'] -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] EXTRA_JS_MODULES += [ - "PlacesUIUtils.jsm", + 'PlacesUIUtils.jsm', ] -with Files("**"): - BUG_COMPONENT = ("Firefox", "Bookmarks & History") +with Files('**'): + BUG_COMPONENT = ('Firefox', 'Bookmarks & History') diff --git a/browser/components/pocket/moz.build b/browser/components/pocket/moz.build index fb823da11c7d..f6e00831eee2 100644 --- a/browser/components/pocket/moz.build +++ b/browser/components/pocket/moz.build @@ -7,6 +7,6 @@ with Files("**"): BUG_COMPONENT = ("Firefox", "Pocket") -BROWSER_CHROME_MANIFESTS += ["test/browser.ini", "test/unit/browser.ini"] +BROWSER_CHROME_MANIFESTS += ['test/browser.ini', 'test/unit/browser.ini'] -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] diff --git a/browser/components/preferences/dialogs/moz.build b/browser/components/preferences/dialogs/moz.build index 603c56050521..5045224be3c2 100644 --- a/browser/components/preferences/dialogs/moz.build +++ b/browser/components/preferences/dialogs/moz.build @@ -4,10 +4,10 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -for var in ("MOZ_APP_NAME", "MOZ_MACBUNDLE_NAME"): +for var in ('MOZ_APP_NAME', 'MOZ_MACBUNDLE_NAME'): DEFINES[var] = CONFIG[var] -if CONFIG["MOZ_WIDGET_TOOLKIT"] in ("windows", "gtk", "cocoa"): - DEFINES["HAVE_SHELL_SERVICE"] = 1 +if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk', 'cocoa'): + DEFINES['HAVE_SHELL_SERVICE'] = 1 -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] diff --git a/browser/components/preferences/moz.build b/browser/components/preferences/moz.build index 67163934c72f..76c619ccea19 100644 --- a/browser/components/preferences/moz.build +++ b/browser/components/preferences/moz.build @@ -4,17 +4,22 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DIRS += ["dialogs"] +DIRS += [ + 'dialogs' +] -BROWSER_CHROME_MANIFESTS += ["tests/browser.ini", "tests/siteData/browser.ini"] +BROWSER_CHROME_MANIFESTS += [ + 'tests/browser.ini', + 'tests/siteData/browser.ini' +] -for var in ("MOZ_APP_NAME", "MOZ_MACBUNDLE_NAME"): +for var in ('MOZ_APP_NAME', 'MOZ_MACBUNDLE_NAME'): DEFINES[var] = CONFIG[var] -if CONFIG["MOZ_WIDGET_TOOLKIT"] in ("windows", "gtk", "cocoa"): - DEFINES["HAVE_SHELL_SERVICE"] = 1 +if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk', 'cocoa'): + DEFINES['HAVE_SHELL_SERVICE'] = 1 -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] -with Files("**"): - BUG_COMPONENT = ("Firefox", "Preferences") +with Files('**'): + BUG_COMPONENT = ('Firefox', 'Preferences') diff --git a/browser/components/privatebrowsing/moz.build b/browser/components/privatebrowsing/moz.build index 7078f7e4db17..486737a7f3c4 100644 --- a/browser/components/privatebrowsing/moz.build +++ b/browser/components/privatebrowsing/moz.build @@ -5,10 +5,10 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. BROWSER_CHROME_MANIFESTS += [ - "test/browser/browser.ini", + 'test/browser/browser.ini', ] -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] -with Files("**"): - BUG_COMPONENT = ("Firefox", "Private Browsing") +with Files('**'): + BUG_COMPONENT = ('Firefox', 'Private Browsing') diff --git a/browser/components/prompts/moz.build b/browser/components/prompts/moz.build index 4c6d33af9095..21d5d2418e0a 100644 --- a/browser/components/prompts/moz.build +++ b/browser/components/prompts/moz.build @@ -6,9 +6,9 @@ with Files("**"): BUG_COMPONENT = ("Toolkit", "Notifications and Alerts") EXTRA_JS_MODULES += [ - "PromptCollection.jsm", + 'PromptCollection.jsm', ] XPCOM_MANIFESTS += [ - "components.conf", + 'components.conf', ] diff --git a/browser/components/protections/moz.build b/browser/components/protections/moz.build index 57bd0a917fa9..8cb4f4bca570 100644 --- a/browser/components/protections/moz.build +++ b/browser/components/protections/moz.build @@ -4,9 +4,9 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -BROWSER_CHROME_MANIFESTS += ["test/browser/browser.ini"] +BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini'] -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] -with Files("**"): - BUG_COMPONENT = ("Firefox", "Protections UI") +with Files('**'): + BUG_COMPONENT = ('Firefox', 'Protections UI') diff --git a/browser/components/protocolhandler/moz.build b/browser/components/protocolhandler/moz.build index 6e23e023cf0e..b06afbfa9c8d 100644 --- a/browser/components/protocolhandler/moz.build +++ b/browser/components/protocolhandler/moz.build @@ -4,15 +4,15 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -BROWSER_CHROME_MANIFESTS += ["test/browser/browser.ini"] +BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini'] EXTRA_JS_MODULES += [ - "WebProtocolHandlerRegistrar.jsm", + 'WebProtocolHandlerRegistrar.jsm', ] XPCOM_MANIFESTS += [ - "components.conf", + 'components.conf', ] -with Files("**"): - BUG_COMPONENT = ("Firefox", "General") +with Files('**'): + BUG_COMPONENT = ('Firefox', 'General') diff --git a/browser/components/resistfingerprinting/moz.build b/browser/components/resistfingerprinting/moz.build index c99c2f8f94b6..953cc416a024 100644 --- a/browser/components/resistfingerprinting/moz.build +++ b/browser/components/resistfingerprinting/moz.build @@ -8,13 +8,13 @@ with Files("**"): BUG_COMPONENT = ("Core", "Security") BROWSER_CHROME_MANIFESTS += [ - "test/browser/browser.ini", + 'test/browser/browser.ini', ] MOCHITEST_MANIFESTS += [ - "test/mochitest/mochitest.ini", + 'test/mochitest/mochitest.ini', ] MOCHITEST_CHROME_MANIFESTS += [ - "test/chrome/chrome.ini", -] + 'test/chrome/chrome.ini', +] \ No newline at end of file diff --git a/browser/components/search/moz.build b/browser/components/search/moz.build index efb73b82fe90..18653c878cdc 100644 --- a/browser/components/search/moz.build +++ b/browser/components/search/moz.build @@ -5,21 +5,21 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. EXTRA_JS_MODULES += [ - "SearchOneOffs.jsm", - "SearchTelemetry.jsm", - "SearchUIUtils.jsm", + 'SearchOneOffs.jsm', + 'SearchTelemetry.jsm', + 'SearchUIUtils.jsm', ] BROWSER_CHROME_MANIFESTS += [ - "test/browser/browser.ini", - "test/browser/google_codes/browser.ini", + 'test/browser/browser.ini', + 'test/browser/google_codes/browser.ini', ] -MARIONETTE_LAYOUT_MANIFESTS += ["test/marionette/manifest.ini"] +MARIONETTE_LAYOUT_MANIFESTS += ['test/marionette/manifest.ini'] -XPCSHELL_TESTS_MANIFESTS += ["test/unit/xpcshell.ini"] +XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini'] -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] -with Files("**"): - BUG_COMPONENT = ("Firefox", "Search") +with Files('**'): + BUG_COMPONENT = ('Firefox', 'Search') diff --git a/browser/components/search/test/marionette/test_engines_on_restart.py b/browser/components/search/test/marionette/test_engines_on_restart.py index 5f9bfe633400..6a657245df32 100644 --- a/browser/components/search/test/marionette/test_engines_on_restart.py +++ b/browser/components/search/test/marionette/test_engines_on_restart.py @@ -10,13 +10,12 @@ from marionette_harness.marionette_test import MarionetteTestCase class TestEnginesOnRestart(MarionetteTestCase): + def setUp(self): super(TestEnginesOnRestart, self).setUp() - self.marionette.enforce_gecko_prefs( - { - "browser.search.log": True, - } - ) + self.marionette.enforce_gecko_prefs({ + 'browser.search.log': True, + }) def get_default_search_engine(self): """Retrieve the identifier of the default search engine.""" diff --git a/browser/components/sessionstore/moz.build b/browser/components/sessionstore/moz.build index cdbdba2b3197..07006d8d06b2 100644 --- a/browser/components/sessionstore/moz.build +++ b/browser/components/sessionstore/moz.build @@ -4,31 +4,31 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -XPCSHELL_TESTS_MANIFESTS += ["test/unit/xpcshell.ini"] -BROWSER_CHROME_MANIFESTS += ["test/browser.ini"] +XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini'] +BROWSER_CHROME_MANIFESTS += ['test/browser.ini'] -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] EXTRA_JS_MODULES.sessionstore = [ - "ContentRestore.jsm", - "ContentSessionStore.jsm", - "GlobalState.jsm", - "RecentlyClosedTabsAndWindowsMenuUtils.jsm", - "RunState.jsm", - "SessionCookies.jsm", - "SessionFile.jsm", - "SessionMigration.jsm", - "SessionSaver.jsm", - "SessionStartup.jsm", - "SessionStore.jsm", - "SessionWorker.js", - "SessionWorker.jsm", - "StartupPerformance.jsm", - "TabAttributes.jsm", - "TabState.jsm", - "TabStateCache.jsm", - "TabStateFlusher.jsm", + 'ContentRestore.jsm', + 'ContentSessionStore.jsm', + 'GlobalState.jsm', + 'RecentlyClosedTabsAndWindowsMenuUtils.jsm', + 'RunState.jsm', + 'SessionCookies.jsm', + 'SessionFile.jsm', + 'SessionMigration.jsm', + 'SessionSaver.jsm', + 'SessionStartup.jsm', + 'SessionStore.jsm', + 'SessionWorker.js', + 'SessionWorker.jsm', + 'StartupPerformance.jsm', + 'TabAttributes.jsm', + 'TabState.jsm', + 'TabStateCache.jsm', + 'TabStateFlusher.jsm', ] -with Files("**"): - BUG_COMPONENT = ("Firefox", "Session Restore") +with Files('**'): + BUG_COMPONENT = ('Firefox', 'Session Restore') diff --git a/browser/components/shell/moz.build b/browser/components/shell/moz.build index eec5f0a879c4..fb4dea0b4277 100644 --- a/browser/components/shell/moz.build +++ b/browser/components/shell/moz.build @@ -5,75 +5,77 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. # For BinaryPath::GetLong for Windows -LOCAL_INCLUDES += ["/xpcom/build"] +LOCAL_INCLUDES += [ + '/xpcom/build' +] -BROWSER_CHROME_MANIFESTS += ["test/browser.ini"] -MOCHITEST_CHROME_MANIFESTS += ["test/chrome.ini"] -XPCSHELL_TESTS_MANIFESTS += ["test/unit/xpcshell.ini"] +BROWSER_CHROME_MANIFESTS += ['test/browser.ini'] +MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini'] +XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini'] -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] XPIDL_SOURCES += [ - "nsIShellService.idl", + 'nsIShellService.idl', ] -if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa": +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': XPIDL_SOURCES += [ - "nsIMacShellService.idl", + 'nsIMacShellService.idl', ] SOURCES += [ - "nsMacShellService.cpp", + 'nsMacShellService.cpp', ] LOCAL_INCLUDES += [ # For CocoaFileUtils - "/xpcom/io" + '/xpcom/io' ] -elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": +elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk': XPIDL_SOURCES += [ - "nsIGNOMEShellService.idl", + 'nsIGNOMEShellService.idl', ] SOURCES += [ - "nsGNOMEShellService.cpp", + 'nsGNOMEShellService.cpp', ] - if CONFIG["MOZ_ENABLE_DBUS"]: + if CONFIG['MOZ_ENABLE_DBUS']: SOURCES += [ - "nsGNOMEShellDBusHelper.cpp", - "nsGNOMEShellSearchProvider.cpp", + 'nsGNOMEShellDBusHelper.cpp', + 'nsGNOMEShellSearchProvider.cpp', ] - include("/ipc/chromium/chromium-config.mozbuild") + include('/ipc/chromium/chromium-config.mozbuild') -elif CONFIG["OS_ARCH"] == "WINNT": +elif CONFIG['OS_ARCH'] == 'WINNT': XPIDL_SOURCES += [ - "nsIWindowsShellService.idl", + 'nsIWindowsShellService.idl', ] SOURCES += [ - "nsWindowsShellService.cpp", - "WindowsDefaultBrowser.cpp", + 'nsWindowsShellService.cpp', + 'WindowsDefaultBrowser.cpp', ] LOCAL_INCLUDES += [ - "../../../other-licenses/nsis/Contrib/CityHash/cityhash", + '../../../other-licenses/nsis/Contrib/CityHash/cityhash', ] -XPIDL_MODULE = "shellservice" +XPIDL_MODULE = 'shellservice' if SOURCES: - FINAL_LIBRARY = "browsercomps" + FINAL_LIBRARY = 'browsercomps' EXTRA_JS_MODULES += [ - "HeadlessShell.jsm", - "ScreenshotChild.jsm", - "ShellService.jsm", + 'HeadlessShell.jsm', + 'ScreenshotChild.jsm', + 'ShellService.jsm', ] -for var in ("MOZ_APP_NAME", "MOZ_APP_VERSION"): +for var in ('MOZ_APP_NAME', 'MOZ_APP_VERSION'): DEFINES[var] = '"%s"' % CONFIG[var] -CXXFLAGS += CONFIG["TK_CFLAGS"] -if CONFIG["MOZ_ENABLE_DBUS"]: - CXXFLAGS += CONFIG["MOZ_DBUS_GLIB_CFLAGS"] +CXXFLAGS += CONFIG['TK_CFLAGS'] +if CONFIG['MOZ_ENABLE_DBUS']: + CXXFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS'] -with Files("**"): - BUG_COMPONENT = ("Firefox", "Shell Integration") +with Files('**'): + BUG_COMPONENT = ('Firefox', 'Shell Integration') diff --git a/browser/components/shell/test/mac_desktop_image.py b/browser/components/shell/test/mac_desktop_image.py index ca7bc0b29726..0d3c9cb15957 100755 --- a/browser/components/shell/test/mac_desktop_image.py +++ b/browser/components/shell/test/mac_desktop_image.py @@ -34,40 +34,24 @@ import sys def main(): - parser = argparse.ArgumentParser( - description="Utility to print, set, or " - + "check the path to image being used as " - + "the desktop background image. By " - + "default, prints the path to the " - + "current desktop background image." - ) - parser.add_argument( - "-v", - "--verbose", - action="store_true", - help="print verbose debugging information", - default=False, - ) + parser = argparse.ArgumentParser(description="Utility to print, set, or " + + "check the path to image being used as " + + "the desktop background image. By " + + "default, prints the path to the " + + "current desktop background image.") + parser.add_argument("-v", "--verbose", action="store_true", + help="print verbose debugging information", + default=False) group = parser.add_mutually_exclusive_group() - group.add_argument( - "-s", - "--set-background-image", - dest="newBackgroundImagePath", - required=False, - help="path to the new background image to set. A zero " - + "exit code indicates no errors occurred.", - default=None, - ) - group.add_argument( - "-c", - "--check-background-image", - dest="checkBackgroundImagePath", - required=False, - help="check if the provided background image path " - + "matches the provided path. A zero exit code " - + "indicates the paths match.", - default=None, - ) + group.add_argument("-s", "--set-background-image", + dest='newBackgroundImagePath', required=False, + help="path to the new background image to set. A zero " + + "exit code indicates no errors occurred.", default=None) + group.add_argument("-c", "--check-background-image", + dest='checkBackgroundImagePath', required=False, + help="check if the provided background image path " + + "matches the provided path. A zero exit code " + + "indicates the paths match.", default=None) args = parser.parse_args() # Using logging for verbose output @@ -75,14 +59,12 @@ def main(): logging.basicConfig(level=logging.DEBUG) else: logging.basicConfig(level=logging.CRITICAL) - logger = logging.getLogger("desktopImage") + logger = logging.getLogger('desktopImage') # Print what we're going to do if args.checkBackgroundImagePath is not None: - logger.debug( - "checking provided desktop image %s matches current " - "image" % args.checkBackgroundImagePath - ) + logger.debug("checking provided desktop image %s matches current " + "image" % args.checkBackgroundImagePath) elif args.newBackgroundImagePath is not None: logger.debug("setting image to %s " % args.newBackgroundImagePath) else: @@ -139,8 +121,7 @@ def main(): status = False (status, error) = ws.setDesktopImageURL_forScreen_options_error_( - newImageURL, focussedScreen, None, None - ) + newImageURL, focussedScreen, None, None) if not status: raise RuntimeError("setDesktopImageURL error") @@ -164,7 +145,7 @@ def getCurrentDesktopImageURL(focussedScreen, workspace, logger): return imageURL -if __name__ == "__main__": +if __name__ == '__main__': if not main(): sys.exit(1) else: diff --git a/browser/components/ssb/moz.build b/browser/components/ssb/moz.build index d686475dcb43..b799f00f053c 100644 --- a/browser/components/ssb/moz.build +++ b/browser/components/ssb/moz.build @@ -4,28 +4,28 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -JAR_MANIFESTS += ["content/jar.mn"] -BROWSER_CHROME_MANIFESTS += ["tests/browser/browser.ini"] -XPCSHELL_TESTS_MANIFESTS += ["tests/xpcshell/xpcshell.ini"] +JAR_MANIFESTS += ['content/jar.mn'] +BROWSER_CHROME_MANIFESTS += ['tests/browser/browser.ini'] +XPCSHELL_TESTS_MANIFESTS += ['tests/xpcshell/xpcshell.ini'] XPCOM_MANIFESTS += [ - "components.conf", + 'components.conf', ] EXTRA_JS_MODULES += [ - "SiteSpecificBrowserService.jsm", + 'SiteSpecificBrowserService.jsm', ] EXTRA_JS_MODULES.ssb += [ - "ImageTools.jsm", + 'ImageTools.jsm', ] FINAL_TARGET_FILES.actors += [ - "SiteSpecificBrowserChild.jsm", - "SiteSpecificBrowserParent.jsm", + 'SiteSpecificBrowserChild.jsm', + 'SiteSpecificBrowserParent.jsm', ] -if CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows": +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': EXTRA_JS_MODULES.ssb += [ - "WindowsSupport.jsm", + 'WindowsSupport.jsm', ] diff --git a/browser/components/syncedtabs/moz.build b/browser/components/syncedtabs/moz.build index 710477a6458a..cdee0c283a81 100644 --- a/browser/components/syncedtabs/moz.build +++ b/browser/components/syncedtabs/moz.build @@ -2,22 +2,23 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] -BROWSER_CHROME_MANIFESTS += ["test/browser/browser.ini"] +BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini'] -XPCSHELL_TESTS_MANIFESTS += ["test/xpcshell/xpcshell.ini"] +XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell/xpcshell.ini'] EXTRA_JS_MODULES.syncedtabs += [ - "EventEmitter.jsm", - "SyncedTabsDeckComponent.js", - "SyncedTabsDeckStore.js", - "SyncedTabsDeckView.js", - "SyncedTabsListStore.js", - "TabListComponent.js", - "TabListView.js", - "util.js", + 'EventEmitter.jsm', + 'SyncedTabsDeckComponent.js', + 'SyncedTabsDeckStore.js', + 'SyncedTabsDeckView.js', + 'SyncedTabsListStore.js', + 'TabListComponent.js', + 'TabListView.js', + 'util.js', ] -with Files("**"): - BUG_COMPONENT = ("Firefox", "Sync") +with Files('**'): + BUG_COMPONENT = ('Firefox', 'Sync') + diff --git a/browser/components/touchbar/moz.build b/browser/components/touchbar/moz.build index 25b669b03385..f9099cfad168 100644 --- a/browser/components/touchbar/moz.build +++ b/browser/components/touchbar/moz.build @@ -2,14 +2,14 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -with Files("**"): - BUG_COMPONENT = ("Core", "Widget: Cocoa") +with Files('**'): + BUG_COMPONENT = ('Core', 'Widget: Cocoa') -BROWSER_CHROME_MANIFESTS += ["tests/browser/browser.ini"] +BROWSER_CHROME_MANIFESTS += ['tests/browser/browser.ini'] EXTRA_COMPONENTS += [ - "MacTouchBar.js", - "MacTouchBar.manifest", + 'MacTouchBar.js', + 'MacTouchBar.manifest', ] -SPHINX_TREES["/browser/touchbar"] = "docs" +SPHINX_TREES['/browser/touchbar'] = 'docs' diff --git a/browser/components/translation/content/moz.build b/browser/components/translation/content/moz.build index d988c0ff9b16..eb4454d28f88 100644 --- a/browser/components/translation/content/moz.build +++ b/browser/components/translation/content/moz.build @@ -4,4 +4,4 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] \ No newline at end of file diff --git a/browser/components/translation/moz.build b/browser/components/translation/moz.build index 99217d9e828f..5d4c61eb15c9 100644 --- a/browser/components/translation/moz.build +++ b/browser/components/translation/moz.build @@ -3,24 +3,28 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. DIRS += [ - "content", + 'content', ] with Files("**"): BUG_COMPONENT = ("Firefox", "Translation") EXTRA_JS_MODULES.translation = [ - "BingTranslator.jsm", - "cld2/cld-worker.js", - "cld2/cld-worker.js.mem", - "GoogleTranslator.jsm", - "LanguageDetector.jsm", - "TranslationChild.jsm", - "TranslationDocument.jsm", - "TranslationParent.jsm", - "YandexTranslator.jsm", + 'BingTranslator.jsm', + 'cld2/cld-worker.js', + 'cld2/cld-worker.js.mem', + 'GoogleTranslator.jsm', + 'LanguageDetector.jsm', + 'TranslationChild.jsm', + 'TranslationDocument.jsm', + 'TranslationParent.jsm', + 'YandexTranslator.jsm' ] -BROWSER_CHROME_MANIFESTS += ["test/browser.ini"] +BROWSER_CHROME_MANIFESTS += [ + 'test/browser.ini' +] -XPCSHELL_TESTS_MANIFESTS += ["test/unit/xpcshell.ini"] +XPCSHELL_TESTS_MANIFESTS += [ + 'test/unit/xpcshell.ini' +] diff --git a/browser/components/uitour/moz.build b/browser/components/uitour/moz.build index e98ce45ae8b3..5a2b3e8aeb43 100644 --- a/browser/components/uitour/moz.build +++ b/browser/components/uitour/moz.build @@ -2,13 +2,17 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -EXTRA_JS_MODULES += ["UITour.jsm", "UITourChild.jsm", "UITourParent.jsm"] +EXTRA_JS_MODULES += [ + 'UITour.jsm', + 'UITourChild.jsm', + 'UITourParent.jsm' +] BROWSER_CHROME_MANIFESTS += [ - "test/browser.ini", + 'test/browser.ini', ] -SPHINX_TREES["docs"] = "docs" +SPHINX_TREES['docs'] = 'docs' -with Files("**"): - BUG_COMPONENT = ("Firefox", "Tours") +with Files('**'): + BUG_COMPONENT = ('Firefox', 'Tours') diff --git a/browser/components/urlbar/moz.build b/browser/components/urlbar/moz.build index cdade1db67fc..8da3bc9e5f5a 100644 --- a/browser/components/urlbar/moz.build +++ b/browser/components/urlbar/moz.build @@ -6,42 +6,42 @@ with Files("**"): BUG_COMPONENT = ("Firefox", "Address Bar") EXTRA_JS_MODULES += [ - "UrlbarController.jsm", - "UrlbarEventBufferer.jsm", - "UrlbarInput.jsm", - "UrlbarMuxerUnifiedComplete.jsm", - "UrlbarPrefs.jsm", - "UrlbarProviderAutofill.jsm", - "UrlbarProviderExtension.jsm", - "UrlbarProviderHeuristicFallback.jsm", - "UrlbarProviderInterventions.jsm", - "UrlbarProviderOmnibox.jsm", - "UrlbarProviderOpenTabs.jsm", - "UrlbarProviderPrivateSearch.jsm", - "UrlbarProviderSearchSuggestions.jsm", - "UrlbarProviderSearchTips.jsm", - "UrlbarProvidersManager.jsm", - "UrlbarProviderTabToSearch.jsm", - "UrlbarProviderTokenAliasEngines.jsm", - "UrlbarProviderTopSites.jsm", - "UrlbarProviderUnifiedComplete.jsm", - "UrlbarResult.jsm", - "UrlbarSearchOneOffs.jsm", - "UrlbarSearchUtils.jsm", - "UrlbarTokenizer.jsm", - "UrlbarUtils.jsm", - "UrlbarValueFormatter.jsm", - "UrlbarView.jsm", + 'UrlbarController.jsm', + 'UrlbarEventBufferer.jsm', + 'UrlbarInput.jsm', + 'UrlbarMuxerUnifiedComplete.jsm', + 'UrlbarPrefs.jsm', + 'UrlbarProviderAutofill.jsm', + 'UrlbarProviderExtension.jsm', + 'UrlbarProviderHeuristicFallback.jsm', + 'UrlbarProviderInterventions.jsm', + 'UrlbarProviderOmnibox.jsm', + 'UrlbarProviderOpenTabs.jsm', + 'UrlbarProviderPrivateSearch.jsm', + 'UrlbarProviderSearchSuggestions.jsm', + 'UrlbarProviderSearchTips.jsm', + 'UrlbarProvidersManager.jsm', + 'UrlbarProviderTabToSearch.jsm', + 'UrlbarProviderTokenAliasEngines.jsm', + 'UrlbarProviderTopSites.jsm', + 'UrlbarProviderUnifiedComplete.jsm', + 'UrlbarResult.jsm', + 'UrlbarSearchOneOffs.jsm', + 'UrlbarSearchUtils.jsm', + 'UrlbarTokenizer.jsm', + 'UrlbarUtils.jsm', + 'UrlbarValueFormatter.jsm', + 'UrlbarView.jsm', ] TESTING_JS_MODULES += [ - "tests/UrlbarTestUtils.jsm", + 'tests/UrlbarTestUtils.jsm', ] BROWSER_CHROME_MANIFESTS += [ - "tests/browser-tips/browser.ini", - "tests/browser/browser.ini", - "tests/ext/browser/browser.ini", + 'tests/browser-tips/browser.ini', + 'tests/browser/browser.ini', + 'tests/ext/browser/browser.ini', ] -XPCSHELL_TESTS_MANIFESTS += ["tests/unit/xpcshell.ini"] +XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini'] -SPHINX_TREES["/browser/urlbar"] = "docs" +SPHINX_TREES['/browser/urlbar'] = 'docs' diff --git a/browser/extensions/doh-rollout/moz.build b/browser/extensions/doh-rollout/moz.build index bce8283117de..b3a78fc1be5a 100644 --- a/browser/extensions/doh-rollout/moz.build +++ b/browser/extensions/doh-rollout/moz.build @@ -4,11 +4,13 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DEFINES["MOZ_APP_VERSION"] = CONFIG["MOZ_APP_VERSION"] -DEFINES["MOZ_APP_MAXVERSION"] = CONFIG["MOZ_APP_MAXVERSION"] +DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION'] +DEFINES['MOZ_APP_MAXVERSION'] = CONFIG['MOZ_APP_MAXVERSION'] -FINAL_TARGET_FILES.features["doh-rollout@mozilla.org"] += ["manifest.json"] +FINAL_TARGET_FILES.features['doh-rollout@mozilla.org'] += [ + 'manifest.json' +] -with Files("**"): - BUG_COMPONENT = ("Firefox", "Security") +with Files('**'): + BUG_COMPONENT = ('Firefox', 'Security') diff --git a/browser/extensions/formautofill/locales/moz.build b/browser/extensions/formautofill/locales/moz.build index d988c0ff9b16..aac3a838c4c2 100644 --- a/browser/extensions/formautofill/locales/moz.build +++ b/browser/extensions/formautofill/locales/moz.build @@ -4,4 +4,4 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] diff --git a/browser/extensions/formautofill/moz.build b/browser/extensions/formautofill/moz.build index ef46740c3c93..46e92f430988 100644 --- a/browser/extensions/formautofill/moz.build +++ b/browser/extensions/formautofill/moz.build @@ -4,50 +4,50 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DEFINES["MOZ_APP_VERSION"] = CONFIG["MOZ_APP_VERSION"] -DEFINES["MOZ_APP_MAXVERSION"] = CONFIG["MOZ_APP_MAXVERSION"] +DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION'] +DEFINES['MOZ_APP_MAXVERSION'] = CONFIG['MOZ_APP_MAXVERSION'] -DIRS += ["locales"] +DIRS += ['locales'] -FINAL_TARGET_FILES.features["formautofill@mozilla.org"] += [ - "api.js", - "background.js", - "manifest.json", - "schema.json", +FINAL_TARGET_FILES.features['formautofill@mozilla.org'] += [ + 'api.js', + 'background.js', + 'manifest.json', + 'schema.json', ] -if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": - FINAL_TARGET_FILES.features["formautofill@mozilla.org"].chrome.content.skin += [ - "skin/linux/autocomplete-item.css", - "skin/linux/editDialog.css", +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk': + FINAL_TARGET_FILES.features['formautofill@mozilla.org'].chrome.content.skin += [ + 'skin/linux/autocomplete-item.css', + 'skin/linux/editDialog.css', ] -elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa": - FINAL_TARGET_FILES.features["formautofill@mozilla.org"].chrome.content.skin += [ - "skin/osx/autocomplete-item.css", - "skin/osx/editDialog.css", +elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': + FINAL_TARGET_FILES.features['formautofill@mozilla.org'].chrome.content.skin += [ + 'skin/osx/autocomplete-item.css', + 'skin/osx/editDialog.css', ] -elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows": - FINAL_TARGET_FILES.features["formautofill@mozilla.org"].chrome.content.skin += [ - "skin/windows/autocomplete-item.css", - "skin/windows/editDialog.css", +elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': + FINAL_TARGET_FILES.features['formautofill@mozilla.org'].chrome.content.skin += [ + 'skin/windows/autocomplete-item.css', + 'skin/windows/editDialog.css', ] BROWSER_CHROME_MANIFESTS += [ - "test/browser/browser.ini", - "test/browser/creditCard/browser.ini", - "test/browser/focus-leak/browser.ini", + 'test/browser/browser.ini', + 'test/browser/creditCard/browser.ini', + 'test/browser/focus-leak/browser.ini', ] -XPCSHELL_TESTS_MANIFESTS += ["test/unit/xpcshell.ini"] +XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini'] MOCHITEST_MANIFESTS += [ - "test/mochitest/creditCard/mochitest.ini", - "test/mochitest/mochitest.ini", + 'test/mochitest/creditCard/mochitest.ini', + 'test/mochitest/mochitest.ini', ] -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] -SPHINX_TREES["docs"] = "docs" +SPHINX_TREES['docs'] = 'docs' -with Files("**"): - BUG_COMPONENT = ("Toolkit", "Form Autofill") +with Files('**'): + BUG_COMPONENT = ('Toolkit', 'Form Autofill') diff --git a/browser/extensions/moz.build b/browser/extensions/moz.build index 0eb3c53e76c2..f71ece63c42d 100644 --- a/browser/extensions/moz.build +++ b/browser/extensions/moz.build @@ -4,4 +4,10 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DIRS += ["doh-rollout", "formautofill", "screenshots", "webcompat", "report-site-issue"] +DIRS += [ + 'doh-rollout', + 'formautofill', + 'screenshots', + 'webcompat', + 'report-site-issue' +] diff --git a/browser/extensions/report-site-issue/locales/moz.build b/browser/extensions/report-site-issue/locales/moz.build index d988c0ff9b16..eb4454d28f88 100644 --- a/browser/extensions/report-site-issue/locales/moz.build +++ b/browser/extensions/report-site-issue/locales/moz.build @@ -4,4 +4,4 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] \ No newline at end of file diff --git a/browser/extensions/report-site-issue/moz.build b/browser/extensions/report-site-issue/moz.build index e3e92a33198f..466c38f723bd 100644 --- a/browser/extensions/report-site-issue/moz.build +++ b/browser/extensions/report-site-issue/moz.build @@ -4,38 +4,38 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DEFINES["MOZ_APP_VERSION"] = CONFIG["MOZ_APP_VERSION"] -DEFINES["MOZ_APP_MAXVERSION"] = CONFIG["MOZ_APP_MAXVERSION"] +DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION'] +DEFINES['MOZ_APP_MAXVERSION'] = CONFIG['MOZ_APP_MAXVERSION'] -DIRS += ["locales"] +DIRS += ['locales'] -FINAL_TARGET_FILES.features["webcompat-reporter@mozilla.org"] += [ - "background.js", - "manifest.json", +FINAL_TARGET_FILES.features['webcompat-reporter@mozilla.org'] += [ + 'background.js', + 'manifest.json' ] -FINAL_TARGET_FILES.features["webcompat-reporter@mozilla.org"].experimentalAPIs += [ - "experimentalAPIs/aboutConfigPrefs.js", - "experimentalAPIs/aboutConfigPrefs.json", - "experimentalAPIs/browserInfo.js", - "experimentalAPIs/browserInfo.json", - "experimentalAPIs/l10n.js", - "experimentalAPIs/l10n.json", - "experimentalAPIs/pageActionExtras.js", - "experimentalAPIs/pageActionExtras.json", - "experimentalAPIs/tabExtras.js", - "experimentalAPIs/tabExtras.json", +FINAL_TARGET_FILES.features['webcompat-reporter@mozilla.org'].experimentalAPIs += [ + 'experimentalAPIs/aboutConfigPrefs.js', + 'experimentalAPIs/aboutConfigPrefs.json', + 'experimentalAPIs/browserInfo.js', + 'experimentalAPIs/browserInfo.json', + 'experimentalAPIs/l10n.js', + 'experimentalAPIs/l10n.json', + 'experimentalAPIs/pageActionExtras.js', + 'experimentalAPIs/pageActionExtras.json', + 'experimentalAPIs/tabExtras.js', + 'experimentalAPIs/tabExtras.json' ] -FINAL_TARGET_FILES.features[ - "webcompat-reporter@mozilla.org" -].experimentalAPIs.actors += ["experimentalAPIs/actors/tabExtrasActor.jsm"] +FINAL_TARGET_FILES.features['webcompat-reporter@mozilla.org'].experimentalAPIs.actors += [ + 'experimentalAPIs/actors/tabExtrasActor.jsm' +] -FINAL_TARGET_FILES.features["webcompat-reporter@mozilla.org"].icons += [ - "icons/lightbulb.svg" +FINAL_TARGET_FILES.features['webcompat-reporter@mozilla.org'].icons += [ + 'icons/lightbulb.svg' ] -BROWSER_CHROME_MANIFESTS += ["test/browser/browser.ini"] +BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini'] -with Files("**"): - BUG_COMPONENT = ("Web Compatibility", "Tooling & Investigations") +with Files('**'): + BUG_COMPONENT = ('Web Compatibility', 'Tooling & Investigations') diff --git a/browser/extensions/screenshots/moz.build b/browser/extensions/screenshots/moz.build index 3a1b16135728..10f01f690c4d 100644 --- a/browser/extensions/screenshots/moz.build +++ b/browser/extensions/screenshots/moz.build @@ -9,73 +9,76 @@ with Files("**"): # This file list is automatically generated by Screenshots' export scripts. # AUTOMATIC INSERTION START -FINAL_TARGET_FILES.features["screenshots@mozilla.org"] += [ - "assertIsBlankDocument.js", - "assertIsTrusted.js", - "blank.html", - "blobConverters.js", - "catcher.js", - "clipboard.js", - "domainFromUrl.js", - "log.js", - "makeUuid.js", - "manifest.json", - "moz.build", - "randomString.js", - "sitehelper.js", +FINAL_TARGET_FILES.features['screenshots@mozilla.org'] += [ + 'assertIsBlankDocument.js', + 'assertIsTrusted.js', + 'blank.html', + 'blobConverters.js', + 'catcher.js', + 'clipboard.js', + 'domainFromUrl.js', + 'log.js', + 'makeUuid.js', + 'manifest.json', + 'moz.build', + 'randomString.js', + 'sitehelper.js' ] -FINAL_TARGET_FILES.features["screenshots@mozilla.org"]["background"] += [ - "background/analytics.js", - "background/auth.js", - "background/communication.js", - "background/deviceInfo.js", - "background/main.js", - "background/selectorLoader.js", - "background/senderror.js", - "background/startBackground.js", - "background/takeshot.js", +FINAL_TARGET_FILES.features['screenshots@mozilla.org']["background"] += [ + 'background/analytics.js', + 'background/auth.js', + 'background/communication.js', + 'background/deviceInfo.js', + 'background/main.js', + 'background/selectorLoader.js', + 'background/senderror.js', + 'background/startBackground.js', + 'background/takeshot.js' ] -FINAL_TARGET_FILES.features["screenshots@mozilla.org"]["build"] += [ - "build/buildSettings.js", - "build/inlineSelectionCss.js", - "build/raven.js", - "build/selection.js", - "build/shot.js", - "build/thumbnailGenerator.js", +FINAL_TARGET_FILES.features['screenshots@mozilla.org']["build"] += [ + 'build/buildSettings.js', + 'build/inlineSelectionCss.js', + 'build/raven.js', + 'build/selection.js', + 'build/shot.js', + 'build/thumbnailGenerator.js' ] -FINAL_TARGET_FILES.features["screenshots@mozilla.org"]["experiments"][ - "screenshots" -] += ["experiments/screenshots/api.js", "experiments/screenshots/schema.json"] +FINAL_TARGET_FILES.features['screenshots@mozilla.org']["experiments"]["screenshots"] += [ + 'experiments/screenshots/api.js', + 'experiments/screenshots/schema.json' +] -FINAL_TARGET_FILES.features["screenshots@mozilla.org"]["icons"] += [ - "icons/cancel.svg", - "icons/cloud.svg", - "icons/copied-notification.svg", - "icons/copy.svg", - "icons/download-white.svg", - "icons/download.svg", - "icons/help-16.svg", - "icons/icon-highlight-32-v2.svg", - "icons/icon-v2.svg", - "icons/icon-welcome-face-without-eyes.svg", - "icons/menu-fullpage.svg", - "icons/menu-myshot-white.svg", - "icons/menu-myshot.svg", - "icons/menu-visible.svg", +FINAL_TARGET_FILES.features['screenshots@mozilla.org']["icons"] += [ + 'icons/cancel.svg', + 'icons/cloud.svg', + 'icons/copied-notification.svg', + 'icons/copy.svg', + 'icons/download-white.svg', + 'icons/download.svg', + 'icons/help-16.svg', + 'icons/icon-highlight-32-v2.svg', + 'icons/icon-v2.svg', + 'icons/icon-welcome-face-without-eyes.svg', + 'icons/menu-fullpage.svg', + 'icons/menu-myshot-white.svg', + 'icons/menu-myshot.svg', + 'icons/menu-visible.svg', ] -FINAL_TARGET_FILES.features["screenshots@mozilla.org"]["selector"] += [ - "selector/callBackground.js", - "selector/documentMetadata.js", - "selector/shooter.js", - "selector/ui.js", - "selector/uicontrol.js", - "selector/util.js", +FINAL_TARGET_FILES.features['screenshots@mozilla.org']["selector"] += [ + 'selector/callBackground.js', + 'selector/documentMetadata.js', + 'selector/shooter.js', + 'selector/ui.js', + 'selector/uicontrol.js', + 'selector/util.js' ] # AUTOMATIC INSERTION END -BROWSER_CHROME_MANIFESTS += ["test/browser/browser.ini"] +BROWSER_CHROME_MANIFESTS += [ + 'test/browser/browser.ini' +] diff --git a/browser/extensions/webcompat/moz.build b/browser/extensions/webcompat/moz.build index 87320a05c25b..fccc7aac1bb3 100644 --- a/browser/extensions/webcompat/moz.build +++ b/browser/extensions/webcompat/moz.build @@ -4,120 +4,120 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DEFINES["MOZ_APP_VERSION"] = CONFIG["MOZ_APP_VERSION"] -DEFINES["MOZ_APP_MAXVERSION"] = CONFIG["MOZ_APP_MAXVERSION"] +DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION'] +DEFINES['MOZ_APP_MAXVERSION'] = CONFIG['MOZ_APP_MAXVERSION'] -FINAL_TARGET_FILES.features["webcompat@mozilla.org"] += [ - "manifest.json", - "run.js", +FINAL_TARGET_FILES.features['webcompat@mozilla.org'] += [ + 'manifest.json', + 'run.js', ] -FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["about-compat"] += [ - "about-compat/aboutCompat.css", - "about-compat/aboutCompat.html", - "about-compat/aboutCompat.js", - "about-compat/AboutCompat.jsm", - "about-compat/aboutPage.js", - "about-compat/aboutPage.json", - "about-compat/aboutPageProcessScript.js", +FINAL_TARGET_FILES.features['webcompat@mozilla.org']['about-compat'] += [ + 'about-compat/aboutCompat.css', + 'about-compat/aboutCompat.html', + 'about-compat/aboutCompat.js', + 'about-compat/AboutCompat.jsm', + 'about-compat/aboutPage.js', + 'about-compat/aboutPage.json', + 'about-compat/aboutPageProcessScript.js', ] -FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["data"] += [ - "data/injections.js", - "data/picture_in_picture_overrides.js", - "data/shims.js", - "data/ua_overrides.js", +FINAL_TARGET_FILES.features['webcompat@mozilla.org']['data'] += [ + 'data/injections.js', + 'data/picture_in_picture_overrides.js', + 'data/shims.js', + 'data/ua_overrides.js', ] -FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["experiment-apis"] += [ - "experiment-apis/aboutConfigPrefs.js", - "experiment-apis/aboutConfigPrefs.json", - "experiment-apis/appConstants.js", - "experiment-apis/appConstants.json", - "experiment-apis/experiments.js", - "experiment-apis/experiments.json", - "experiment-apis/matchPatterns.js", - "experiment-apis/matchPatterns.json", - "experiment-apis/pictureInPicture.js", - "experiment-apis/pictureInPicture.json", - "experiment-apis/sharedPreferences.js", - "experiment-apis/sharedPreferences.json", - "experiment-apis/systemManufacturer.js", - "experiment-apis/systemManufacturer.json", - "experiment-apis/trackingProtection.js", - "experiment-apis/trackingProtection.json", +FINAL_TARGET_FILES.features['webcompat@mozilla.org']['experiment-apis'] += [ + 'experiment-apis/aboutConfigPrefs.js', + 'experiment-apis/aboutConfigPrefs.json', + 'experiment-apis/appConstants.js', + 'experiment-apis/appConstants.json', + 'experiment-apis/experiments.js', + 'experiment-apis/experiments.json', + 'experiment-apis/matchPatterns.js', + 'experiment-apis/matchPatterns.json', + 'experiment-apis/pictureInPicture.js', + 'experiment-apis/pictureInPicture.json', + 'experiment-apis/sharedPreferences.js', + 'experiment-apis/sharedPreferences.json', + 'experiment-apis/systemManufacturer.js', + 'experiment-apis/systemManufacturer.json', + 'experiment-apis/trackingProtection.js', + 'experiment-apis/trackingProtection.json', ] -FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["injections"]["css"] += [ - "injections/css/bug0000000-testbed-css-injection.css", - "injections/css/bug1561371-mail.google.com-allow-horizontal-scrolling.css", - "injections/css/bug1570119-teamcoco.com-scrollbar-width.css", - "injections/css/bug1570328-developer-apple.com-transform-scale.css", - "injections/css/bug1575000-apply.lloydsbank.co.uk-radio-buttons-fix.css", - "injections/css/bug1577297-kitkat.com.au-slider-width-fix.css", - "injections/css/bug1605611-maps.google.com-directions-time.css", - "injections/css/bug1610016-gaana.com-input-position-fix.css", - "injections/css/bug1610344-directv.com.co-hide-unsupported-message.css", - "injections/css/bug1632019-everyman.co-gallery-width-fix.css", - "injections/css/bug1644830-missingmail.usps.com-checkboxes-not-visible.css", - "injections/css/bug1645064-s-kanava.fi-invisible-charts.css", - "injections/css/bug1651917-teletrader.com.body-transform-origin.css", - "injections/css/bug1653075-livescience.com-scrollbar-width.css", - "injections/css/bug1654865-sports.ndtv.com-float-fix.css", - "injections/css/bug1654877-preev.com-moz-appearance-fix.css", - "injections/css/bug1654907-reactine.ca-hide-unsupported.css", - "injections/css/bug1655049-dev.to-unclickable-button-fix.css", - "injections/css/bug1666771-zilow-map-overdraw.css", +FINAL_TARGET_FILES.features['webcompat@mozilla.org']['injections']['css'] += [ + 'injections/css/bug0000000-testbed-css-injection.css', + 'injections/css/bug1561371-mail.google.com-allow-horizontal-scrolling.css', + 'injections/css/bug1570119-teamcoco.com-scrollbar-width.css', + 'injections/css/bug1570328-developer-apple.com-transform-scale.css', + 'injections/css/bug1575000-apply.lloydsbank.co.uk-radio-buttons-fix.css', + 'injections/css/bug1577297-kitkat.com.au-slider-width-fix.css', + 'injections/css/bug1605611-maps.google.com-directions-time.css', + 'injections/css/bug1610016-gaana.com-input-position-fix.css', + 'injections/css/bug1610344-directv.com.co-hide-unsupported-message.css', + 'injections/css/bug1632019-everyman.co-gallery-width-fix.css', + 'injections/css/bug1644830-missingmail.usps.com-checkboxes-not-visible.css', + 'injections/css/bug1645064-s-kanava.fi-invisible-charts.css', + 'injections/css/bug1651917-teletrader.com.body-transform-origin.css', + 'injections/css/bug1653075-livescience.com-scrollbar-width.css', + 'injections/css/bug1654865-sports.ndtv.com-float-fix.css', + 'injections/css/bug1654877-preev.com-moz-appearance-fix.css', + 'injections/css/bug1654907-reactine.ca-hide-unsupported.css', + 'injections/css/bug1655049-dev.to-unclickable-button-fix.css', + 'injections/css/bug1666771-zilow-map-overdraw.css', ] -FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["injections"]["js"] += [ - "injections/js/bug0000000-testbed-js-injection.js", - "injections/js/bug1452707-window.controllers-shim-ib.absa.co.za.js", - "injections/js/bug1457335-histography.io-ua-change.js", - "injections/js/bug1472075-bankofamerica.com-ua-change.js", - "injections/js/bug1570856-medium.com-menu-isTier1.js", - "injections/js/bug1579159-m.tailieu.vn-pdfjs-worker-disable.js", - "injections/js/bug1605611-maps.google.com-directions-time.js", - "injections/js/bug1610358-pcloud.com-appVersion-change.js", +FINAL_TARGET_FILES.features['webcompat@mozilla.org']['injections']['js'] += [ + 'injections/js/bug0000000-testbed-js-injection.js', + 'injections/js/bug1452707-window.controllers-shim-ib.absa.co.za.js', + 'injections/js/bug1457335-histography.io-ua-change.js', + 'injections/js/bug1472075-bankofamerica.com-ua-change.js', + 'injections/js/bug1570856-medium.com-menu-isTier1.js', + 'injections/js/bug1579159-m.tailieu.vn-pdfjs-worker-disable.js', + 'injections/js/bug1605611-maps.google.com-directions-time.js', + 'injections/js/bug1610358-pcloud.com-appVersion-change.js', ] -FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["shims"] += [ - "shims/adsafeprotected-ima.js", - "shims/bmauth.js", - "shims/eluminate.js", - "shims/empty-script.js", - "shims/facebook-sdk.js", - "shims/google-analytics-ecommerce-plugin.js", - "shims/google-analytics-legacy.js", - "shims/google-analytics-tag-manager.js", - "shims/google-analytics.js", - "shims/google-publisher-tags.js", - "shims/live-test-shim.js", - "shims/mochitest-shim-1.js", - "shims/mochitest-shim-2.js", - "shims/mochitest-shim-3.js", - "shims/rambler-authenticator.js", - "shims/rich-relevance.js", +FINAL_TARGET_FILES.features['webcompat@mozilla.org']['shims'] += [ + 'shims/adsafeprotected-ima.js', + 'shims/bmauth.js', + 'shims/eluminate.js', + 'shims/empty-script.js', + 'shims/facebook-sdk.js', + 'shims/google-analytics-ecommerce-plugin.js', + 'shims/google-analytics-legacy.js', + 'shims/google-analytics-tag-manager.js', + 'shims/google-analytics.js', + 'shims/google-publisher-tags.js', + 'shims/live-test-shim.js', + 'shims/mochitest-shim-1.js', + 'shims/mochitest-shim-2.js', + 'shims/mochitest-shim-3.js', + 'shims/rambler-authenticator.js', + 'shims/rich-relevance.js', ] -FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["lib"] += [ - "lib/about_compat_broker.js", - "lib/custom_functions.js", - "lib/injections.js", - "lib/intervention_helpers.js", - "lib/messaging_helper.js", - "lib/module_shim.js", - "lib/picture_in_picture_overrides.js", - "lib/shim_messaging_helper.js", - "lib/shims.js", - "lib/ua_overrides.js", +FINAL_TARGET_FILES.features['webcompat@mozilla.org']['lib'] += [ + 'lib/about_compat_broker.js', + 'lib/custom_functions.js', + 'lib/injections.js', + 'lib/intervention_helpers.js', + 'lib/messaging_helper.js', + 'lib/module_shim.js', + 'lib/picture_in_picture_overrides.js', + 'lib/shim_messaging_helper.js', + 'lib/shims.js', + 'lib/ua_overrides.js', ] XPCOM_MANIFESTS += [ - "components.conf", + 'components.conf', ] -BROWSER_CHROME_MANIFESTS += ["tests/browser/browser.ini"] +BROWSER_CHROME_MANIFESTS += ['tests/browser/browser.ini'] -with Files("**"): - BUG_COMPONENT = ("Web Compatibility", "Tooling & Investigations") +with Files('**'): + BUG_COMPONENT = ('Web Compatibility', 'Tooling & Investigations') diff --git a/browser/fonts/moz.build b/browser/fonts/moz.build index 7b9cb08f48e6..308dcabacece 100644 --- a/browser/fonts/moz.build +++ b/browser/fonts/moz.build @@ -4,6 +4,8 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -if CONFIG["MOZ_WIDGET_TOOLKIT"] in ("windows", "gtk"): - DIST_SUBDIR = "" - FINAL_TARGET_FILES.fonts += ["TwemojiMozilla.ttf"] +if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk'): + DIST_SUBDIR = '' + FINAL_TARGET_FILES.fonts += [ + 'TwemojiMozilla.ttf' + ] diff --git a/browser/fxr/moz.build b/browser/fxr/moz.build index d988c0ff9b16..aac3a838c4c2 100644 --- a/browser/fxr/moz.build +++ b/browser/fxr/moz.build @@ -4,4 +4,4 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] diff --git a/browser/installer/windows/moz.build b/browser/installer/windows/moz.build index 30d4c23bba09..f0987ef9c3f4 100644 --- a/browser/installer/windows/moz.build +++ b/browser/installer/windows/moz.build @@ -4,13 +4,13 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -DEFINES["APP_VERSION"] = CONFIG["MOZ_APP_VERSION"] +DEFINES['APP_VERSION'] = CONFIG['MOZ_APP_VERSION'] -DEFINES["MOZ_APP_NAME"] = CONFIG["MOZ_APP_NAME"] -DEFINES["MOZ_APP_DISPLAYNAME"] = CONFIG["MOZ_APP_DISPLAYNAME"] -DEFINES["MOZILLA_VERSION"] = CONFIG["MOZILLA_VERSION"] +DEFINES['MOZ_APP_NAME'] = CONFIG['MOZ_APP_NAME'] +DEFINES['MOZ_APP_DISPLAYNAME'] = CONFIG['MOZ_APP_DISPLAYNAME'] +DEFINES['MOZILLA_VERSION'] = CONFIG['MOZILLA_VERSION'] -if CONFIG["MOZ_DEFAULT_BROWSER_AGENT"]: - DEFINES["MOZ_DEFAULT_BROWSER_AGENT"] = CONFIG["MOZ_DEFAULT_BROWSER_AGENT"] +if CONFIG['MOZ_DEFAULT_BROWSER_AGENT']: + DEFINES['MOZ_DEFAULT_BROWSER_AGENT'] = CONFIG['MOZ_DEFAULT_BROWSER_AGENT'] -SPHINX_TREES["installer"] = "docs" +SPHINX_TREES['installer'] = 'docs' diff --git a/browser/locales/filter.py b/browser/locales/filter.py index bb2e992e2e72..1fc9b14e7c87 100644 --- a/browser/locales/filter.py +++ b/browser/locales/filter.py @@ -7,25 +7,17 @@ from __future__ import absolute_import def test(mod, path, entity=None): import re - # ignore anything but Firefox - if mod not in ( - "netwerk", - "dom", - "toolkit", - "security/manager", - "devtools/client", - "devtools/shared", - "devtools/startup", - "browser", - "browser/extensions/formautofill", - "browser/extensions/fxmonitor", - "browser/extensions/report-site-issue", - "extensions/spellcheck", - "other-licenses/branding/firefox", - "browser/branding/official", - "services/sync", - ): + if mod not in ("netwerk", "dom", "toolkit", "security/manager", + "devtools/client", "devtools/shared", "devtools/startup", + "browser", + "browser/extensions/formautofill", + "browser/extensions/fxmonitor", + "browser/extensions/report-site-issue", + "extensions/spellcheck", + "other-licenses/branding/firefox", + "browser/branding/official", + "services/sync"): return "ignore" if mod not in ("browser", "extensions/spellcheck"): # we only have exceptions for browser and extensions/spellcheck @@ -43,13 +35,9 @@ def test(mod, path, entity=None): if mod == "browser" and path == "chrome/browser-region/region.properties": # only region.properties exceptions remain, compare all others - return ( - "ignore" - if ( - re.match(r"browser\.contentHandlers\.types\.[0-5]", entity) - or re.match(r"gecko\.handlerService\.schemes\.", entity) - or re.match(r"gecko\.handlerService\.defaultHandlersVersion", entity) - ) - else "error" - ) + return ("ignore" + if (re.match(r"browser\.contentHandlers\.types\.[0-5]", entity) or + re.match(r"gecko\.handlerService\.schemes\.", entity) or + re.match(r"gecko\.handlerService\.defaultHandlersVersion", entity)) + else "error") return "error" diff --git a/browser/locales/generate_bookmarks.py b/browser/locales/generate_bookmarks.py index 1b2002fcf9ca..583a4dc49883 100644 --- a/browser/locales/generate_bookmarks.py +++ b/browser/locales/generate_bookmarks.py @@ -15,7 +15,7 @@ from mozbuild import preprocessor def main(output, bookmarks_html_in, bookmarks_inc, locale=None): if not locale: - raise ValueError("locale must be specified!") + raise ValueError('locale must be specified!') CONFIG = buildconfig.substs @@ -25,19 +25,19 @@ def main(output, bookmarks_html_in, bookmarks_inc, locale=None): # anything but #define), so it's safe to restrict the set of defines to # what's used in mozilla-central directly. defines = {} - defines["AB_CD"] = locale - if defines["AB_CD"] == "ja-JP-mac": - defines["AB_CD"] = "ja" + defines['AB_CD'] = locale + if defines['AB_CD'] == 'ja-JP-mac': + defines['AB_CD'] = 'ja' - defines["BOOKMARKS_INCLUDE_PATH"] = bookmarks_inc + defines['BOOKMARKS_INCLUDE_PATH'] = bookmarks_inc - for var in ("NIGHTLY_BUILD",): + for var in ('NIGHTLY_BUILD',): if var in CONFIG: defines[var] = CONFIG[var] - includes = preprocessor.preprocess( - includes=[bookmarks_html_in], defines=defines, output=output - ) + includes = preprocessor.preprocess(includes=[bookmarks_html_in], + defines=defines, + output=output) return includes diff --git a/browser/locales/generate_ini.py b/browser/locales/generate_ini.py index 2f2724dd96cb..e7488788e7de 100644 --- a/browser/locales/generate_ini.py +++ b/browser/locales/generate_ini.py @@ -14,16 +14,15 @@ import shutil def main(output, ini, ini_append=None, locale=None): - fixup_re = re.compile("^(Info|Title)Text=") + fixup_re = re.compile('^(Info|Title)Text=') # Input INI is always utf-8. - with codecs.open(ini, "rb", "utf_8") as f: + with codecs.open(ini, 'rb', 'utf_8') as f: for line in f: - line = fixup_re.sub(r"\1=", line) - line = line.replace( - "%MOZ_APP_DISPLAYNAME%", buildconfig.substs["MOZ_APP_DISPLAYNAME"] - ) + line = fixup_re.sub(r'\1=', line) + line = line.replace('%MOZ_APP_DISPLAYNAME%', + buildconfig.substs['MOZ_APP_DISPLAYNAME']) output.write(line) - if ini_append and buildconfig.substs["OS_TARGET"] == "WINNT": + if ini_append and buildconfig.substs['OS_TARGET'] == 'WINNT': # Also append the contents of `ini_append`. - with codecs.open(ini_append, "rb", "utf_8") as f: + with codecs.open(ini_append, 'rb', 'utf_8') as f: shutil.copyfileobj(f, output) diff --git a/browser/locales/moz.build b/browser/locales/moz.build index e1c27c75499d..90ae99d83fa7 100644 --- a/browser/locales/moz.build +++ b/browser/locales/moz.build @@ -4,35 +4,35 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] # If DIST_SUBDIR ever gets unset in browser this path might be wrong due to PREF_DIR changing. -LOCALIZED_PP_FILES.defaults.preferences += ["en-US/firefox-l10n.js"] +LOCALIZED_PP_FILES.defaults.preferences += ['en-US/firefox-l10n.js'] -if CONFIG["MOZ_CRASHREPORTER"]: - LOCALIZED_FILES += ["en-US/crashreporter/crashreporter-override.ini"] +if CONFIG['MOZ_CRASHREPORTER']: + LOCALIZED_FILES += ['en-US/crashreporter/crashreporter-override.ini'] -if CONFIG["MOZ_UPDATER"]: - LOCALIZED_GENERATED_FILES += ["updater.ini"] - updater = LOCALIZED_GENERATED_FILES["updater.ini"] - updater.script = "generate_ini.py" +if CONFIG['MOZ_UPDATER']: + LOCALIZED_GENERATED_FILES += ['updater.ini'] + updater = LOCALIZED_GENERATED_FILES['updater.ini'] + updater.script = 'generate_ini.py' updater.inputs = [ - "en-US/updater/updater.ini", - "../installer/windows/nsis/updater_append.ini", + 'en-US/updater/updater.ini', + '../installer/windows/nsis/updater_append.ini', ] # 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. - LOCALIZED_FILES[".."] += ["!updater.ini"] + LOCALIZED_FILES['..'] += ['!updater.ini'] -LOCALIZED_GENERATED_FILES += ["bookmarks.html"] -bookmarks = LOCALIZED_GENERATED_FILES["bookmarks.html"] -bookmarks.script = "generate_bookmarks.py" +LOCALIZED_GENERATED_FILES += ['bookmarks.html'] +bookmarks = LOCALIZED_GENERATED_FILES['bookmarks.html'] +bookmarks.script = 'generate_bookmarks.py' bookmarks.inputs = [ # This input will not be considered for localization. - "generic/profile/bookmarks.html.in", + 'generic/profile/bookmarks.html.in', # The `locales/en-US/` will be rewritten to the locale-specific path. - "en-US/profile/bookmarks.inc", + 'en-US/profile/bookmarks.inc', ] with Files("**"): diff --git a/browser/modules/moz.build b/browser/modules/moz.build index 932d02fb8338..e60199812cec 100644 --- a/browser/modules/moz.build +++ b/browser/modules/moz.build @@ -43,11 +43,11 @@ with Files("AboutNewTab.jsm"): with Files("AsanReporter.jsm"): BUG_COMPONENT = ("Firefox Build System", "General") -with Files("AsyncTabSwitcher.jsm"): - BUG_COMPONENT = ("Firefox", "Tabbed Browser") +with Files('AsyncTabSwitcher.jsm'): + BUG_COMPONENT = ('Firefox', 'Tabbed Browser') -with Files("NewTabPagePreloading.jsm"): - BUG_COMPONENT = ("Firefox", "Tabbed Browser") +with Files('NewTabPagePreloading.jsm'): + BUG_COMPONENT = ('Firefox', 'Tabbed Browser') with Files("BrowserWindowTracker.jsm"): BUG_COMPONENT = ("Firefox", "General") @@ -77,7 +77,7 @@ with Files("PartnerLinkAttribution.jsm"): BUG_COMPONENT = ("Firefox", "Search") with Files("PermissionUI.jsm"): - BUG_COMPONENT = ("Firefox", "Site Permissions") + BUG_COMPONENT = ("Firefox", "Site Permissions") with Files("ProcessHangMonitor.jsm"): BUG_COMPONENT = ("Core", "DOM: Content Processes") @@ -119,52 +119,52 @@ with Files("ZoomUI.jsm"): BUG_COMPONENT = ("Firefox", "Toolbars and Customization") BROWSER_CHROME_MANIFESTS += [ - "test/browser/browser.ini", - "test/browser/formValidation/browser.ini", + 'test/browser/browser.ini', + 'test/browser/formValidation/browser.ini', ] -XPCSHELL_TESTS_MANIFESTS += ["test/unit/xpcshell.ini"] +XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini'] EXTRA_JS_MODULES += [ - "AboutNewTab.jsm", - "AppUpdater.jsm", - "AsyncTabSwitcher.jsm", - "BrowserUsageTelemetry.jsm", - "BrowserWindowTracker.jsm", - "ContentCrashHandlers.jsm", - "Discovery.jsm", - "EveryWindow.jsm", - "ExtensionsUI.jsm", - "FaviconLoader.jsm", - "HomePage.jsm", - "LaterRun.jsm", - "LiveBookmarkMigrator.jsm", - "NewTabPagePreloading.jsm", - "OpenInTabsUtils.jsm", - "PageActions.jsm", - "PartnerLinkAttribution.jsm", - "PermissionUI.jsm", - "PingCentre.jsm", - "ProcessHangMonitor.jsm", - "Sanitizer.jsm", - "SelectionChangedMenulist.jsm", - "SiteDataManager.jsm", - "SitePermissions.jsm", - "TabsList.jsm", - "TabUnloader.jsm", - "ThemeVariableMap.jsm", - "TransientPrefs.jsm", - "webrtcUI.jsm", - "ZoomUI.jsm", + 'AboutNewTab.jsm', + 'AppUpdater.jsm', + 'AsyncTabSwitcher.jsm', + 'BrowserUsageTelemetry.jsm', + 'BrowserWindowTracker.jsm', + 'ContentCrashHandlers.jsm', + 'Discovery.jsm', + 'EveryWindow.jsm', + 'ExtensionsUI.jsm', + 'FaviconLoader.jsm', + 'HomePage.jsm', + 'LaterRun.jsm', + 'LiveBookmarkMigrator.jsm', + 'NewTabPagePreloading.jsm', + 'OpenInTabsUtils.jsm', + 'PageActions.jsm', + 'PartnerLinkAttribution.jsm', + 'PermissionUI.jsm', + 'PingCentre.jsm', + 'ProcessHangMonitor.jsm', + 'Sanitizer.jsm', + 'SelectionChangedMenulist.jsm', + 'SiteDataManager.jsm', + 'SitePermissions.jsm', + 'TabsList.jsm', + 'TabUnloader.jsm', + 'ThemeVariableMap.jsm', + 'TransientPrefs.jsm', + 'webrtcUI.jsm', + 'ZoomUI.jsm', ] -if CONFIG["MOZ_ASAN_REPORTER"]: +if CONFIG['MOZ_ASAN_REPORTER']: EXTRA_JS_MODULES += [ - "AsanReporter.jsm", + 'AsanReporter.jsm', ] -if CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows": +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': EXTRA_JS_MODULES += [ - "Windows8WindowFrameColor.jsm", - "WindowsJumpLists.jsm", - "WindowsPreviewPerTab.jsm", + 'Windows8WindowFrameColor.jsm', + 'WindowsJumpLists.jsm', + 'WindowsPreviewPerTab.jsm', ] diff --git a/browser/moz.build b/browser/moz.build index ca88ad0a94f7..8cbf30a938ec 100644 --- a/browser/moz.build +++ b/browser/moz.build @@ -4,62 +4,62 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -CONFIGURE_SUBST_FILES += ["installer/Makefile"] +CONFIGURE_SUBST_FILES += ['installer/Makefile'] -SPHINX_TREES["/browser"] = "docs" +SPHINX_TREES['/browser'] = 'docs' EXTRA_COMPONENTS += [ - "l10n-registry.manifest", + 'l10n-registry.manifest', ] DIRS += [ - "actors", - "base", - "components", - "fonts", - "fxr", - "locales", - "modules", - "themes", - "extensions", + 'actors', + 'base', + 'components', + 'fonts', + 'fxr', + 'locales', + 'modules', + 'themes', + 'extensions', ] DIRS += [ - "app", + 'app', ] -if CONFIG["MAKENSISU"]: - DIRS += ["installer/windows"] +if CONFIG['MAKENSISU']: + DIRS += ['installer/windows'] TEST_DIRS += [ - "tools/mozscreenshots", + 'tools/mozscreenshots', ] -DIST_SUBDIR = "browser" -export("DIST_SUBDIR") +DIST_SUBDIR = 'browser' +export('DIST_SUBDIR') # These defines are read in firefox.js -DEFINES["APP_VERSION"] = CONFIG["MOZ_APP_VERSION"] +DEFINES['APP_VERSION'] = CONFIG['MOZ_APP_VERSION'] -for cdm in CONFIG["MOZ_EME_MODULES"]: - DEFINES["MOZ_%s_EME" % cdm.upper()] = True +for cdm in CONFIG['MOZ_EME_MODULES']: + DEFINES['MOZ_%s_EME' % cdm.upper()] = True -if CONFIG["MOZ_GPSD"]: - DEFINES["MOZ_GPSD"] = True +if CONFIG['MOZ_GPSD']: + DEFINES['MOZ_GPSD'] = True # These files are specified in this moz.build to pick up DIST_SUBDIR as set in # this directory, which is un-set in browser/app. JS_PREFERENCE_PP_FILES += [ - "app/profile/firefox.js", + 'app/profile/firefox.js', ] -FINAL_TARGET_FILES.defaults += ["app/permissions"] +FINAL_TARGET_FILES.defaults += ['app/permissions'] with Files("**"): BUG_COMPONENT = ("Firefox", "General") - SCHEDULES.exclusive = ["linux", "macosx", "windows"] + SCHEDULES.exclusive = ['linux', 'macosx', 'windows'] -with Files("docs/**"): - SCHEDULES.exclusive = ["docs"] +with Files('docs/**'): + SCHEDULES.exclusive = ['docs'] with Files("Makefile.in"): BUG_COMPONENT = ("Firefox Build System", "General") @@ -103,5 +103,5 @@ with Files("installer/**"): with Files("tools/**"): BUG_COMPONENT = ("Firefox", "General") -with Files("l10n-registry.manifest"): - BUG_COMPONENT = ("Core", "Localization") +with Files('l10n-registry.manifest'): + BUG_COMPONENT = ('Core', 'Localization') diff --git a/browser/moz.configure b/browser/moz.configure index 8653bcbb165d..a251050feb9b 100644 --- a/browser/moz.configure +++ b/browser/moz.configure @@ -4,16 +4,18 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -imply_option("MOZ_PLACES", True) -imply_option("MOZ_SERVICES_HEALTHREPORT", True) -imply_option("MOZ_SERVICES_SYNC", True) -imply_option("MOZ_DEDICATED_PROFILES", True) -imply_option("MOZ_BLOCK_PROFILE_DOWNGRADE", True) -imply_option("MOZ_NORMANDY", True) +imply_option('MOZ_PLACES', True) +imply_option('MOZ_SERVICES_HEALTHREPORT', True) +imply_option('MOZ_SERVICES_SYNC', True) +imply_option('MOZ_DEDICATED_PROFILES', True) +imply_option('MOZ_BLOCK_PROFILE_DOWNGRADE', True) +imply_option('MOZ_NORMANDY', True) with only_when(target_is_linux & compile_environment): - option(env="MOZ_NO_PIE_COMPAT", help="Enable non-PIE wrapper") + option(env='MOZ_NO_PIE_COMPAT', + help='Enable non-PIE wrapper') - set_config("MOZ_NO_PIE_COMPAT", depends_if("MOZ_NO_PIE_COMPAT")(lambda _: True)) + set_config('MOZ_NO_PIE_COMPAT', + depends_if('MOZ_NO_PIE_COMPAT')(lambda _: True)) -include("../toolkit/moz.configure") +include('../toolkit/moz.configure') diff --git a/browser/themes/addons/moz.build b/browser/themes/addons/moz.build index d988c0ff9b16..aac3a838c4c2 100644 --- a/browser/themes/addons/moz.build +++ b/browser/themes/addons/moz.build @@ -4,4 +4,4 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] diff --git a/browser/themes/linux/moz.build b/browser/themes/linux/moz.build index 20e4e3af75f5..5f26f477c3da 100644 --- a/browser/themes/linux/moz.build +++ b/browser/themes/linux/moz.build @@ -4,6 +4,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] + +DEFINES['MENUBAR_CAN_AUTOHIDE'] = 1 -DEFINES["MENUBAR_CAN_AUTOHIDE"] = 1 diff --git a/browser/themes/moz.build b/browser/themes/moz.build index 0e706766c502..9ca868304245 100644 --- a/browser/themes/moz.build +++ b/browser/themes/moz.build @@ -7,24 +7,24 @@ with Files("**"): BUG_COMPONENT = ("Firefox", "Theme") -toolkit = CONFIG["MOZ_WIDGET_TOOLKIT"] +toolkit = CONFIG['MOZ_WIDGET_TOOLKIT'] -if toolkit == "cocoa": - DIRS += ["osx"] -elif toolkit == "gtk": - DIRS += ["linux"] +if toolkit == 'cocoa': + DIRS += ['osx'] +elif toolkit == 'gtk': + DIRS += ['linux'] else: - DIRS += ["windows"] + DIRS += ['windows'] DIRS += [ - "addons", + 'addons', ] -with Files("osx/**"): - SCHEDULES.exclusive = ["macosx"] +with Files('osx/**'): + SCHEDULES.exclusive = ['macosx'] -with Files("linux/**"): - SCHEDULES.exclusive = ["linux"] +with Files('linux/**'): + SCHEDULES.exclusive = ['linux'] -with Files("windows/**"): - SCHEDULES.exclusive = ["windows"] +with Files('windows/**'): + SCHEDULES.exclusive = ['windows'] diff --git a/browser/themes/osx/moz.build b/browser/themes/osx/moz.build index d988c0ff9b16..7daa419f1faa 100644 --- a/browser/themes/osx/moz.build +++ b/browser/themes/osx/moz.build @@ -4,4 +4,5 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] + diff --git a/browser/themes/windows/moz.build b/browser/themes/windows/moz.build index 20e4e3af75f5..5f26f477c3da 100644 --- a/browser/themes/windows/moz.build +++ b/browser/themes/windows/moz.build @@ -4,6 +4,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -JAR_MANIFESTS += ["jar.mn"] +JAR_MANIFESTS += ['jar.mn'] + +DEFINES['MENUBAR_CAN_AUTOHIDE'] = 1 -DEFINES["MENUBAR_CAN_AUTOHIDE"] = 1 diff --git a/browser/tools/mozscreenshots/moz.build b/browser/tools/mozscreenshots/moz.build index a95940a208ec..a0405fc562ce 100644 --- a/browser/tools/mozscreenshots/moz.build +++ b/browser/tools/mozscreenshots/moz.build @@ -22,16 +22,16 @@ with Files("preferences/**"): BROWSER_CHROME_MANIFESTS += [ # Each test is in it's own directory so it gets run in a clean profile with # run-by-dir. - "controlCenter/browser.ini", - "devtools/browser.ini", - "permissionPrompts/browser.ini", - "preferences/browser.ini", - "primaryUI/browser.ini", - "tests/browser/browser.ini", + 'controlCenter/browser.ini', + 'devtools/browser.ini', + 'permissionPrompts/browser.ini', + 'preferences/browser.ini', + 'primaryUI/browser.ini', + 'tests/browser/browser.ini', ] TEST_DIRS += [ - "mozscreenshots/extension", + 'mozscreenshots/extension', ] -XPCSHELL_TESTS_MANIFESTS += ["tests/xpcshell/xpcshell.ini"] +XPCSHELL_TESTS_MANIFESTS += ['tests/xpcshell/xpcshell.ini'] diff --git a/browser/tools/mozscreenshots/mozscreenshots/extension/moz.build b/browser/tools/mozscreenshots/mozscreenshots/extension/moz.build index 3b96b08ee1ab..dff4fc998a4c 100644 --- a/browser/tools/mozscreenshots/mozscreenshots/extension/moz.build +++ b/browser/tools/mozscreenshots/mozscreenshots/extension/moz.build @@ -4,55 +4,55 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -XPI_NAME = "mozscreenshots" +XPI_NAME = 'mozscreenshots' USE_EXTENSION_MANIFEST = True FINAL_TARGET_FILES += [ - "api.js", - "manifest.json", - "schema.json", + 'api.js', + 'manifest.json', + 'schema.json', ] FINAL_TARGET_FILES.resources += [ - "Screenshot.jsm", - "TestRunner.jsm", + 'Screenshot.jsm', + 'TestRunner.jsm', ] FINAL_TARGET_FILES.resources.configurations += [ - "configurations/AppMenu.jsm", - "configurations/Buttons.jsm", - "configurations/ControlCenter.jsm", - "configurations/CustomizeMode.jsm", - "configurations/DevTools.jsm", - "configurations/LightweightThemes.jsm", - "configurations/PermissionPrompts.jsm", - "configurations/Preferences.jsm", - "configurations/Tabs.jsm", - "configurations/TabsInTitlebar.jsm", - "configurations/Toolbars.jsm", - "configurations/UIDensities.jsm", - "configurations/WindowSize.jsm", + 'configurations/AppMenu.jsm', + 'configurations/Buttons.jsm', + 'configurations/ControlCenter.jsm', + 'configurations/CustomizeMode.jsm', + 'configurations/DevTools.jsm', + 'configurations/LightweightThemes.jsm', + 'configurations/PermissionPrompts.jsm', + 'configurations/Preferences.jsm', + 'configurations/Tabs.jsm', + 'configurations/TabsInTitlebar.jsm', + 'configurations/Toolbars.jsm', + 'configurations/UIDensities.jsm', + 'configurations/WindowSize.jsm', ] FINAL_TARGET_FILES.resources.lib += [ - "lib/borderify.xpi", - "lib/mozscreenshots-script.js", - "lib/mozscreenshots-style.css", - "lib/mozscreenshots.html", - "lib/permissionPrompts.html", - "lib/robot.png", - "lib/robot_center.png", - "lib/robot_cropped_diagonal.png", - "lib/robot_diagonal.png", - "lib/robot_uncropped.png", - "lib/robot_upperleft.png", + 'lib/borderify.xpi', + 'lib/mozscreenshots-script.js', + 'lib/mozscreenshots-style.css', + 'lib/mozscreenshots.html', + 'lib/permissionPrompts.html', + 'lib/robot.png', + 'lib/robot_center.png', + 'lib/robot_cropped_diagonal.png', + 'lib/robot_diagonal.png', + 'lib/robot_uncropped.png', + 'lib/robot_upperleft.png', ] FINAL_TARGET_FILES.resources.lib.controlCenter += [ - "lib/controlCenter/mixed.html", - "lib/controlCenter/mixed_active.html", - "lib/controlCenter/mixed_passive.html", - "lib/controlCenter/password.html", - "lib/controlCenter/tracking.html", + 'lib/controlCenter/mixed.html', + 'lib/controlCenter/mixed_active.html', + 'lib/controlCenter/mixed_passive.html', + 'lib/controlCenter/password.html', + 'lib/controlCenter/tracking.html', ] diff --git a/build/RunCbindgen.py b/build/RunCbindgen.py index 0c941eaaca21..d40683ad8589 100644 --- a/build/RunCbindgen.py +++ b/build/RunCbindgen.py @@ -26,8 +26,8 @@ CARGO_TOML = mozpath.join(buildconfig.topsrcdir, "Cargo.toml") def _run_process(args): env = os.environ.copy() - env["CARGO"] = str(buildconfig.substs["CARGO"]) - env["RUSTC"] = str(buildconfig.substs["RUSTC"]) + env['CARGO'] = str(buildconfig.substs['CARGO']) + env['RUSTC'] = str(buildconfig.substs['RUSTC']) p = subprocess.Popen(args, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -41,17 +41,15 @@ def _run_process(args): def generate_metadata(output, cargo_config): - stdout, returncode = _run_process( - [ - buildconfig.substs["CARGO"], - "metadata", - "--all-features", - "--format-version", - "1", - "--manifest-path", - CARGO_TOML, - ] - ) + stdout, returncode = _run_process([ + buildconfig.substs['CARGO'], + "metadata", + "--all-features", + "--format-version", + "1", + "--manifest-path", + CARGO_TOML + ]) if returncode != 0: return returncode @@ -64,19 +62,17 @@ def generate_metadata(output, cargo_config): def generate(output, metadata_path, cbindgen_crate_path, *in_tree_dependencies): - stdout, returncode = _run_process( - [ - buildconfig.substs["CBINDGEN"], - buildconfig.topsrcdir, - "--lockfile", - CARGO_LOCK, - "--crate", - _get_crate_name(cbindgen_crate_path), - "--metadata", - metadata_path, - "--cpp-compat", - ] - ) + stdout, returncode = _run_process([ + buildconfig.substs['CBINDGEN'], + buildconfig.topsrcdir, + "--lockfile", + CARGO_LOCK, + "--crate", + _get_crate_name(cbindgen_crate_path), + "--metadata", + metadata_path, + "--cpp-compat" + ]) if returncode != 0: return returncode diff --git a/build/appini_header.py b/build/appini_header.py index 08bd22721df9..1cbfe90e2028 100644 --- a/build/appini_header.py +++ b/build/appini_header.py @@ -2,8 +2,8 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -"""Parses a given application.ini file and outputs the corresponding - StaticXREAppData structure as a C++ header file""" +'''Parses a given application.ini file and outputs the corresponding + StaticXREAppData structure as a C++ header file''' import configparser import sys @@ -14,54 +14,40 @@ def main(output, file): config.read(file) flags = set() try: - if config.getint("XRE", "EnableProfileMigrator") == 1: - flags.add("NS_XRE_ENABLE_PROFILE_MIGRATOR") + if config.getint('XRE', 'EnableProfileMigrator') == 1: + flags.add('NS_XRE_ENABLE_PROFILE_MIGRATOR') except Exception: pass try: - if config.getint("Crash Reporter", "Enabled") == 1: - flags.add("NS_XRE_ENABLE_CRASH_REPORTER") + if config.getint('Crash Reporter', 'Enabled') == 1: + flags.add('NS_XRE_ENABLE_CRASH_REPORTER') except Exception: pass - appdata = dict( - ("%s:%s" % (s, o), config.get(s, o)) - for s in config.sections() - for o in config.options(s) - ) - appdata["flags"] = " | ".join(sorted(flags)) if flags else "0" - appdata["App:profile"] = ( - '"%s"' % appdata["App:profile"] if "App:profile" in appdata else "NULL" - ) - expected = ( - "App:vendor", - "App:name", - "App:remotingname", - "App:version", - "App:buildid", - "App:id", - "Gecko:minversion", - "Gecko:maxversion", - ) + appdata = dict(("%s:%s" % (s, o), config.get(s, o)) + for s in config.sections() for o in config.options(s)) + appdata['flags'] = ' | '.join(sorted(flags)) if flags else '0' + appdata['App:profile'] = ('"%s"' % appdata['App:profile'] + if 'App:profile' in appdata else 'NULL') + expected = ('App:vendor', 'App:name', 'App:remotingname', 'App:version', 'App:buildid', + 'App:id', 'Gecko:minversion', 'Gecko:maxversion') missing = [var for var in expected if var not in appdata] if missing: - print("Missing values in %s: %s" % (file, ", ".join(missing)), file=sys.stderr) + print("Missing values in %s: %s" % (file, ', '.join(missing)), + file=sys.stderr) sys.exit(1) - if "Crash Reporter:serverurl" not in appdata: - appdata["Crash Reporter:serverurl"] = "" + if 'Crash Reporter:serverurl' not in appdata: + appdata['Crash Reporter:serverurl'] = '' - if "App:sourcerepository" in appdata and "App:sourcestamp" in appdata: - appdata["App:sourceurl"] = ( - '"%(App:sourcerepository)s/rev/%(App:sourcestamp)s"' % appdata - ) + if 'App:sourcerepository' in appdata and 'App:sourcestamp' in appdata: + appdata['App:sourceurl'] = '"%(App:sourcerepository)s/rev/%(App:sourcestamp)s"' % appdata else: - appdata["App:sourceurl"] = "NULL" + appdata['App:sourceurl'] = 'NULL' - if "AppUpdate:url" not in appdata: - appdata["AppUpdate:url"] = "" + if 'AppUpdate:url' not in appdata: + appdata['AppUpdate:url'] = '' - output.write( - """#include "mozilla/XREAppData.h" + output.write('''#include "mozilla/XREAppData.h" static const mozilla::StaticXREAppData sAppData = { "%(App:vendor)s", "%(App:name)s", @@ -78,13 +64,12 @@ def main(output, file): NULL, // UAName %(App:sourceurl)s, "%(AppUpdate:url)s" - };""" - % appdata - ) + };''' % appdata) -if __name__ == "__main__": +if __name__ == '__main__': if len(sys.argv) != 1: main(sys.stdout, sys.argv[1]) else: - print("Usage: %s /path/to/application.ini" % sys.argv[0], file=sys.stderr) + print("Usage: %s /path/to/application.ini" % sys.argv[0], + file=sys.stderr) diff --git a/build/build-clang/build-clang.py b/build/build-clang/build-clang.py index a4d6d93f3142..86af69dba617 100755 --- a/build/build-clang/build-clang.py +++ b/build/build-clang/build-clang.py @@ -38,8 +38,8 @@ def symlink(source, link_name): def check_run(args): - print(" ".join(args), file=sys.stderr, flush=True) - if args[0] == "cmake": + print(' '.join(args), file=sys.stderr, flush=True) + if args[0] == 'cmake': # CMake `message(STATUS)` messages, as appearing in failed source code # compiles, appear on stdout, so we only capture that. p = subprocess.Popen(args, stdout=subprocess.PIPE) @@ -50,8 +50,8 @@ def check_run(args): sys.stdout.flush() r = p.wait() if r != 0: - cmake_output_re = re.compile(b'See also "(.*/CMakeOutput.log)"') - cmake_error_re = re.compile(b'See also "(.*/CMakeError.log)"') + cmake_output_re = re.compile(b"See also \"(.*/CMakeOutput.log)\"") + cmake_error_re = re.compile(b"See also \"(.*/CMakeError.log)\"") def find_first_match(re): for l in lines: @@ -63,10 +63,9 @@ def check_run(args): error_match = find_first_match(cmake_error_re) def dump_file(log): - with open(log, "rb") as f: + with open(log, 'rb') as f: print("\nContents of", log, "follow\n", file=sys.stderr) print(f.read(), file=sys.stderr) - if output_match: dump_file(output_match.group(1)) if error_match: @@ -95,18 +94,20 @@ def chdir(path): def patch(patch, srcdir): patch = os.path.realpath(patch) - check_run(["patch", "-d", srcdir, "-p1", "-i", patch, "--fuzz=0", "-s"]) + check_run(['patch', '-d', srcdir, '-p1', '-i', patch, '--fuzz=0', + '-s']) def import_clang_tidy(source_dir, build_clang_tidy_alpha, build_clang_tidy_external): - clang_plugin_path = os.path.join(os.path.dirname(sys.argv[0]), "..", "clang-plugin") - clang_tidy_path = os.path.join(source_dir, "clang-tools-extra/clang-tidy") + clang_plugin_path = os.path.join(os.path.dirname(sys.argv[0]), + '..', 'clang-plugin') + clang_tidy_path = os.path.join(source_dir, + 'clang-tools-extra/clang-tidy') sys.path.append(clang_plugin_path) from import_mozilla_checks import do_import - import_options = { - "alpha": build_clang_tidy_alpha, - "external": build_clang_tidy_external, + "alpha": build_clang_tidy_alpha, + "external": build_clang_tidy_external } do_import(clang_plugin_path, clang_tidy_path, import_options) @@ -137,7 +138,7 @@ def updated_env(env): def build_tar_package(name, base, directory): name = os.path.realpath(name) - print("tarring {} from {}/{}".format(name, base, directory), file=sys.stderr) + print('tarring {} from {}/{}'.format(name, base, directory), file=sys.stderr) assert name.endswith(".tar.zst") cctx = zstandard.ZstdCompressor() @@ -166,7 +167,7 @@ def delete(path): def install_libgcc(gcc_dir, clang_dir, is_final_stage): - gcc_bin_dir = os.path.join(gcc_dir, "bin") + gcc_bin_dir = os.path.join(gcc_dir, 'bin') # Copy over gcc toolchain bits that clang looks for, to ensure that # clang is using a consistent version of ld, since the system ld may @@ -177,22 +178,17 @@ def install_libgcc(gcc_dir, clang_dir, is_final_stage): # Only install this for the bootstrap process; we expect any consumers of # the newly-built toolchain to provide an appropriate ld themselves. if not is_final_stage: - x64_bin_dir = os.path.join(clang_dir, "x86_64-unknown-linux-gnu", "bin") + x64_bin_dir = os.path.join(clang_dir, 'x86_64-unknown-linux-gnu', 'bin') mkdir_p(x64_bin_dir) - shutil.copy2(os.path.join(gcc_bin_dir, "ld"), x64_bin_dir) + shutil.copy2(os.path.join(gcc_bin_dir, 'ld'), x64_bin_dir) - out = subprocess.check_output( - [os.path.join(gcc_bin_dir, "gcc"), "-print-libgcc-file-name"] - ) + out = subprocess.check_output([os.path.join(gcc_bin_dir, "gcc"), + '-print-libgcc-file-name']) libgcc_dir = os.path.dirname(out.decode().rstrip()) - clang_lib_dir = os.path.join( - clang_dir, - "lib", - "gcc", - "x86_64-unknown-linux-gnu", - os.path.basename(libgcc_dir), - ) + clang_lib_dir = os.path.join(clang_dir, "lib", "gcc", + "x86_64-unknown-linux-gnu", + os.path.basename(libgcc_dir)) mkdir_p(clang_lib_dir) copy_tree(libgcc_dir, clang_lib_dir, preserve_symlinks=True) libgcc_dir = os.path.join(gcc_dir, "lib64") @@ -207,16 +203,14 @@ def install_libgcc(gcc_dir, clang_dir, is_final_stage): def install_import_library(build_dir, clang_dir): - shutil.copy2( - os.path.join(build_dir, "lib", "clang.lib"), os.path.join(clang_dir, "lib") - ) + shutil.copy2(os.path.join(build_dir, "lib", "clang.lib"), + os.path.join(clang_dir, "lib")) def install_asan_symbols(build_dir, clang_dir): lib_path_pattern = os.path.join("lib", "clang", "*.*.*", "lib", "windows") - src_path = glob.glob( - os.path.join(build_dir, lib_path_pattern, "clang_rt.asan_dynamic-*.pdb") - ) + src_path = glob.glob(os.path.join(build_dir, lib_path_pattern, + "clang_rt.asan_dynamic-*.pdb")) dst_path = glob.glob(os.path.join(clang_dir, lib_path_pattern)) if len(src_path) != 1: @@ -240,33 +234,14 @@ def is_windows(): return platform.system() == "Windows" -def build_one_stage( - cc, - cxx, - asm, - ld, - ar, - ranlib, - libtool, - src_dir, - stage_dir, - package_name, - build_libcxx, - osx_cross_compile, - build_type, - assertions, - python_path, - gcc_dir, - libcxx_include_dir, - build_wasm, - compiler_rt_source_dir=None, - runtimes_source_link=None, - compiler_rt_source_link=None, - is_final_stage=False, - android_targets=None, - extra_targets=None, - pgo_phase=None, -): +def build_one_stage(cc, cxx, asm, ld, ar, ranlib, libtool, + src_dir, stage_dir, package_name, build_libcxx, + osx_cross_compile, build_type, assertions, + python_path, gcc_dir, libcxx_include_dir, build_wasm, + compiler_rt_source_dir=None, runtimes_source_link=None, + compiler_rt_source_link=None, + is_final_stage=False, android_targets=None, + extra_targets=None, pgo_phase=None): if is_final_stage and (android_targets or extra_targets): # Linking compiler-rt under "runtimes" activates LLVM_RUNTIME_TARGETS # and related arguments. @@ -284,7 +259,7 @@ def build_one_stage( # cmake doesn't deal well with backslashes in paths. def slashify_path(path): - return path.replace("\\", "/") + return path.replace('\\', '/') def cmake_base_args(cc, cxx, asm, ld, ar, ranlib, libtool, inst_dir): machine_targets = "X86;ARM;AArch64" if is_final_stage else "X86" @@ -295,11 +270,11 @@ def build_one_stage( "-DCMAKE_ASM_COMPILER=%s" % slashify_path(asm[0]), "-DCMAKE_LINKER=%s" % slashify_path(ld[0]), "-DCMAKE_AR=%s" % slashify_path(ar), - "-DCMAKE_C_FLAGS=%s" % " ".join(cc[1:]), - "-DCMAKE_CXX_FLAGS=%s" % " ".join(cxx[1:]), - "-DCMAKE_ASM_FLAGS=%s" % " ".join(asm[1:]), - "-DCMAKE_EXE_LINKER_FLAGS=%s" % " ".join(ld[1:]), - "-DCMAKE_SHARED_LINKER_FLAGS=%s" % " ".join(ld[1:]), + "-DCMAKE_C_FLAGS=%s" % ' '.join(cc[1:]), + "-DCMAKE_CXX_FLAGS=%s" % ' '.join(cxx[1:]), + "-DCMAKE_ASM_FLAGS=%s" % ' '.join(asm[1:]), + "-DCMAKE_EXE_LINKER_FLAGS=%s" % ' '.join(ld[1:]), + "-DCMAKE_SHARED_LINKER_FLAGS=%s" % ' '.join(ld[1:]), "-DCMAKE_BUILD_TYPE=%s" % build_type, "-DCMAKE_INSTALL_PREFIX=%s" % inst_dir, "-DLLVM_TARGETS_TO_BUILD=%s" % machine_targets, @@ -341,7 +316,7 @@ def build_one_stage( "-DCMAKE_OSX_ARCHITECTURES=x86_64", "-DDARWIN_osx_ARCHS=x86_64", "-DDARWIN_osx_SYSROOT=%s" % slashify_path(os.getenv("CROSS_SYSROOT")), - "-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-apple-darwin", + "-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-apple-darwin" ] # Starting in LLVM 11 (which requires SDK 10.12) the build tries to # detect the SDK version by calling xcrun. Cross-compiles don't have @@ -405,9 +380,8 @@ def build_one_stage( android_include_dirs = cfg["ndk_includes"] api_level = cfg["api_level"] - android_flags = [ - "-isystem %s" % d.format(**os.environ) for d in android_include_dirs - ] + android_flags = ["-isystem %s" % d.format(**os.environ) + for d in android_include_dirs] android_flags += ["--gcc-toolchain=%s" % android_gcc_dir] android_flags += ["-D__ANDROID_API__=%s" % api_level] @@ -417,21 +391,24 @@ def build_one_stage( rt_cxx_flags = " ".join(cxx[1:] + android_flags) rt_asm_flags = " ".join(asm[1:] + android_flags) - for kind in ("BUILTINS", "RUNTIMES"): + for kind in ('BUILTINS', 'RUNTIMES'): for var, arg in ( - ("ANDROID", "1"), - ("CMAKE_ASM_FLAGS", rt_asm_flags), - ("CMAKE_CXX_FLAGS", rt_cxx_flags), - ("CMAKE_C_FLAGS", rt_c_flags), - ("CMAKE_EXE_LINKER_FLAGS", android_link_flags), - ("CMAKE_SHARED_LINKER_FLAGS", android_link_flags), - ("CMAKE_SYSROOT", sysroot_dir), - ("ANDROID_NATIVE_API_LEVEL", api_level), + ('ANDROID', '1'), + ('CMAKE_ASM_FLAGS', rt_asm_flags), + ('CMAKE_CXX_FLAGS', rt_cxx_flags), + ('CMAKE_C_FLAGS', rt_c_flags), + ('CMAKE_EXE_LINKER_FLAGS', android_link_flags), + ('CMAKE_SHARED_LINKER_FLAGS', android_link_flags), + ('CMAKE_SYSROOT', sysroot_dir), + ('ANDROID_NATIVE_API_LEVEL', api_level), ): - cmake_args += ["-D%s_%s_%s=%s" % (kind, target, var, arg)] + cmake_args += ['-D%s_%s_%s=%s' % (kind, target, var, arg)] - cmake_args += cmake_base_args(cc, cxx, asm, ld, ar, ranlib, libtool, inst_dir) - cmake_args += [src_dir] + cmake_args += cmake_base_args( + cc, cxx, asm, ld, ar, ranlib, libtool, inst_dir) + cmake_args += [ + src_dir + ] build_package(build_dir, cmake_args) if is_linux(): @@ -448,40 +425,35 @@ def build_one_stage( # 64-bits, which we detect through the contents of the LIB # environment variable, which we also adjust for a 32-bits build # at the same time. - old_lib = os.environ["LIB"] + old_lib = os.environ['LIB'] new_lib = [] for l in old_lib.split(os.pathsep): - if l.endswith("x64"): - l = l[:-3] + "x86" + if l.endswith('x64'): + l = l[:-3] + 'x86' build_32_bit = True - elif l.endswith("amd64"): + elif l.endswith('amd64'): l = l[:-5] build_32_bit = True new_lib.append(l) if build_32_bit: - os.environ["LIB"] = os.pathsep.join(new_lib) - compiler_rt_build_dir = stage_dir + "/compiler-rt" - compiler_rt_inst_dir = inst_dir + "/lib/clang/" + os.environ['LIB'] = os.pathsep.join(new_lib) + compiler_rt_build_dir = stage_dir + '/compiler-rt' + compiler_rt_inst_dir = inst_dir + '/lib/clang/' subdirs = os.listdir(compiler_rt_inst_dir) assert len(subdirs) == 1 compiler_rt_inst_dir += subdirs[0] cmake_args = cmake_base_args( - [os.path.join(inst_dir, "bin", "clang-cl.exe"), "-m32"] + cc[1:], - [os.path.join(inst_dir, "bin", "clang-cl.exe"), "-m32"] + cxx[1:], - [os.path.join(inst_dir, "bin", "clang-cl.exe"), "-m32"] + asm[1:], - ld, - ar, - ranlib, - libtool, - compiler_rt_inst_dir, - ) + [os.path.join(inst_dir, 'bin', 'clang-cl.exe'), '-m32'] + cc[1:], + [os.path.join(inst_dir, 'bin', 'clang-cl.exe'), '-m32'] + cxx[1:], + [os.path.join(inst_dir, 'bin', 'clang-cl.exe'), '-m32'] + asm[1:], + ld, ar, ranlib, libtool, compiler_rt_inst_dir) cmake_args += [ - "-DLLVM_CONFIG_PATH=%s" - % slashify_path(os.path.join(inst_dir, "bin", "llvm-config")), - os.path.join(src_dir, "projects", "compiler-rt"), + '-DLLVM_CONFIG_PATH=%s' % slashify_path( + os.path.join(inst_dir, 'bin', 'llvm-config')), + os.path.join(src_dir, 'projects', 'compiler-rt'), ] build_package(compiler_rt_build_dir, cmake_args) - os.environ["LIB"] = old_lib + os.environ['LIB'] = old_lib if is_final_stage: install_import_library(build_dir, inst_dir) install_asan_symbols(build_dir, inst_dir) @@ -540,16 +512,7 @@ def get_tool(config, key): # run-clang-tidy.py def prune_final_dir_for_clang_tidy(final_dir, osx_cross_compile): # Make sure we only have what we expect. - dirs = [ - "bin", - "include", - "lib", - "lib32", - "libexec", - "msbuild-bin", - "share", - "tools", - ] + dirs = ["bin", "include", "lib", "lib32", "libexec", "msbuild-bin", "share", "tools"] if is_linux(): dirs.append("x86_64-unknown-linux-gnu") for f in glob.glob("%s/*" % final_dir): @@ -558,7 +521,7 @@ def prune_final_dir_for_clang_tidy(final_dir, osx_cross_compile): if not os.path.isdir(f): raise Exception("Expected %s to be a directory" % f) - kept_binaries = ["clang-apply-replacements", "clang-format", "clang-tidy", "clangd"] + kept_binaries = ['clang-apply-replacements', 'clang-format', 'clang-tidy', 'clangd'] re_clang_tidy = re.compile(r"^(" + "|".join(kept_binaries) + r")(\.exe)?$", re.I) for f in glob.glob("%s/bin/*" % final_dir): if re_clang_tidy.search(os.path.basename(f)) is None: @@ -577,12 +540,10 @@ def prune_final_dir_for_clang_tidy(final_dir, osx_cross_compile): name = os.path.basename(f) if name == "clang": continue - if osx_cross_compile and name in ["libLLVM.dylib", "libclang-cpp.dylib"]: + if osx_cross_compile and name in ['libLLVM.dylib', 'libclang-cpp.dylib']: continue - if is_linux() and ( - fnmatch.fnmatch(name, "libLLVM*.so") - or fnmatch.fnmatch(name, "libclang-cpp.so*") - ): + if is_linux() and (fnmatch.fnmatch(name, 'libLLVM*.so') or + fnmatch.fnmatch(name, 'libclang-cpp.so*')): continue delete(f) for f in glob.glob("%s/lib/clang/*" % final_dir): @@ -611,35 +572,24 @@ def prune_final_dir_for_clang_tidy(final_dir, osx_cross_compile): if __name__ == "__main__": parser = argparse.ArgumentParser() - parser.add_argument( - "-c", - "--config", - required=True, - type=argparse.FileType("r"), - help="Clang configuration file", - ) - parser.add_argument( - "--clean", required=False, action="store_true", help="Clean the build directory" - ) - parser.add_argument( - "--skip-tar", - required=False, - action="store_true", - help="Skip tar packaging stage", - ) - parser.add_argument( - "--skip-checkout", - required=False, - action="store_true", - help="Do not checkout/revert source", - ) + parser.add_argument('-c', '--config', required=True, + type=argparse.FileType('r'), + help="Clang configuration file") + parser.add_argument('--clean', required=False, + action='store_true', + help="Clean the build directory") + parser.add_argument('--skip-tar', required=False, + action='store_true', + help="Skip tar packaging stage") + parser.add_argument('--skip-checkout', required=False, + action='store_true', + help="Do not checkout/revert source") args = parser.parse_args() - if not os.path.exists("llvm/LLVMBuild.txt"): - raise Exception( - "The script must be run from the root directory of the " "llvm-project tree" - ) + if not os.path.exists('llvm/LLVMBuild.txt'): + raise Exception('The script must be run from the root directory of the ' + 'llvm-project tree') source_dir = os.getcwd() build_dir = source_dir + "/build" @@ -684,10 +634,8 @@ if __name__ == "__main__": if "build_type" in config: build_type = config["build_type"] if build_type not in ("Release", "Debug", "RelWithDebInfo", "MinSizeRel"): - raise ValueError( - "We only know how to do Release, Debug, RelWithDebInfo or " - "MinSizeRel builds" - ) + raise ValueError("We only know how to do Release, Debug, RelWithDebInfo or " + "MinSizeRel builds") build_libcxx = False if "build_libcxx" in config: build_libcxx = config["build_libcxx"] @@ -708,17 +656,13 @@ if __name__ == "__main__": if build_clang_tidy and "build_clang_tidy_alpha" in config: build_clang_tidy_alpha = config["build_clang_tidy_alpha"] if build_clang_tidy_alpha not in (True, False): - raise ValueError( - "Only boolean values are accepted for build_clang_tidy_alpha." - ) + raise ValueError("Only boolean values are accepted for build_clang_tidy_alpha.") build_clang_tidy_external = False # check for build_clang_tidy_external only if build_clang_tidy is true if build_clang_tidy and "build_clang_tidy_external" in config: build_clang_tidy_external = config["build_clang_tidy_external"] if build_clang_tidy_external not in (True, False): - raise ValueError( - "Only boolean values are accepted for build_clang_tidy_external." - ) + raise ValueError("Only boolean values are accepted for build_clang_tidy_external.") osx_cross_compile = False if "osx_cross_compile" in config: osx_cross_compile = config["osx_cross_compile"] @@ -747,10 +691,8 @@ if __name__ == "__main__": for attr in ("ndk_toolchain", "ndk_sysroot", "ndk_includes", "api_level"): for target, cfg in android_targets.items(): if attr not in cfg: - raise ValueError( - "must specify '%s' as a key for android target: %s" - % (attr, target) - ) + raise ValueError("must specify '%s' as a key for android target: %s" % + (attr, target)) extra_targets = None if "extra_targets" in config: extra_targets = config["extra_targets"] @@ -763,7 +705,7 @@ if __name__ == "__main__": raise ValueError("Config file needs to set gcc_dir") if is_darwin() or osx_cross_compile: - os.environ["MACOSX_DEPLOYMENT_TARGET"] = "10.11" + os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.11' cc = get_tool(config, "cc") cxx = get_tool(config, "cxx") @@ -783,14 +725,17 @@ if __name__ == "__main__": compiler_rt_source_link = llvm_source_dir + "/projects/compiler-rt" - symlinks = [ - (clang_source_dir, llvm_source_dir + "/tools/clang"), - (extra_source_dir, llvm_source_dir + "/tools/clang/tools/extra"), - (lld_source_dir, llvm_source_dir + "/tools/lld"), - (compiler_rt_source_dir, compiler_rt_source_link), - (libcxx_source_dir, llvm_source_dir + "/projects/libcxx"), - (libcxxabi_source_dir, llvm_source_dir + "/projects/libcxxabi"), - ] + symlinks = [(clang_source_dir, + llvm_source_dir + "/tools/clang"), + (extra_source_dir, + llvm_source_dir + "/tools/clang/tools/extra"), + (lld_source_dir, + llvm_source_dir + "/tools/lld"), + (compiler_rt_source_dir, compiler_rt_source_link), + (libcxx_source_dir, + llvm_source_dir + "/projects/libcxx"), + (libcxxabi_source_dir, + llvm_source_dir + "/projects/libcxxabi")] for l in symlinks: # On Windows, we have to re-copy the whole directory every time. if not is_windows() and os.path.islink(l[1]): @@ -807,10 +752,11 @@ if __name__ == "__main__": if not os.path.exists(build_dir): os.makedirs(build_dir) - libcxx_include_dir = os.path.join(llvm_source_dir, "projects", "libcxx", "include") + libcxx_include_dir = os.path.join(llvm_source_dir, "projects", + "libcxx", "include") - stage1_dir = build_dir + "/stage1" - stage1_inst_dir = stage1_dir + "/" + package_name + stage1_dir = build_dir + '/stage1' + stage1_inst_dir = stage1_dir + '/' + package_name final_stage_dir = stage1_dir final_inst_dir = stage1_inst_dir @@ -829,31 +775,24 @@ if __name__ == "__main__": # up whatever headers were installed from the gcc we used to build stage1, # always, rather than the system headers. Providing -gcc-toolchain # encourages clang to do that. - extra_cflags2 = ["-fPIC", "-gcc-toolchain", stage1_inst_dir] + extra_cflags2 = ["-fPIC", '-gcc-toolchain', stage1_inst_dir] # Silence clang's warnings about arguments not being used in compilation. - extra_cxxflags2 = [ - "-fPIC", - "-Qunused-arguments", - "-gcc-toolchain", - stage1_inst_dir, - ] + extra_cxxflags2 = ["-fPIC", '-Qunused-arguments', '-gcc-toolchain', stage1_inst_dir] extra_asmflags = [] # Avoid libLLVM internal function calls going through the PLT. - extra_ldflags = ["-Wl,-Bsymbolic-functions"] + extra_ldflags = ['-Wl,-Bsymbolic-functions'] # For whatever reason, LLVM's build system will set things up to turn # on -ffunction-sections and -fdata-sections, but won't turn on the # corresponding option to strip unused sections. We do it explicitly # here. LLVM's build system is also picky about turning on ICF, so # we do that explicitly here, too. - extra_ldflags += ["-fuse-ld=gold", "-Wl,--gc-sections", "-Wl,--icf=safe"] + extra_ldflags += ['-fuse-ld=gold', '-Wl,--gc-sections', '-Wl,--icf=safe'] - if "LD_LIBRARY_PATH" in os.environ: - os.environ["LD_LIBRARY_PATH"] = "%s/lib64/:%s" % ( - gcc_dir, - os.environ["LD_LIBRARY_PATH"], - ) + if 'LD_LIBRARY_PATH' in os.environ: + os.environ['LD_LIBRARY_PATH'] = ('%s/lib64/:%s' % + (gcc_dir, os.environ['LD_LIBRARY_PATH'])) else: - os.environ["LD_LIBRARY_PATH"] = "%s/lib64/" % gcc_dir + os.environ['LD_LIBRARY_PATH'] = '%s/lib64/' % gcc_dir elif is_windows(): extra_cflags = [] extra_cxxflags = [] @@ -861,11 +800,7 @@ if __name__ == "__main__": # by looking at an MSVC install, but we don't really have that here. # Force things on. extra_cflags2 = [] - extra_cxxflags2 = [ - "-fms-compatibility-version=19.13.26128", - "-Xclang", - "-std=c++14", - ] + extra_cxxflags2 = ['-fms-compatibility-version=19.13.26128', '-Xclang', '-std=c++14'] extra_asmflags = [] extra_ldflags = [] @@ -876,186 +811,124 @@ if __name__ == "__main__": extra_cxxflags = ["-stdlib=libc++"] extra_cxxflags2 = ["-stdlib=libc++"] - extra_flags = [ - "-target", - "x86_64-apple-darwin", - "-mlinker-version=137", - "-B", - "%s/bin" % os.getenv("CROSS_CCTOOLS_PATH"), - "-isysroot", - os.getenv("CROSS_SYSROOT"), - # technically the sysroot flag there should be enough to deduce this, - # but clang needs some help to figure this out. - "-I%s/usr/include" % os.getenv("CROSS_SYSROOT"), - "-iframework", - "%s/System/Library/Frameworks" % os.getenv("CROSS_SYSROOT"), - ] + extra_flags = ["-target", "x86_64-apple-darwin", "-mlinker-version=137", + "-B", "%s/bin" % os.getenv("CROSS_CCTOOLS_PATH"), + "-isysroot", os.getenv("CROSS_SYSROOT"), + # technically the sysroot flag there should be enough to deduce this, + # but clang needs some help to figure this out. + "-I%s/usr/include" % os.getenv("CROSS_SYSROOT"), + "-iframework", "%s/System/Library/Frameworks" % os.getenv("CROSS_SYSROOT")] extra_cflags += extra_flags extra_cxxflags += extra_flags extra_cflags2 += extra_flags extra_cxxflags2 += extra_flags extra_asmflags += extra_flags - extra_ldflags = [ - "-Wl,-syslibroot,%s" % os.getenv("CROSS_SYSROOT"), - "-Wl,-dead_strip", - ] + extra_ldflags = ["-Wl,-syslibroot,%s" % os.getenv("CROSS_SYSROOT"), + "-Wl,-dead_strip"] - upload_dir = os.getenv("UPLOAD_DIR") + upload_dir = os.getenv('UPLOAD_DIR') if assertions and upload_dir: - extra_cflags2 += ["-fcrash-diagnostics-dir=%s" % upload_dir] - extra_cxxflags2 += ["-fcrash-diagnostics-dir=%s" % upload_dir] + extra_cflags2 += ['-fcrash-diagnostics-dir=%s' % upload_dir] + extra_cxxflags2 += ['-fcrash-diagnostics-dir=%s' % upload_dir] build_one_stage( [cc] + extra_cflags, [cxx] + extra_cxxflags, [asm] + extra_asmflags, [ld] + extra_ldflags, - ar, - ranlib, - libtool, - llvm_source_dir, - stage1_dir, - package_name, - build_libcxx, - osx_cross_compile, - build_type, - assertions, - python_path, - gcc_dir, - libcxx_include_dir, - build_wasm, - is_final_stage=(stages == 1), - ) + ar, ranlib, libtool, + llvm_source_dir, stage1_dir, package_name, build_libcxx, osx_cross_compile, + build_type, assertions, python_path, gcc_dir, libcxx_include_dir, build_wasm, + is_final_stage=(stages == 1)) runtimes_source_link = llvm_source_dir + "/runtimes/compiler-rt" if stages >= 2: - stage2_dir = build_dir + "/stage2" - stage2_inst_dir = stage2_dir + "/" + package_name + stage2_dir = build_dir + '/stage2' + stage2_inst_dir = stage2_dir + '/' + package_name final_stage_dir = stage2_dir final_inst_dir = stage2_inst_dir pgo_phase = "gen" if pgo else None build_one_stage( - [stage1_inst_dir + "/bin/%s%s" % (cc_name, exe_ext)] + extra_cflags2, - [stage1_inst_dir + "/bin/%s%s" % (cxx_name, exe_ext)] + extra_cxxflags2, - [stage1_inst_dir + "/bin/%s%s" % (cc_name, exe_ext)] + extra_asmflags, + [stage1_inst_dir + "/bin/%s%s" % + (cc_name, exe_ext)] + extra_cflags2, + [stage1_inst_dir + "/bin/%s%s" % + (cxx_name, exe_ext)] + extra_cxxflags2, + [stage1_inst_dir + "/bin/%s%s" % + (cc_name, exe_ext)] + extra_asmflags, [ld] + extra_ldflags, - ar, - ranlib, - libtool, - llvm_source_dir, - stage2_dir, - package_name, - build_libcxx, - osx_cross_compile, - build_type, - assertions, - python_path, - gcc_dir, - libcxx_include_dir, - build_wasm, - compiler_rt_source_dir, - runtimes_source_link, - compiler_rt_source_link, - is_final_stage=(stages == 2), - android_targets=android_targets, - extra_targets=extra_targets, - pgo_phase=pgo_phase, - ) + ar, ranlib, libtool, + llvm_source_dir, stage2_dir, package_name, build_libcxx, osx_cross_compile, + build_type, assertions, python_path, gcc_dir, libcxx_include_dir, build_wasm, + compiler_rt_source_dir, runtimes_source_link, compiler_rt_source_link, + is_final_stage=(stages == 2), android_targets=android_targets, + extra_targets=extra_targets, pgo_phase=pgo_phase) if stages >= 3: - stage3_dir = build_dir + "/stage3" - stage3_inst_dir = stage3_dir + "/" + package_name + stage3_dir = build_dir + '/stage3' + stage3_inst_dir = stage3_dir + '/' + package_name final_stage_dir = stage3_dir final_inst_dir = stage3_inst_dir build_one_stage( - [stage2_inst_dir + "/bin/%s%s" % (cc_name, exe_ext)] + extra_cflags2, - [stage2_inst_dir + "/bin/%s%s" % (cxx_name, exe_ext)] + extra_cxxflags2, - [stage2_inst_dir + "/bin/%s%s" % (cc_name, exe_ext)] + extra_asmflags, + [stage2_inst_dir + "/bin/%s%s" % + (cc_name, exe_ext)] + extra_cflags2, + [stage2_inst_dir + "/bin/%s%s" % + (cxx_name, exe_ext)] + extra_cxxflags2, + [stage2_inst_dir + "/bin/%s%s" % + (cc_name, exe_ext)] + extra_asmflags, [ld] + extra_ldflags, - ar, - ranlib, - libtool, - llvm_source_dir, - stage3_dir, - package_name, - build_libcxx, - osx_cross_compile, - build_type, - assertions, - python_path, - gcc_dir, - libcxx_include_dir, - build_wasm, - compiler_rt_source_dir, - runtimes_source_link, - compiler_rt_source_link, - (stages == 3), - extra_targets=extra_targets, - ) + ar, ranlib, libtool, + llvm_source_dir, stage3_dir, package_name, build_libcxx, osx_cross_compile, + build_type, assertions, python_path, gcc_dir, libcxx_include_dir, build_wasm, + compiler_rt_source_dir, runtimes_source_link, compiler_rt_source_link, + (stages == 3), extra_targets=extra_targets) if stages >= 4: - stage4_dir = build_dir + "/stage4" - stage4_inst_dir = stage4_dir + "/" + package_name + stage4_dir = build_dir + '/stage4' + stage4_inst_dir = stage4_dir + '/' + package_name final_stage_dir = stage4_dir final_inst_dir = stage4_inst_dir pgo_phase = None if pgo: pgo_phase = "use" llvm_profdata = stage3_inst_dir + "/bin/llvm-profdata%s" % exe_ext - merge_cmd = [llvm_profdata, "merge", "-o", "merged.profdata"] - profraw_files = glob.glob( - os.path.join(stage2_dir, "build", "profiles", "*.profraw") - ) + merge_cmd = [llvm_profdata, 'merge', '-o', 'merged.profdata'] + profraw_files = glob.glob(os.path.join(stage2_dir, 'build', + 'profiles', '*.profraw')) if not os.path.exists(stage4_dir): os.mkdir(stage4_dir) run_in(stage4_dir, merge_cmd + profraw_files) build_one_stage( - [stage3_inst_dir + "/bin/%s%s" % (cc_name, exe_ext)] + extra_cflags2, - [stage3_inst_dir + "/bin/%s%s" % (cxx_name, exe_ext)] + extra_cxxflags2, - [stage3_inst_dir + "/bin/%s%s" % (cc_name, exe_ext)] + extra_asmflags, + [stage3_inst_dir + "/bin/%s%s" % + (cc_name, exe_ext)] + extra_cflags2, + [stage3_inst_dir + "/bin/%s%s" % + (cxx_name, exe_ext)] + extra_cxxflags2, + [stage3_inst_dir + "/bin/%s%s" % + (cc_name, exe_ext)] + extra_asmflags, [ld] + extra_ldflags, - ar, - ranlib, - libtool, - llvm_source_dir, - stage4_dir, - package_name, - build_libcxx, - osx_cross_compile, - build_type, - assertions, - python_path, - gcc_dir, - libcxx_include_dir, - build_wasm, - compiler_rt_source_dir, - runtimes_source_link, - compiler_rt_source_link, - (stages == 4), - extra_targets=extra_targets, - pgo_phase=pgo_phase, - ) + ar, ranlib, libtool, + llvm_source_dir, stage4_dir, package_name, build_libcxx, osx_cross_compile, + build_type, assertions, python_path, gcc_dir, libcxx_include_dir, build_wasm, + compiler_rt_source_dir, runtimes_source_link, compiler_rt_source_link, + (stages == 4), extra_targets=extra_targets, pgo_phase=pgo_phase) if build_clang_tidy: - prune_final_dir_for_clang_tidy( - os.path.join(final_stage_dir, package_name), osx_cross_compile - ) + prune_final_dir_for_clang_tidy(os.path.join(final_stage_dir, package_name), + osx_cross_compile) # Copy the wasm32 builtins to the final_inst_dir if the archive is present. if "wasi-sysroot" in config: sysroot = config["wasi-sysroot"].format(**os.environ) if os.path.isdir(sysroot): for srcdir in glob.glob( - os.path.join(sysroot, "lib", "clang", "*", "lib", "wasi") - ): + os.path.join(sysroot, "lib", "clang", "*", "lib", "wasi")): print("Copying from wasi-sysroot srcdir %s" % srcdir) # Copy the contents of the "lib/wasi" subdirectory to the # appropriate location in final_inst_dir. - version = os.path.basename(os.path.dirname(os.path.dirname(srcdir))) - destdir = os.path.join( - final_inst_dir, "lib", "clang", version, "lib", "wasi" - ) + version = os.path.basename(os.path.dirname(os.path.dirname( + srcdir))) + destdir = os.path.join(final_inst_dir, "lib", "clang", version, + "lib", "wasi") mkdir_p(destdir) copy_tree(srcdir, destdir) diff --git a/build/build-infer/build-infer.py b/build/build-infer/build-infer.py index e9a4804ce08f..9226ed86038f 100755 --- a/build/build-infer/build-infer.py +++ b/build/build-infer/build-infer.py @@ -13,14 +13,14 @@ from functools import reduce def check_run(args, path): - print(" ".join(args) + " in " + path, file=sys.stderr) + print(' '.join(args) + ' in ' + path, file=sys.stderr) subprocess.run(args, cwd=path, check=True) def run_in(path, args, extra_env=None): - """ + ''' Runs the given commands in the directory specified by . - """ + ''' env = dict(os.environ) env.update(extra_env or {}) check_run(args, path) @@ -29,50 +29,43 @@ def run_in(path, args, extra_env=None): def build_tar_package(tar, name, base, directories): name = os.path.realpath(name) - run_in( - base, - [tar, "-c", "-%s" % ("J" if ".xz" in name else "j"), "-f", name] + directories, - ) + run_in(base, [tar, + '-c', + '-%s' % ('J' if '.xz' in name else 'j'), + '-f', + name] + directories) def is_git_repo(dir): - """Check whether the given directory is a git repository.""" + '''Check whether the given directory is a git repository.''' from subprocess import CalledProcessError - try: - check_run(["git", "rev-parse"], dir) + check_run(['git', 'rev-parse'], dir) return True except CalledProcessError: return False def git_clone(main_dir, url, clone_dir, commit): - """ + ''' Clones the repository from into , and brings the repository to the state of . - """ - run_in(main_dir, ["git", "clone", url, clone_dir]) - run_in(clone_dir, ["git", "checkout", commit]) + ''' + run_in(main_dir, ['git', 'clone', url, clone_dir]) + run_in(clone_dir, ['git', 'checkout', commit]) -if __name__ == "__main__": +if __name__ == '__main__': parser = argparse.ArgumentParser() - parser.add_argument( - "-c", - "--config", - required=True, - type=argparse.FileType("r"), - help="Infer configuration file", - ) - parser.add_argument( - "-b", "--base-dir", help="Base directory for code and build artifacts" - ) - parser.add_argument( - "--clean", action="store_true", help="Clean the build directory" - ) - parser.add_argument( - "--skip-tar", action="store_true", help="Skip tar packaging stage" - ) + parser.add_argument('-c', '--config', required=True, + type=argparse.FileType('r'), + help='Infer configuration file') + parser.add_argument('-b', '--base-dir', + help="Base directory for code and build artifacts") + parser.add_argument('--clean', action='store_true', + help='Clean the build directory') + parser.add_argument('--skip-tar', action='store_true', + help='Skip tar packaging stage') args = parser.parse_args() @@ -82,20 +75,20 @@ if __name__ == "__main__": if args.base_dir: base_dir = args.base_dir else: - base_dir = reduce( - os.path.join, [os.sep + "builds", "worker", "workspace", "moz-toolchain"] - ) - infer_dir = os.path.join(base_dir, "infer") - source_dir = os.path.join(infer_dir, "src") - build_dir = os.path.join(infer_dir, "build") + base_dir = reduce(os.path.join, + [os.sep + 'builds', 'worker', + 'workspace', 'moz-toolchain']) + infer_dir = os.path.join(base_dir, 'infer') + source_dir = os.path.join(infer_dir, 'src') + build_dir = os.path.join(infer_dir, 'build') if args.clean: shutil.rmtree(build_dir) os.sys.exit(0) config = json.load(args.config) - infer_revision = config["infer_revision"] - infer_repo = config["infer_repo"] + infer_revision = config['infer_revision'] + infer_repo = config['infer_repo'] for folder in [infer_dir, source_dir, build_dir]: os.makedirs(folder, exist_ok=True) @@ -109,44 +102,31 @@ if __name__ == "__main__": # apply a few patches dir_path = os.path.dirname(os.path.realpath(__file__)) # clean the git directory by reseting all changes - git_commands = [["clean", "-f"], ["reset", "--hard"]] + git_commands = [['clean', '-f'], ['reset', '--hard']] for command in git_commands: - run_in(source_dir, ["git"] + command) - for p in config.get("patches", []): - run_in(source_dir, ["git", "apply", os.path.join(dir_path, p)]) + run_in(source_dir, ['git']+command) + for p in config.get('patches', []): + run_in(source_dir, ['git', 'apply', os.path.join(dir_path, p)]) # configure opam - run_in(source_dir, ["opam", "init", "--no-setup", "--disable-sandboxing"]) + run_in(source_dir, ['opam', 'init', '--no-setup', '--disable-sandboxing']) # build infer - run_in(source_dir, ["./build-infer.sh", "java"], extra_env={"NO_CMAKE_STRIP": "1"}) + run_in(source_dir, ['./build-infer.sh', 'java'], + extra_env={'NO_CMAKE_STRIP': '1'}) - package_name = "infer" + package_name = 'infer' infer_package = os.path.join(os.getcwd(), package_name) # We need to create a package with all of the depended libraries injected in it - run_in( - source_dir, - [ - "make", - "install-with-libs", - "BUILD_MODE=opt", - "PATCHELF=patchelf", - "DESTDIR={}".format(infer_package), - "libdir_relative_to_bindir=../lib", - ], - ) - - infer_package_with_pref = os.path.join(infer_package, "usr") + run_in(source_dir, ['make', 'install-with-libs', 'BUILD_MODE=opt', + 'PATCHELF=patchelf', 'DESTDIR={}'.format(infer_package), + 'libdir_relative_to_bindir=../lib']) + + + infer_package_with_pref = os.path.join(infer_package, 'usr') if not args.skip_tar: - os.rename( - os.path.join(infer_package_with_pref, "local"), - os.path.join(infer_package_with_pref, "infer"), - ) - build_tar_package( - "tar", - "%s.tar.xz" % (package_name), - infer_package_with_pref, - [ - os.path.join("infer", "bin"), - os.path.join("infer", "lib"), - os.path.join("infer", "share"), - ], - ) + os.rename(os.path.join(infer_package_with_pref, 'local'), + os.path.join(infer_package_with_pref, 'infer')) + build_tar_package('tar', '%s.tar.xz' % (package_name), + infer_package_with_pref, + [os.path.join('infer', 'bin'), + os.path.join('infer', 'lib'), + os.path.join('infer', 'share')]) diff --git a/build/buildconfig.py b/build/buildconfig.py index 3fcc82ffdb5d..63f5d590663e 100644 --- a/build/buildconfig.py +++ b/build/buildconfig.py @@ -9,10 +9,10 @@ from mozbuild.backend.configenvironment import PartialConfigEnvironment config = MozbuildObject.from_environment() partial_config = PartialConfigEnvironment(config.topobjdir) -for var in ("topsrcdir", "topobjdir"): +for var in ('topsrcdir', 'topobjdir'): value = getattr(config, var) setattr(sys.modules[__name__], var, value) -for var in ("defines", "substs", "get_dependencies"): +for var in ('defines', 'substs', 'get_dependencies'): value = getattr(partial_config, var) setattr(sys.modules[__name__], var, value) diff --git a/build/checksums.py b/build/checksums.py index d82c7211175f..08524deebd53 100755 --- a/build/checksums.py +++ b/build/checksums.py @@ -10,35 +10,35 @@ import hashlib import logging import os -logger = logging.getLogger("checksums.py") +logger = logging.getLogger('checksums.py') def digest_file(filename, digest, chunk_size=131072): - """Produce a checksum for the file specified by 'filename'. 'filename' + '''Produce a checksum for the file specified by 'filename'. 'filename' is a string path to a file that is opened and read in this function. The checksum algorithm is specified by 'digest' and is a valid OpenSSL algorithm. If the digest used is not valid or Python's hashlib doesn't work, the None object will be returned instead. The size of blocks that this function will read from the file object it opens based on - 'filename' can be specified by 'chunk_size', which defaults to 1K""" - assert not os.path.isdir(filename), "this function only works with files" + 'filename' can be specified by 'chunk_size', which defaults to 1K''' + assert not os.path.isdir(filename), 'this function only works with files' - logger.debug("Creating new %s object" % digest) + logger.debug('Creating new %s object' % digest) h = hashlib.new(digest) - with open(filename, "rb") as f: + with open(filename, 'rb') as f: while True: data = f.read(chunk_size) if not data: - logger.debug("Finished reading in file") + logger.debug('Finished reading in file') break h.update(data) hash = h.hexdigest() - logger.debug("Hash for %s is %s" % (filename, hash)) + logger.debug('Hash for %s is %s' % (filename, hash)) return hash def process_files(dirs, output_filename, digests): - """This function takes a list of directory names, 'drs'. It will then + '''This function takes a list of directory names, 'drs'. It will then compute the checksum for each of the files in these by by opening the files. Once each file is read and its checksum is computed, this function will write the information to the file specified by 'output_filename'. @@ -51,13 +51,14 @@ def process_files(dirs, output_filename, digests): Example: d1fa09ae4220 sha1 14250744 firefox-4.0b6pre.en-US.mac64.dmg - """ + ''' if os.path.exists(output_filename): - logger.debug('Overwriting existing checksums file "%s"' % output_filename) + logger.debug('Overwriting existing checksums file "%s"' % + output_filename) else: logger.debug('Creating a new checksums file "%s"' % output_filename) - with open(output_filename, "w+") as output: + with open(output_filename, 'w+') as output: for d in dirs: for root, dirs, files in os.walk(d): for f in files: @@ -67,21 +68,21 @@ def process_files(dirs, output_filename, digests): for digest in digests: hash = digest_file(full, digest) - output.write( - "%s %s %s %s\n" % (hash, digest, os.path.getsize(full), rel) - ) + output.write('%s %s %s %s\n' % ( + hash, digest, os.path.getsize(full), rel)) def setup_logging(level=logging.DEBUG): - """This function sets up the logging module using a speficiable logging + '''This function sets up the logging module using a speficiable logging module logging level. The default log level is DEBUG. The output is in the format: - Example: - DEBUG - Finished reading in file""" + DEBUG - Finished reading in file +''' - logger = logging.getLogger("checksums.py") + logger = logging.getLogger('checksums.py') logger.setLevel(logging.DEBUG) handler = logging.StreamHandler() handler.setLevel(level) @@ -91,41 +92,19 @@ def setup_logging(level=logging.DEBUG): def main(): - """This is a main function that parses arguments, sets up logging - and generates a checksum file""" + '''This is a main function that parses arguments, sets up logging + and generates a checksum file''' # Parse command line arguments parser = OptionParser() - parser.add_option( - "-d", - "--digest", - help="checksum algorithm to use", - action="append", - dest="digests", - ) - parser.add_option( - "-o", - "--output", - help="output file to use", - action="store", - dest="outfile", - default="checksums", - ) - parser.add_option( - "-v", - "--verbose", - help="Be noisy (takes precedence over quiet)", - action="store_true", - dest="verbose", - default=False, - ) - parser.add_option( - "-q", - "--quiet", - help="Be quiet", - action="store_true", - dest="quiet", - default=False, - ) + parser.add_option('-d', '--digest', help='checksum algorithm to use', + action='append', dest='digests') + parser.add_option('-o', '--output', help='output file to use', + action='store', dest='outfile', default='checksums') + parser.add_option('-v', '--verbose', + help='Be noisy (takes precedence over quiet)', + action='store_true', dest='verbose', default=False) + parser.add_option('-q', '--quiet', help='Be quiet', action='store_true', + dest='quiet', default=False) options, args = parser.parse_args() @@ -142,15 +121,15 @@ def main(): # Validate the digest type to use if not options.digests: - options.digests = ["sha1"] + options.digests = ['sha1'] for i in args: if not os.path.isdir(i): - logger.error("%s is not a directory" % i) + logger.error('%s is not a directory' % i) exit(1) process_files(args, options.outfile, options.digests) -if __name__ == "__main__": +if __name__ == '__main__': main() diff --git a/build/clang-plugin/ThirdPartyPaths.py b/build/clang-plugin/ThirdPartyPaths.py index caaa919d43f2..d004577c1071 100644 --- a/build/clang-plugin/ThirdPartyPaths.py +++ b/build/clang-plugin/ThirdPartyPaths.py @@ -18,13 +18,12 @@ def generate(output, *input_paths): for line in lines: line = line.strip() - if line.endswith("/"): + if line.endswith('/'): line = line[:-1] tpp_list.append(line) - tpp_strings = ",\n ".join([json.dumps(tpp) for tpp in sorted(tpp_list)]) + tpp_strings = ',\n '.join([json.dumps(tpp) for tpp in sorted(tpp_list)]) - output.write( - """\ + output.write("""\ /* THIS FILE IS GENERATED BY ThirdPartyPaths.py - DO NOT EDIT */ #include @@ -35,6 +34,4 @@ const char* MOZ_THIRD_PARTY_PATHS[] = { extern const uint32_t MOZ_THIRD_PARTY_PATHS_COUNT = %d; -""" - % (tpp_strings, len(tpp_list)) - ) +""" % (tpp_strings, len(tpp_list))) diff --git a/build/clang-plugin/ThreadAllows.py b/build/clang-plugin/ThreadAllows.py index e45f62925466..2cf6502ab0ea 100644 --- a/build/clang-plugin/ThreadAllows.py +++ b/build/clang-plugin/ThreadAllows.py @@ -3,19 +3,19 @@ # You can obtain one at http://mozilla.org/MPL/2.0/. import json -FIRST_LINE = "// This file was generated by generate_thread_allows.py. DO NOT EDIT." +FIRST_LINE = '// This file was generated by generate_thread_allows.py. DO NOT EDIT.' def generate_allows(input_paths): """ - This script reads in the ThreadAllows.txt and ThreadFileAllows.txt lists - and generates a header file containing a two arrays of allowed threads. - These can be the following formats: - -Files which the checker should ignore - These files either contain definitions of NS_NewNamedThread or - use args which the plugin can't cast (such as func args). - -Thread names which the checker should ignore - Specifies which individual thread names to ignore. + This script reads in the ThreadAllows.txt and ThreadFileAllows.txt lists + and generates a header file containing a two arrays of allowed threads. + These can be the following formats: + -Files which the checker should ignore + These files either contain definitions of NS_NewNamedThread or + use args which the plugin can't cast (such as func args). + -Thread names which the checker should ignore + Specifies which individual thread names to ignore. """ file_list = [] name_list = [] @@ -27,19 +27,17 @@ def generate_allows(input_paths): for line in sorted(lines): """ - We are assuming lines ending in .cpp, .h are files. Threads should - NOT have names containing filenames. Please don't do that. + We are assuming lines ending in .cpp, .h are files. Threads should + NOT have names containing filenames. Please don't do that. """ line = line.strip() - if line.endswith(".cpp") or line.endswith(".h"): + if line.endswith('.cpp') or line.endswith('.h'): file_list.append(line) else: name_list.append(line) - file_list_s = ",\n ".join(json.dumps(elem) for elem in file_list) - name_list_s = ",\n ".join(json.dumps(elem) for elem in name_list) - output_string = ( - FIRST_LINE - + """ + file_list_s = ',\n '.join(json.dumps(elem) for elem in file_list) + name_list_s = ',\n '.join(json.dumps(elem) for elem in name_list) + output_string = FIRST_LINE + """ static const char *allow_thread_files[] = { %s @@ -49,9 +47,7 @@ static const char *allow_thread_names[] = { %s }; - """ - % (file_list_s, name_list_s) - ) + """ % (file_list_s, name_list_s) return output_string diff --git a/build/clang-plugin/import_mozilla_checks.py b/build/clang-plugin/import_mozilla_checks.py index 2c2c5a42b963..b4a4e002c0a9 100755 --- a/build/clang-plugin/import_mozilla_checks.py +++ b/build/clang-plugin/import_mozilla_checks.py @@ -30,27 +30,22 @@ def copy_dir_contents(src, dest): os.remove(destname) shutil.copy2(f, destname) else: - raise Exception("Directory not copied. Error: %s" % e) + raise Exception('Directory not copied. Error: %s' % e) def write_cmake(module_path, import_options): - names = [" " + os.path.basename(f) for f in glob.glob("%s/*.cpp" % module_path)] + names = [' ' + os.path.basename(f) for f in glob.glob("%s/*.cpp" % module_path)] if import_options["external"]: - names += [ - " " + os.path.join("external", os.path.basename(f)) - for f in glob.glob("%s/external/*.cpp" % (module_path)) - ] + names += [' ' + os.path.join("external", os.path.basename(f)) + for f in glob.glob("%s/external/*.cpp" % (module_path))] if import_options["alpha"]: - names += [ - " " + os.path.join("alpha", os.path.basename(f)) - for f in glob.glob("%s/alpha/*.cpp" % (module_path)) - ] + names += [' ' + os.path.join("alpha", os.path.basename(f)) + for f in glob.glob("%s/alpha/*.cpp" % (module_path))] - with open(os.path.join(module_path, "CMakeLists.txt"), "w") as f: - f.write( - """set(LLVM_LINK_COMPONENTS support) + with open(os.path.join(module_path, 'CMakeLists.txt'), 'w') as f: + f.write("""set(LLVM_LINK_COMPONENTS support) add_definitions( -DCLANG_TIDY ) @@ -67,43 +62,47 @@ add_clang_library(clangTidyMozillaModule clangTidyReadabilityModule clangTidyUtils clangTidyMPIModule - )""" - % {"names": "\n".join(names)} - ) + )""" % {'names': "\n".join(names)}) def add_moz_module(cmake_path): - with open(cmake_path, "r") as f: + with open(cmake_path, 'r') as f: lines = f.readlines() f.close() try: - idx = lines.index("set(ALL_CLANG_TIDY_CHECKS\n") - lines.insert(idx + 1, " clangTidyMozillaModule\n") + idx = lines.index('set(ALL_CLANG_TIDY_CHECKS\n') + lines.insert(idx + 1, ' clangTidyMozillaModule\n') - with open(cmake_path, "w") as f: + with open(cmake_path, 'w') as f: for line in lines: f.write(line) except ValueError: - raise Exception("Unable to find ALL_CLANG_TIDY_CHECKS in {}".format(cmake_path)) + raise Exception('Unable to find ALL_CLANG_TIDY_CHECKS in {}'.format(cmake_path)) def write_third_party_paths(mozilla_path, module_path): - tpp_txt = os.path.join(mozilla_path, "../../tools/rewriting/ThirdPartyPaths.txt") - generated_txt = os.path.join(mozilla_path, "../../tools/rewriting/Generated.txt") - with open(os.path.join(module_path, "ThirdPartyPaths.cpp"), "w") as f: + tpp_txt = os.path.join( + mozilla_path, '../../tools/rewriting/ThirdPartyPaths.txt') + generated_txt = os.path.join( + mozilla_path, '../../tools/rewriting/Generated.txt') + with open(os.path.join(module_path, 'ThirdPartyPaths.cpp'), 'w') as f: ThirdPartyPaths.generate(f, tpp_txt, generated_txt) def generate_thread_allows(mozilla_path, module_path): - names = os.path.join(mozilla_path, "../../build/clang-plugin/ThreadAllows.txt") - files = os.path.join(mozilla_path, "../../build/clang-plugin/ThreadFileAllows.txt") - with open(os.path.join(module_path, "ThreadAllows.h"), "w") as f: + names = os.path.join( + mozilla_path, '../../build/clang-plugin/ThreadAllows.txt' + ) + files = os.path.join( + mozilla_path, '../../build/clang-plugin/ThreadFileAllows.txt' + ) + with open(os.path.join(module_path, 'ThreadAllows.h'), 'w') as f: f.write(ThreadAllows.generate_allows({files, names})) def do_import(mozilla_path, clang_tidy_path, import_options): - module = "mozilla" + module = 'mozilla' module_path = os.path.join(clang_tidy_path, module) try: os.makedirs(module_path) @@ -115,20 +114,18 @@ def do_import(mozilla_path, clang_tidy_path, import_options): write_third_party_paths(mozilla_path, module_path) generate_thread_allows(mozilla_path, module_path) write_cmake(module_path, import_options) - add_moz_module(os.path.join(module_path, "..", "CMakeLists.txt")) - with open(os.path.join(module_path, "..", "CMakeLists.txt"), "a") as f: - f.write("add_subdirectory(%s)\n" % module) + add_moz_module(os.path.join(module_path, '..', 'CMakeLists.txt')) + with open(os.path.join(module_path, '..', 'CMakeLists.txt'), 'a') as f: + f.write('add_subdirectory(%s)\n' % module) # A better place for this would be in `ClangTidyForceLinker.h` but `ClangTidyMain.cpp` # is also OK. - with open(os.path.join(module_path, "..", "tool", "ClangTidyMain.cpp"), "a") as f: - f.write( - """ + with open(os.path.join(module_path, '..', 'tool', 'ClangTidyMain.cpp'), 'a') as f: + f.write(''' // This anchor is used to force the linker to link the MozillaModule. extern volatile int MozillaModuleAnchorSource; static int LLVM_ATTRIBUTE_UNUSED MozillaModuleAnchorDestination = MozillaModuleAnchorSource; -""" - ) +''') def main(): @@ -136,24 +133,18 @@ def main(): parser = argparse.ArgumentParser( usage="import_mozilla_checks.py [option]", - description="Imports the Mozilla static analysis checks into a clang-tidy source tree.", - ) - parser.add_argument( - "mozilla_path", help="Full path to mozilla-central/build/clang-plugin" - ) - parser.add_argument( - "clang_tidy_path", help="Full path to llvm-project/clang-tools-extra/clang-tidy" - ) - parser.add_argument( - "--import-alpha", - help="Enable import of in-tree alpha checks", - action="store_true", - ) - parser.add_argument( - "--import-external", - help="Enable import of in-tree external checks", - action="store_true", + description="Imports the Mozilla static analysis checks into a clang-tidy source tree." ) + parser.add_argument('mozilla_path', + help="Full path to mozilla-central/build/clang-plugin") + parser.add_argument('clang_tidy_path', + help="Full path to llvm-project/clang-tools-extra/clang-tidy") + parser.add_argument('--import-alpha', + help="Enable import of in-tree alpha checks", + action="store_true") + parser.add_argument('--import-external', + help="Enable import of in-tree external checks", + action="store_true") args = parser.parse_args() if not os.path.isdir(args.mozilla_path): @@ -162,10 +153,13 @@ def main(): if not os.path.isdir(args.clang_tidy_path): print("Invalid path to clang-tidy source directory") - import_options = {"alpha": args.import_alpha, "external": args.import_external} + import_options = { + "alpha": args.import_alpha, + "external": args.import_external + } do_import(args.mozilla_path, args.clang_tidy_path, import_options) -if __name__ == "__main__": +if __name__ == '__main__': main() diff --git a/build/clang-plugin/moz.build b/build/clang-plugin/moz.build index 47d780054c99..00e20cc162bc 100644 --- a/build/clang-plugin/moz.build +++ b/build/clang-plugin/moz.build @@ -4,119 +4,111 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -HostSharedLibrary("clang-plugin") +HostSharedLibrary('clang-plugin') -HOST_SOURCES += ["!ThirdPartyPaths.cpp"] +HOST_SOURCES += ['!ThirdPartyPaths.cpp'] HOST_SOURCES += [ - "ArithmeticArgChecker.cpp", - "AssertAssignmentChecker.cpp", - "CanRunScriptChecker.cpp", - "CustomAttributes.cpp", - "CustomTypeAnnotation.cpp", - "DanglingOnTemporaryChecker.cpp", - "DiagnosticsMatcher.cpp", - "ExplicitImplicitChecker.cpp", - "ExplicitOperatorBoolChecker.cpp", - "KungFuDeathGripChecker.cpp", - "MozCheckAction.cpp", - "MustOverrideChecker.cpp", - "MustReturnFromCallerChecker.cpp", - "MustUseChecker.cpp", - "NaNExprChecker.cpp", - "NeedsNoVTableTypeChecker.cpp", - "NoAddRefReleaseOnReturnChecker.cpp", - "NoAutoTypeChecker.cpp", - "NoDuplicateRefCntMemberChecker.cpp", - "NoExplicitMoveConstructorChecker.cpp", - "NoNewThreadsChecker.cpp", - "NonMemMovableMemberChecker.cpp", - "NonMemMovableTemplateArgChecker.cpp", - "NonParamInsideFunctionDeclChecker.cpp", - "NonTrivialTypeInFfiChecker.cpp", - "NoPrincipalGetURI.cpp", - "NoUsingNamespaceMozillaJavaChecker.cpp", - "OverrideBaseCallChecker.cpp", - "OverrideBaseCallUsageChecker.cpp", - "ParamTraitsEnumChecker.cpp", - "RefCountedCopyConstructorChecker.cpp", - "RefCountedInsideLambdaChecker.cpp", - "ScopeChecker.cpp", - "SprintfLiteralChecker.cpp", - "TemporaryLifetimeBoundChecker.cpp", - "TrivialCtorDtorChecker.cpp", - "TrivialDtorChecker.cpp", - "VariableUsageHelpers.cpp", + 'ArithmeticArgChecker.cpp', + 'AssertAssignmentChecker.cpp', + 'CanRunScriptChecker.cpp', + 'CustomAttributes.cpp', + 'CustomTypeAnnotation.cpp', + 'DanglingOnTemporaryChecker.cpp', + 'DiagnosticsMatcher.cpp', + 'ExplicitImplicitChecker.cpp', + 'ExplicitOperatorBoolChecker.cpp', + 'KungFuDeathGripChecker.cpp', + 'MozCheckAction.cpp', + 'MustOverrideChecker.cpp', + 'MustReturnFromCallerChecker.cpp', + 'MustUseChecker.cpp', + 'NaNExprChecker.cpp', + 'NeedsNoVTableTypeChecker.cpp', + 'NoAddRefReleaseOnReturnChecker.cpp', + 'NoAutoTypeChecker.cpp', + 'NoDuplicateRefCntMemberChecker.cpp', + 'NoExplicitMoveConstructorChecker.cpp', + 'NoNewThreadsChecker.cpp', + 'NonMemMovableMemberChecker.cpp', + 'NonMemMovableTemplateArgChecker.cpp', + 'NonParamInsideFunctionDeclChecker.cpp', + 'NonTrivialTypeInFfiChecker.cpp', + 'NoPrincipalGetURI.cpp', + 'NoUsingNamespaceMozillaJavaChecker.cpp', + 'OverrideBaseCallChecker.cpp', + 'OverrideBaseCallUsageChecker.cpp', + 'ParamTraitsEnumChecker.cpp', + 'RefCountedCopyConstructorChecker.cpp', + 'RefCountedInsideLambdaChecker.cpp', + 'ScopeChecker.cpp', + 'SprintfLiteralChecker.cpp', + 'TemporaryLifetimeBoundChecker.cpp', + 'TrivialCtorDtorChecker.cpp', + 'TrivialDtorChecker.cpp', + 'VariableUsageHelpers.cpp', ] # Ideally, we wouldn't have compile-time choices wrt checkes. bug 1617153. -if CONFIG["OS_ARCH"] == "WINNT": - HOST_DEFINES["TARGET_IS_WINDOWS"] = True +if CONFIG['OS_ARCH'] == 'WINNT': + HOST_DEFINES['TARGET_IS_WINDOWS'] = True HOST_SOURCES += [ - "FopenUsageChecker.cpp", - "LoadLibraryUsageChecker.cpp", + 'FopenUsageChecker.cpp', + 'LoadLibraryUsageChecker.cpp', ] -if CONFIG["ENABLE_MOZSEARCH_PLUGIN"]: +if CONFIG['ENABLE_MOZSEARCH_PLUGIN']: HOST_SOURCES += [ - "mozsearch-plugin/FileOperations.cpp", - "mozsearch-plugin/JSONFormatter.cpp", - "mozsearch-plugin/MozsearchIndexer.cpp", - "mozsearch-plugin/StringOperations.cpp", + 'mozsearch-plugin/FileOperations.cpp', + 'mozsearch-plugin/JSONFormatter.cpp', + 'mozsearch-plugin/MozsearchIndexer.cpp', + 'mozsearch-plugin/StringOperations.cpp', ] -GeneratedFile( - "ThirdPartyPaths.cpp", - script="ThirdPartyPaths.py", - entry_point="generate", - inputs=[ - "/tools/rewriting/ThirdPartyPaths.txt", - "/tools/rewriting/Generated.txt", - ], -) - -GeneratedFile( - "ThreadAllows.h", - script="ThreadAllows.py", - entry_point="generate_file", - inputs=[ - "/build/clang-plugin/ThreadAllows.txt", - "/build/clang-plugin/ThreadFileAllows.txt", - ], -) - -HOST_COMPILE_FLAGS["STL"] = [] -HOST_COMPILE_FLAGS["VISIBILITY"] = [] +GeneratedFile('ThirdPartyPaths.cpp', script="ThirdPartyPaths.py", + entry_point="generate", inputs=[ + '/tools/rewriting/ThirdPartyPaths.txt', + '/tools/rewriting/Generated.txt', + ]) + +GeneratedFile('ThreadAllows.h', script="ThreadAllows.py", + entry_point="generate_file", inputs=[ + '/build/clang-plugin/ThreadAllows.txt', + '/build/clang-plugin/ThreadFileAllows.txt' + ]) + +HOST_COMPILE_FLAGS['STL'] = [] +HOST_COMPILE_FLAGS['VISIBILITY'] = [] # libc++ is required to build plugins against clang on OS X. -if CONFIG["HOST_OS_ARCH"] == "Darwin": - HOST_CXXFLAGS += ["-stdlib=libc++"] +if CONFIG['HOST_OS_ARCH'] == 'Darwin': + HOST_CXXFLAGS += ['-stdlib=libc++'] # As of clang 8, llvm-config doesn't output the flags used to build clang # itself, so we don't end up with -fPIC as a side effect. llvm.org/PR8220 -if CONFIG["HOST_OS_ARCH"] != "WINNT": - HOST_CXXFLAGS += ["-fPIC"] +if CONFIG['HOST_OS_ARCH'] != 'WINNT': + HOST_CXXFLAGS += ['-fPIC'] DIRS += [ - "tests", + 'tests', ] -include("external/sources.mozbuild") +include('external/sources.mozbuild') -if CONFIG["ENABLE_CLANG_PLUGIN_ALPHA"]: +if CONFIG['ENABLE_CLANG_PLUGIN_ALPHA']: HOST_DEFINES["MOZ_CLANG_PLUGIN_ALPHA"] = "1" - include("alpha/sources.mozbuild") + include('alpha/sources.mozbuild') # In the current moz.build world, we need to override essentially every # variable to limit ourselves to what we need to build the clang plugin. -if CONFIG["HOST_OS_ARCH"] == "WINNT": - extra_cxxflags = ["-GR-", "-EHsc"] +if CONFIG['HOST_OS_ARCH'] == 'WINNT': + extra_cxxflags = ['-GR-', '-EHsc'] else: - extra_cxxflags = ["-fno-rtti", "-fno-exceptions"] + extra_cxxflags = ['-fno-rtti', '-fno-exceptions'] -if CONFIG["LLVM_CXXFLAGS"]: - HOST_COMPILE_FLAGS["HOST_CXXFLAGS"] = CONFIG["LLVM_CXXFLAGS"] + extra_cxxflags +if CONFIG['LLVM_CXXFLAGS']: + HOST_COMPILE_FLAGS['HOST_CXXFLAGS'] = CONFIG['LLVM_CXXFLAGS'] + extra_cxxflags # Avoid -DDEBUG=1 on the command line, which conflicts with a #define # DEBUG(...) in llvm headers. -DEFINES["DEBUG"] = False +DEFINES['DEBUG'] = False diff --git a/build/clang-plugin/tests/moz.build b/build/clang-plugin/tests/moz.build index f826d74d4569..bb0d533adfd2 100644 --- a/build/clang-plugin/tests/moz.build +++ b/build/clang-plugin/tests/moz.build @@ -5,86 +5,81 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. # dummy library name to avoid skipping building the sources here. -Library("clang-plugin-tests") +Library('clang-plugin-tests') SOURCES += [ - "TestAssertWithAssignment.cpp", - "TestBadImplicitConversionCtor.cpp", - "TestCanRunScript.cpp", - "TestCustomHeap.cpp", - "TestDanglingOnTemporary.cpp", - "TestExplicitOperatorBool.cpp", - "TestGlobalClass.cpp", - "TestHeapClass.cpp", - "TestInheritTypeAnnotationsFromTemplateArgs.cpp", - "TestKungFuDeathGrip.cpp", - "TestMultipleAnnotations.cpp", - "TestMustOverride.cpp", - "TestMustReturnFromCaller.cpp", - "TestMustUse.cpp", - "TestNANTestingExpr.cpp", - "TestNANTestingExprC.c", - "TestNeedsNoVTableType.cpp", - "TestNoAddRefReleaseOnReturn.cpp", - "TestNoArithmeticExprInArgument.cpp", - "TestNoAutoType.cpp", - "TestNoDuplicateRefCntMember.cpp", - "TestNoExplicitMoveConstructor.cpp", - "TestNoNewThreadsChecker.cpp", - "TestNonHeapClass.cpp", - "TestNonMemMovable.cpp", - "TestNonMemMovableStd.cpp", - "TestNonMemMovableStdAtomic.cpp", - "TestNonParameterChecker.cpp", - "TestNonTemporaryClass.cpp", - "TestNonTrivialTypeInFfi.cpp", - "TestNoPrincipalGetUri.cpp", - "TestNoRefcountedInsideLambdas.cpp", - "TestNoUsingNamespaceMozillaJava.cpp", - "TestOverrideBaseCall.cpp", - "TestOverrideBaseCallAnnotation.cpp", - "TestParamTraitsEnum.cpp", - "TestRefCountedCopyConstructor.cpp", - "TestSprintfLiteral.cpp", - "TestStackClass.cpp", - "TestStaticLocalClass.cpp", - "TestTemporaryClass.cpp", - "TestTemporaryLifetimeBound.cpp", - "TestTrivialCtorDtor.cpp", - "TestTrivialDtor.cpp", + 'TestAssertWithAssignment.cpp', + 'TestBadImplicitConversionCtor.cpp', + 'TestCanRunScript.cpp', + 'TestCustomHeap.cpp', + 'TestDanglingOnTemporary.cpp', + 'TestExplicitOperatorBool.cpp', + 'TestGlobalClass.cpp', + 'TestHeapClass.cpp', + 'TestInheritTypeAnnotationsFromTemplateArgs.cpp', + 'TestKungFuDeathGrip.cpp', + 'TestMultipleAnnotations.cpp', + 'TestMustOverride.cpp', + 'TestMustReturnFromCaller.cpp', + 'TestMustUse.cpp', + 'TestNANTestingExpr.cpp', + 'TestNANTestingExprC.c', + 'TestNeedsNoVTableType.cpp', + 'TestNoAddRefReleaseOnReturn.cpp', + 'TestNoArithmeticExprInArgument.cpp', + 'TestNoAutoType.cpp', + 'TestNoDuplicateRefCntMember.cpp', + 'TestNoExplicitMoveConstructor.cpp', + 'TestNoNewThreadsChecker.cpp', + 'TestNonHeapClass.cpp', + 'TestNonMemMovable.cpp', + 'TestNonMemMovableStd.cpp', + 'TestNonMemMovableStdAtomic.cpp', + 'TestNonParameterChecker.cpp', + 'TestNonTemporaryClass.cpp', + 'TestNonTrivialTypeInFfi.cpp', + 'TestNoPrincipalGetUri.cpp', + 'TestNoRefcountedInsideLambdas.cpp', + 'TestNoUsingNamespaceMozillaJava.cpp', + 'TestOverrideBaseCall.cpp', + 'TestOverrideBaseCallAnnotation.cpp', + 'TestParamTraitsEnum.cpp', + 'TestRefCountedCopyConstructor.cpp', + 'TestSprintfLiteral.cpp', + 'TestStackClass.cpp', + 'TestStaticLocalClass.cpp', + 'TestTemporaryClass.cpp', + 'TestTemporaryLifetimeBound.cpp', + 'TestTrivialCtorDtor.cpp', + 'TestTrivialDtor.cpp', ] -if CONFIG["OS_ARCH"] == "WINNT": +if CONFIG['OS_ARCH'] == 'WINNT': SOURCES += [ - "TestFopenUsage.cpp", - "TestLoadLibraryUsage.cpp", + 'TestFopenUsage.cpp', + 'TestLoadLibraryUsage.cpp', ] -include("../external/tests/sources.mozbuild") +include('../external/tests/sources.mozbuild') -if CONFIG["ENABLE_CLANG_PLUGIN_ALPHA"]: +if CONFIG['ENABLE_CLANG_PLUGIN_ALPHA']: DEFINES["MOZ_CLANG_PLUGIN_ALPHA"] = "1" - include("../alpha/tests/sources.mozbuild") + include('../alpha/tests/sources.mozbuild') DisableStlWrapping() NoVisibilityFlags() # Build without any warning flags, and with clang verify flag for a # syntax-only build (no codegen), without a limit on the number of errors. -COMPILE_FLAGS["OS_CXXFLAGS"] = [ - f for f in COMPILE_FLAGS.get("OS_CXXFLAGS", []) if not f.startswith("-W") -] + ["-fsyntax-only", "-Xclang", "-verify", "-ferror-limit=0", "-Wno-invalid-noreturn"] -COMPILE_FLAGS["OS_CFLAGS"] = [ - f for f in COMPILE_FLAGS.get("OS_CFLAGS", []) if not f.startswith("-W") -] + [ - "-fsyntax-only", - "-Xclang", - "-verify", - "-ferror-limit=0", - "-Xclang", - "-std=c11", - "-Wno-invalid-noreturn", -] +COMPILE_FLAGS['OS_CXXFLAGS'] = ( + [f for f in COMPILE_FLAGS.get('OS_CXXFLAGS', []) if not f.startswith('-W')] + + ['-fsyntax-only', '-Xclang', '-verify', '-ferror-limit=0', '-Wno-invalid-noreturn'] +) +COMPILE_FLAGS['OS_CFLAGS'] = ( + [f for f in COMPILE_FLAGS.get('OS_CFLAGS', []) if not f.startswith('-W')] + + ['-fsyntax-only', '-Xclang', '-verify', '-ferror-limit=0', '-Xclang', '-std=c11', + '-Wno-invalid-noreturn'] +) # Don't reflect WARNINGS_CFLAGS into CFLAGS, as the warnings flags should be # as specified in OS_CFLAGS above. diff --git a/build/compare-mozconfig/compare-mozconfigs.py b/build/compare-mozconfig/compare-mozconfigs.py index 7e39d9c071c5..396d196d5709 100644 --- a/build/compare-mozconfig/compare-mozconfigs.py +++ b/build/compare-mozconfig/compare-mozconfigs.py @@ -19,12 +19,12 @@ FAILURE_CODE = 1 SUCCESS_CODE = 0 PLATFORMS = ( - "linux32", - "linux64", - "macosx64", - "win32", - "win64", - "win64-aarch64", + 'linux32', + 'linux64', + 'macosx64', + 'win32', + 'win64', + 'win64-aarch64', ) log = logging.getLogger(__name__) @@ -37,12 +37,11 @@ class ConfigError(Exception): def readConfig(configfile): c = {} execfile(configfile, c) - return c["whitelist"] + return c['whitelist'] -def verify_mozconfigs( - mozconfig_pair, nightly_mozconfig_pair, platform, mozconfigWhitelist -): +def verify_mozconfigs(mozconfig_pair, nightly_mozconfig_pair, platform, + mozconfigWhitelist): """Compares mozconfig to nightly_mozconfig and compare to an optional whitelist of known differences. mozconfig_pair and nightly_mozconfig_pair are pairs containing the mozconfig's identifier and the list of lines in @@ -60,64 +59,61 @@ def verify_mozconfigs( success = True diff_instance = difflib.Differ() - diff_result = diff_instance.compare(mozconfig_lines, nightly_mozconfig_lines) + diff_result = diff_instance.compare( + mozconfig_lines, nightly_mozconfig_lines) diff_list = list(diff_result) for line in diff_list: clean_line = line[1:].strip() - if (line[0] == "-" or line[0] == "+") and len(clean_line) > 1: + if (line[0] == '-' or line[0] == '+') and len(clean_line) > 1: # skip comment lines - if clean_line.startswith("#"): + if clean_line.startswith('#'): continue # compare to whitelist message = "" - if line[0] == "-": + if line[0] == '-': # handle lines that move around in diff - if "+" + line[1:] in diff_list: + if '+' + line[1:] in diff_list: continue - if platform in mozconfigWhitelist.get("release", {}): - if clean_line in mozconfigWhitelist["release"][platform]: + if platform in mozconfigWhitelist.get('release', {}): + if clean_line in \ + mozconfigWhitelist['release'][platform]: continue - elif line[0] == "+": - if "-" + line[1:] in diff_list: + elif line[0] == '+': + if '-' + line[1:] in diff_list: continue - if platform in mozconfigWhitelist.get("nightly", {}): - if clean_line in mozconfigWhitelist["nightly"][platform]: + if platform in mozconfigWhitelist.get('nightly', {}): + if clean_line in \ + mozconfigWhitelist['nightly'][platform]: continue else: - log.warning( - "%s not in %s %s!" - % ( - clean_line, - platform, - mozconfigWhitelist["nightly"][platform], - ) - ) + log.warning("%s not in %s %s!" % ( + clean_line, platform, + mozconfigWhitelist['nightly'][platform])) else: log.error("Skipping line %s!" % line) continue message = "found in %s but not in %s: %s" - if line[0] == "-": - log.error( - message % (mozconfig_name, nightly_mozconfig_name, clean_line) - ) + if line[0] == '-': + log.error(message % (mozconfig_name, + nightly_mozconfig_name, clean_line)) else: - log.error( - message % (nightly_mozconfig_name, mozconfig_name, clean_line) - ) + log.error(message % (nightly_mozconfig_name, + mozconfig_name, clean_line)) success = False return success def get_mozconfig(path): """Consumes a path and returns a list of lines from the mozconfig file.""" - with open(path, "rb") as fh: + with open(path, 'rb') as fh: return fh.readlines() def compare(topsrcdir): - app = os.path.join(topsrcdir, "browser") - whitelist = readConfig(os.path.join(app, "config", "mozconfigs", "whitelist")) + app = os.path.join(topsrcdir, 'browser') + whitelist = readConfig(os.path.join(app, 'config', 'mozconfigs', + 'whitelist')) success = True @@ -125,13 +121,13 @@ def compare(topsrcdir): return {l.strip() for l in lines} for platform in PLATFORMS: - log.info("Comparing platform %s" % platform) + log.info('Comparing platform %s' % platform) - mozconfigs_path = os.path.join(app, "config", "mozconfigs", platform) + mozconfigs_path = os.path.join(app, 'config', 'mozconfigs', platform) - nightly_path = os.path.join(mozconfigs_path, "nightly") - beta_path = os.path.join(mozconfigs_path, "beta") - release_path = os.path.join(mozconfigs_path, "release") + nightly_path = os.path.join(mozconfigs_path, 'nightly') + beta_path = os.path.join(mozconfigs_path, 'beta') + release_path = os.path.join(mozconfigs_path, 'release') nightly_lines = get_mozconfig(nightly_path) beta_lines = get_mozconfig(beta_path) @@ -139,28 +135,28 @@ def compare(topsrcdir): # Validate that entries in whitelist['nightly'][platform] are actually # present. - whitelist_normalized = normalize_lines(whitelist["nightly"].get(platform, [])) + whitelist_normalized = normalize_lines( + whitelist['nightly'].get(platform, [])) nightly_normalized = normalize_lines(nightly_lines) for line in sorted(whitelist_normalized - nightly_normalized): - log.error("extra line in nightly whitelist: %s" % line) + log.error('extra line in nightly whitelist: %s' % line) success = False - log.info("Comparing beta and nightly mozconfigs") - passed = verify_mozconfigs( - (beta_path, beta_lines), (nightly_path, nightly_lines), platform, whitelist - ) + log.info('Comparing beta and nightly mozconfigs') + passed = verify_mozconfigs((beta_path, beta_lines), + (nightly_path, nightly_lines), + platform, + whitelist) if not passed: success = False - log.info("Comparing release and nightly mozconfigs") - passed = verify_mozconfigs( - (release_path, release_lines), - (nightly_path, nightly_lines), - platform, - whitelist, - ) + log.info('Comparing release and nightly mozconfigs') + passed = verify_mozconfigs((release_path, release_lines), + (nightly_path, nightly_lines), + platform, + whitelist) if not passed: success = False @@ -169,10 +165,10 @@ def compare(topsrcdir): class TestCompareMozconfigs(unittest.TestCase): def test_compare_mozconfigs(self): - topsrcdir = buildconfig.substs["top_srcdir"] + topsrcdir = buildconfig.substs['top_srcdir'] self.assertTrue(compare(topsrcdir)) -if __name__ == "__main__": +if __name__ == '__main__': logging.basicConfig(level=logging.INFO) mozunit.main() diff --git a/build/gen_symverscript.py b/build/gen_symverscript.py index f32554abc800..677eea754c0c 100644 --- a/build/gen_symverscript.py +++ b/build/gen_symverscript.py @@ -10,14 +10,12 @@ from mozbuild.preprocessor import Preprocessor def main(output, input_file, version): pp = Preprocessor() - pp.context.update( - { - "VERSION": version, - } - ) + pp.context.update({ + 'VERSION': version, + }) pp.out = output pp.do_include(input_file) -if __name__ == "__main__": +if __name__ == '__main__': main(*sys.agv[1:]) diff --git a/build/gen_test_packages_manifest.py b/build/gen_test_packages_manifest.py index b6f2353684b9..75f8ee998222 100644 --- a/build/gen_test_packages_manifest.py +++ b/build/gen_test_packages_manifest.py @@ -9,88 +9,68 @@ import json from argparse import ArgumentParser ALL_HARNESSES = [ - "common", # Harnesses without a specific package will look here. - "condprof", - "mochitest", - "reftest", - "xpcshell", - "cppunittest", - "jittest", - "mozbase", - "web-platform", - "talos", - "raptor", - "awsy", - "gtest", - "updater-dep", - "jsreftest", - "perftests", + 'common', # Harnesses without a specific package will look here. + 'condprof', + 'mochitest', + 'reftest', + 'xpcshell', + 'cppunittest', + 'jittest', + 'mozbase', + 'web-platform', + 'talos', + 'raptor', + 'awsy', + 'gtest', + 'updater-dep', + 'jsreftest', + 'perftests', ] PACKAGE_SPECIFIED_HARNESSES = [ - "condprof", - "cppunittest", - "mochitest", - "reftest", - "xpcshell", - "web-platform", - "talos", - "raptor", - "awsy", - "updater-dep", - "jittest", - "jsreftest", - "perftests", + 'condprof', + 'cppunittest', + 'mochitest', + 'reftest', + 'xpcshell', + 'web-platform', + 'talos', + 'raptor', + 'awsy', + 'updater-dep', + 'jittest', + 'jsreftest', + 'perftests', ] # These packages are not present for every build configuration. OPTIONAL_PACKAGES = [ - "gtest", + 'gtest', ] def parse_args(): parser = ArgumentParser( description="Generate a test_packages.json file to tell automation which harnesses " - "require which test packages." - ) - parser.add_argument( - "--common", - required=True, - action="store", - dest="tests_common", - help='Name of the "common" archive, a package to be used by all ' "harnesses.", - ) - parser.add_argument( - "--jsshell", - required=True, - action="store", - dest="jsshell", - help="Name of the jsshell zip.", - ) + "require which test packages.") + parser.add_argument("--common", required=True, + action="store", dest="tests_common", + help="Name of the \"common\" archive, a package to be used by all " + "harnesses.") + parser.add_argument("--jsshell", required=True, + action="store", dest="jsshell", + help="Name of the jsshell zip.") for harness in PACKAGE_SPECIFIED_HARNESSES: - parser.add_argument( - "--%s" % harness, - required=True, - action="store", - dest=harness, - help="Name of the %s zip." % harness, - ) + parser.add_argument("--%s" % harness, required=True, + action="store", dest=harness, + help="Name of the %s zip." % harness) for harness in OPTIONAL_PACKAGES: - parser.add_argument( - "--%s" % harness, - required=False, - action="store", - dest=harness, - help="Name of the %s zip." % harness, - ) - parser.add_argument( - "--dest-file", - required=True, - action="store", - dest="destfile", - help="Path to the output file to be written.", - ) + parser.add_argument("--%s" % harness, required=False, + action="store", dest=harness, + help="Name of the %s zip." % harness) + parser.add_argument("--dest-file", required=True, + action="store", dest="destfile", + help="Path to the output file to be written.") return parser.parse_args() @@ -105,8 +85,8 @@ def generate_package_data(args): jsshell = args.jsshell harness_requirements = dict([(k, [tests_common]) for k in ALL_HARNESSES]) - harness_requirements["jittest"].append(jsshell) - harness_requirements["jsreftest"].append(args.reftest) + harness_requirements['jittest'].append(jsshell) + harness_requirements['jsreftest'].append(args.reftest) for harness in PACKAGE_SPECIFIED_HARNESSES + OPTIONAL_PACKAGES: pkg_name = getattr(args, harness, None) if pkg_name is None: @@ -115,8 +95,8 @@ def generate_package_data(args): return harness_requirements -if __name__ == "__main__": +if __name__ == '__main__': args = parse_args() packages_data = generate_package_data(args) - with open(args.destfile, "w") as of: + with open(args.destfile, 'w') as of: json.dump(packages_data, of, indent=4) diff --git a/build/mach_bootstrap.py b/build/mach_bootstrap.py index ce193f6c5530..d92958a5fdce 100644 --- a/build/mach_bootstrap.py +++ b/build/mach_bootstrap.py @@ -21,7 +21,7 @@ else: from types import ModuleType -STATE_DIR_FIRST_RUN = """ +STATE_DIR_FIRST_RUN = ''' mach and the build system store shared state in a common directory on the filesystem. The following directory will be created: @@ -33,142 +33,142 @@ use and re-run mach. For this change to take effect forever, you'll likely want to export this environment variable from your shell's init scripts. Press ENTER/RETURN to continue or CTRL+c to abort. -""".lstrip() +'''.lstrip() # Individual files providing mach commands. MACH_MODULES = [ - "build/valgrind/mach_commands.py", - "devtools/shared/css/generated/mach_commands.py", - "dom/bindings/mach_commands.py", - "js/src/devtools/rootAnalysis/mach_commands.py", - "layout/tools/reftest/mach_commands.py", - "mobile/android/mach_commands.py", - "python/mach/mach/commands/commandinfo.py", - "python/mach/mach/commands/settings.py", - "python/mach_commands.py", - "python/mozboot/mozboot/mach_commands.py", - "python/mozbuild/mozbuild/artifact_commands.py", - "python/mozbuild/mozbuild/backend/mach_commands.py", - "python/mozbuild/mozbuild/build_commands.py", - "python/mozbuild/mozbuild/code_analysis/mach_commands.py", - "python/mozbuild/mozbuild/compilation/codecomplete.py", - "python/mozbuild/mozbuild/frontend/mach_commands.py", - "python/mozbuild/mozbuild/vendor/mach_commands.py", - "python/mozbuild/mozbuild/mach_commands.py", - "python/mozperftest/mozperftest/mach_commands.py", - "python/mozrelease/mozrelease/mach_commands.py", - "remote/mach_commands.py", - "taskcluster/mach_commands.py", - "testing/awsy/mach_commands.py", - "testing/condprofile/mach_commands.py", - "testing/firefox-ui/mach_commands.py", - "testing/geckodriver/mach_commands.py", - "testing/mach_commands.py", - "testing/marionette/mach_commands.py", - "testing/mochitest/mach_commands.py", - "testing/mozharness/mach_commands.py", - "testing/raptor/mach_commands.py", - "testing/talos/mach_commands.py", - "testing/tps/mach_commands.py", - "testing/web-platform/mach_commands.py", - "testing/xpcshell/mach_commands.py", - "toolkit/components/telemetry/tests/marionette/mach_commands.py", - "tools/browsertime/mach_commands.py", - "tools/compare-locales/mach_commands.py", - "tools/lint/mach_commands.py", - "tools/mach_commands.py", - "tools/moztreedocs/mach_commands.py", - "tools/phabricator/mach_commands.py", - "tools/power/mach_commands.py", - "tools/tryselect/mach_commands.py", - "tools/vcs/mach_commands.py", + 'build/valgrind/mach_commands.py', + 'devtools/shared/css/generated/mach_commands.py', + 'dom/bindings/mach_commands.py', + 'js/src/devtools/rootAnalysis/mach_commands.py', + 'layout/tools/reftest/mach_commands.py', + 'mobile/android/mach_commands.py', + 'python/mach/mach/commands/commandinfo.py', + 'python/mach/mach/commands/settings.py', + 'python/mach_commands.py', + 'python/mozboot/mozboot/mach_commands.py', + 'python/mozbuild/mozbuild/artifact_commands.py', + 'python/mozbuild/mozbuild/backend/mach_commands.py', + 'python/mozbuild/mozbuild/build_commands.py', + 'python/mozbuild/mozbuild/code_analysis/mach_commands.py', + 'python/mozbuild/mozbuild/compilation/codecomplete.py', + 'python/mozbuild/mozbuild/frontend/mach_commands.py', + 'python/mozbuild/mozbuild/vendor/mach_commands.py', + 'python/mozbuild/mozbuild/mach_commands.py', + 'python/mozperftest/mozperftest/mach_commands.py', + 'python/mozrelease/mozrelease/mach_commands.py', + 'remote/mach_commands.py', + 'taskcluster/mach_commands.py', + 'testing/awsy/mach_commands.py', + 'testing/condprofile/mach_commands.py', + 'testing/firefox-ui/mach_commands.py', + 'testing/geckodriver/mach_commands.py', + 'testing/mach_commands.py', + 'testing/marionette/mach_commands.py', + 'testing/mochitest/mach_commands.py', + 'testing/mozharness/mach_commands.py', + 'testing/raptor/mach_commands.py', + 'testing/talos/mach_commands.py', + 'testing/tps/mach_commands.py', + 'testing/web-platform/mach_commands.py', + 'testing/xpcshell/mach_commands.py', + 'toolkit/components/telemetry/tests/marionette/mach_commands.py', + 'tools/browsertime/mach_commands.py', + 'tools/compare-locales/mach_commands.py', + 'tools/lint/mach_commands.py', + 'tools/mach_commands.py', + 'tools/moztreedocs/mach_commands.py', + 'tools/phabricator/mach_commands.py', + 'tools/power/mach_commands.py', + 'tools/tryselect/mach_commands.py', + 'tools/vcs/mach_commands.py', ] CATEGORIES = { - "build": { - "short": "Build Commands", - "long": "Interact with the build system", - "priority": 80, + 'build': { + 'short': 'Build Commands', + 'long': 'Interact with the build system', + 'priority': 80, }, - "post-build": { - "short": "Post-build Commands", - "long": "Common actions performed after completing a build.", - "priority": 70, + 'post-build': { + 'short': 'Post-build Commands', + 'long': 'Common actions performed after completing a build.', + 'priority': 70, }, - "testing": { - "short": "Testing", - "long": "Run tests.", - "priority": 60, + 'testing': { + 'short': 'Testing', + 'long': 'Run tests.', + 'priority': 60, }, - "ci": { - "short": "CI", - "long": "Taskcluster commands", - "priority": 59, + 'ci': { + 'short': 'CI', + 'long': 'Taskcluster commands', + 'priority': 59, }, - "devenv": { - "short": "Development Environment", - "long": "Set up and configure your development environment.", - "priority": 50, + 'devenv': { + 'short': 'Development Environment', + 'long': 'Set up and configure your development environment.', + 'priority': 50, }, - "build-dev": { - "short": "Low-level Build System Interaction", - "long": "Interact with specific parts of the build system.", - "priority": 20, + 'build-dev': { + 'short': 'Low-level Build System Interaction', + 'long': 'Interact with specific parts of the build system.', + 'priority': 20, }, - "misc": { - "short": "Potpourri", - "long": "Potent potables and assorted snacks.", - "priority": 10, + 'misc': { + 'short': 'Potpourri', + 'long': 'Potent potables and assorted snacks.', + 'priority': 10, }, - "release": { - "short": "Release automation", - "long": "Commands for used in release automation.", - "priority": 5, + 'release': { + 'short': 'Release automation', + 'long': 'Commands for used in release automation.', + 'priority': 5, }, - "disabled": { - "short": "Disabled", - "long": "The disabled commands are hidden by default. Use -v to display them. " - "These commands are unavailable for your current context, " + 'disabled': { + 'short': 'Disabled', + 'long': 'The disabled commands are hidden by default. Use -v to display them. ' + 'These commands are unavailable for your current context, ' 'run "mach " to see why.', - "priority": 0, + 'priority': 0, }, } def search_path(mozilla_dir, packages_txt): with open(os.path.join(mozilla_dir, packages_txt)) as f: - packages = [line.rstrip().split(":") for line in f] + packages = [line.rstrip().split(':') for line in f] def handle_package(package): - if package[0] == "optional": + if package[0] == 'optional': try: for path in handle_package(package[1:]): yield path except Exception: pass - if package[0] in ("windows", "!windows"): - for_win = not package[0].startswith("!") - is_win = sys.platform == "win32" + if package[0] in ('windows', '!windows'): + for_win = not package[0].startswith('!') + is_win = sys.platform == 'win32' if is_win == for_win: for path in handle_package(package[1:]): yield path - if package[0] in ("python2", "python3"): - for_python3 = package[0].endswith("3") + if package[0] in ('python2', 'python3'): + for_python3 = package[0].endswith('3') is_python3 = sys.version_info[0] > 2 if is_python3 == for_python3: for path in handle_package(package[1:]): yield path - if package[0] == "packages.txt": + if package[0] == 'packages.txt': assert len(package) == 2 for p in search_path(mozilla_dir, package[1]): yield os.path.join(mozilla_dir, p) - if package[0].endswith(".pth"): + if package[0].endswith('.pth'): assert len(package) == 2 yield os.path.join(mozilla_dir, package[1]) @@ -186,8 +186,8 @@ def bootstrap(topsrcdir, mozilla_dir=None): # on module import. major, minor = sys.version_info[:2] if (major == 2 and minor < 7) or (major == 3 and minor < 5): - print("Python 2.7 or Python 3.5+ is required to run mach.") - print("You are running Python", platform.python_version()) + print('Python 2.7 or Python 3.5+ is required to run mach.') + print('You are running Python', platform.python_version()) sys.exit(1) # Global build system and mach state is stored in a central directory. By @@ -200,8 +200,8 @@ def bootstrap(topsrcdir, mozilla_dir=None): # like surprises. sys.path[0:0] = [ os.path.join(mozilla_dir, path) - for path in search_path(mozilla_dir, "build/mach_virtualenv_packages.txt") - ] + for path in search_path(mozilla_dir, + 'build/mach_virtualenv_packages.txt')] import mach.base import mach.main from mach.util import setenv @@ -227,13 +227,12 @@ def bootstrap(topsrcdir, mozilla_dir=None): # This code mimics the code in taskcluster/scripts/run-task. try: import resource - # Keep the hard limit the same, though, allowing processes to change # their soft limit if they need to (Firefox does, for instance). (soft, hard) = resource.getrlimit(resource.RLIMIT_NOFILE) # Permit people to override our default limit if necessary via # MOZ_LIMIT_NOFILE, which is the same variable `run-task` uses. - limit = os.environ.get("MOZ_LIMIT_NOFILE") + limit = os.environ.get('MOZ_LIMIT_NOFILE') if limit: limit = int(limit) else: @@ -249,7 +248,6 @@ def bootstrap(topsrcdir, mozilla_dir=None): pass from mozbuild.util import patch_main - patch_main() def resolve_repository(): @@ -260,7 +258,8 @@ def bootstrap(topsrcdir, mozilla_dir=None): # If we ever need to use the VCS binary here, consider something # more robust. return mozversioncontrol.get_repository_object(path=mozilla_dir) - except (mozversioncontrol.InvalidRepoPath, mozversioncontrol.MissingVCSTool): + except (mozversioncontrol.InvalidRepoPath, + mozversioncontrol.MissingVCSTool): return None def pre_dispatch_handler(context, handler, args): @@ -268,30 +267,25 @@ def bootstrap(topsrcdir, mozilla_dir=None): # the build, tests will be disabled. Instead of trying to run # nonexistent tests then reporting a failure, this will prevent mach # from progressing beyond this point. - if handler.category == "testing" and not handler.ok_if_tests_disabled: + if handler.category == 'testing' and not handler.ok_if_tests_disabled: from mozbuild.base import BuildEnvironmentNotFoundException - try: from mozbuild.base import MozbuildObject - # all environments should have an instance of build object. build = MozbuildObject.from_environment() - if build is not None and hasattr(build, "mozconfig"): - ac_options = build.mozconfig["configure_args"] - if ac_options and "--disable-tests" in ac_options: - print( - "Tests have been disabled by mozconfig with the flag " - + '"ac_add_options --disable-tests".\n' - + "Remove the flag, and re-compile to enable tests." - ) + if build is not None and hasattr(build, 'mozconfig'): + ac_options = build.mozconfig['configure_args'] + if ac_options and '--disable-tests' in ac_options: + print('Tests have been disabled by mozconfig with the flag ' + + '"ac_add_options --disable-tests".\n' + + 'Remove the flag, and re-compile to enable tests.') sys.exit(1) except BuildEnvironmentNotFoundException: # likely automation environment, so do nothing. pass - def post_dispatch_handler( - context, handler, instance, success, start_time, end_time, depth, args - ): + def post_dispatch_handler(context, handler, instance, success, + start_time, end_time, depth, args): """Perform global operations after command dispatch. @@ -303,60 +297,56 @@ def bootstrap(topsrcdir, mozilla_dir=None): if depth != 1: return - _finalize_telemetry_glean( - context.telemetry, handler.name == "bootstrap", success - ) - _finalize_telemetry_legacy( - context, instance, handler, success, start_time, end_time, topsrcdir - ) + _finalize_telemetry_glean(context.telemetry, handler.name == 'bootstrap', + success) + _finalize_telemetry_legacy(context, instance, handler, success, start_time, + end_time, topsrcdir) def populate_context(key=None): if key is None: return - if key == "state_dir": + if key == 'state_dir': state_dir = get_state_dir() - if state_dir == os.environ.get("MOZBUILD_STATE_PATH"): + if state_dir == os.environ.get('MOZBUILD_STATE_PATH'): if not os.path.exists(state_dir): - print( - "Creating global state directory from environment variable: %s" - % state_dir - ) + print('Creating global state directory from environment variable: %s' + % state_dir) os.makedirs(state_dir, mode=0o770) else: if not os.path.exists(state_dir): - if not os.environ.get("MOZ_AUTOMATION"): + if not os.environ.get('MOZ_AUTOMATION'): print(STATE_DIR_FIRST_RUN.format(userdir=state_dir)) try: sys.stdin.readline() except KeyboardInterrupt: sys.exit(1) - print("\nCreating default state directory: %s" % state_dir) + print('\nCreating default state directory: %s' % state_dir) os.makedirs(state_dir, mode=0o770) return state_dir - if key == "local_state_dir": + if key == 'local_state_dir': return get_state_dir(srcdir=True) - if key == "topdir": + if key == 'topdir': return topsrcdir - if key == "pre_dispatch_handler": + if key == 'pre_dispatch_handler': return pre_dispatch_handler - if key == "post_dispatch_handler": + if key == 'post_dispatch_handler': return post_dispatch_handler - if key == "repository": + if key == 'repository': return resolve_repository() raise AttributeError(key) # Note which process is top-level so that recursive mach invocations can avoid writing # telemetry data. - if "MACH_MAIN_PID" not in os.environ: - setenv("MACH_MAIN_PID", str(os.getpid())) + if 'MACH_MAIN_PID' not in os.environ: + setenv('MACH_MAIN_PID', str(os.getpid())) driver = mach.main.Mach(os.getcwd()) driver.populate_context_handler = populate_context @@ -368,7 +358,8 @@ def bootstrap(topsrcdir, mozilla_dir=None): driver.settings_paths.append(mozilla_dir) for category, meta in CATEGORIES.items(): - driver.define_category(category, meta["short"], meta["long"], meta["priority"]) + driver.define_category(category, meta['short'], meta['long'], + meta['priority']) repo = resolve_repository() @@ -384,9 +375,8 @@ def bootstrap(topsrcdir, mozilla_dir=None): return driver -def _finalize_telemetry_legacy( - context, instance, handler, success, start_time, end_time, topsrcdir -): +def _finalize_telemetry_legacy(context, instance, handler, success, start_time, + end_time, topsrcdir): """Record and submit legacy telemetry. Parameterized by the raw gathered telemetry, this function handles persisting and @@ -398,80 +388,66 @@ def _finalize_telemetry_legacy( from mozboot.util import get_state_dir from mozbuild.base import MozbuildObject from mozbuild.telemetry import gather_telemetry - from mach.telemetry import is_telemetry_enabled, is_applicable_telemetry_environment + from mach.telemetry import ( + is_telemetry_enabled, + is_applicable_telemetry_environment + ) - if not ( - is_applicable_telemetry_environment() and is_telemetry_enabled(context.settings) - ): + if not (is_applicable_telemetry_environment() + and is_telemetry_enabled(context.settings)): return if not isinstance(instance, MozbuildObject): instance = MozbuildObject.from_environment() - command_attrs = getattr(context, "command_attrs", {}) + command_attrs = getattr(context, 'command_attrs', {}) # We gather telemetry for every operation. - data = gather_telemetry( - command=handler.name, - success=success, - start_time=start_time, - end_time=end_time, - mach_context=context, - instance=instance, - command_attrs=command_attrs, - ) + data = gather_telemetry(command=handler.name, success=success, + start_time=start_time, end_time=end_time, + mach_context=context, instance=instance, + command_attrs=command_attrs) if data: - telemetry_dir = os.path.join(get_state_dir(), "telemetry") + telemetry_dir = os.path.join(get_state_dir(), 'telemetry') try: os.mkdir(telemetry_dir) except OSError as e: if e.errno != errno.EEXIST: raise - outgoing_dir = os.path.join(telemetry_dir, "outgoing") + outgoing_dir = os.path.join(telemetry_dir, 'outgoing') try: os.mkdir(outgoing_dir) except OSError as e: if e.errno != errno.EEXIST: raise - with open(os.path.join(outgoing_dir, str(uuid.uuid4()) + ".json"), "w") as f: + with open(os.path.join(outgoing_dir, str(uuid.uuid4()) + '.json'), + 'w') as f: json.dump(data, f, sort_keys=True) # The user is performing a maintenance command, skip the upload - if handler.name in ( - "bootstrap", - "doctor", - "mach-commands", - "vcs-setup", - "create-mach-environment", - "install-moz-phab", - # We call mach environment in client.mk which would cause the - # data submission to block the forward progress of make. - "environment", - ): + if handler.name in ('bootstrap', 'doctor', 'mach-commands', 'vcs-setup', + 'create-mach-environment', 'install-moz-phab', + # We call mach environment in client.mk which would cause the + # data submission to block the forward progress of make. + 'environment'): return False - if "TEST_MACH_TELEMETRY_NO_SUBMIT" in os.environ: + if 'TEST_MACH_TELEMETRY_NO_SUBMIT' in os.environ: # In our telemetry tests, we want telemetry to be collected for analysis, but # we don't want it submitted. return False state_dir = get_state_dir() - machpath = os.path.join(instance.topsrcdir, "mach") - with open(os.devnull, "wb") as devnull: - subprocess.Popen( - [ - sys.executable, - machpath, - "python", - "--no-virtualenv", - os.path.join(topsrcdir, "build", "submit_telemetry_data.py"), - state_dir, - ], - stdout=devnull, - stderr=devnull, - ) + machpath = os.path.join(instance.topsrcdir, 'mach') + with open(os.devnull, 'wb') as devnull: + subprocess.Popen([sys.executable, machpath, 'python', + '--no-virtualenv', + os.path.join(topsrcdir, 'build', + 'submit_telemetry_data.py'), + state_dir], + stdout=devnull, stderr=devnull) def _finalize_telemetry_glean(telemetry, is_bootstrap, success): @@ -496,9 +472,8 @@ def _finalize_telemetry_glean(telemetry, is_bootstrap, success): system_metrics.logical_cores.add(logical_cores) system_metrics.physical_cores.add(physical_cores) if memory_total is not None: - system_metrics.memory.accumulate( - int(math.ceil(float(memory_total) / (1024 * 1024 * 1024))) - ) + system_metrics.memory.accumulate(int( + math.ceil(float(memory_total) / (1024 * 1024 * 1024)))) telemetry.submit(is_bootstrap) @@ -512,15 +487,12 @@ class ImportHook(object): self._original_import = original_import # Assume the source directory is the parent directory of the one # containing this file. - self._source_dir = ( - os.path.normcase( - os.path.abspath(os.path.dirname(os.path.dirname(__file__))) - ) - + os.sep - ) + self._source_dir = os.path.normcase(os.path.abspath( + os.path.dirname(os.path.dirname(__file__)))) + os.sep self._modules = set() - def __call__(self, name, globals=None, locals=None, fromlist=None, level=-1): + def __call__(self, name, globals=None, locals=None, fromlist=None, + level=-1): if sys.version_info[0] >= 3 and level < 0: level = 0 @@ -541,14 +513,14 @@ class ImportHook(object): self._modules.add(resolved_name) # Builtin modules don't have a __file__ attribute. - if not getattr(module, "__file__", None): + if not getattr(module, '__file__', None): return module # Note: module.__file__ is not always absolute. path = os.path.normcase(os.path.abspath(module.__file__)) # Note: we could avoid normcase and abspath above for non pyc/pyo # files, but those are actually rare, so it doesn't really matter. - if not path.endswith((".pyc", ".pyo")): + if not path.endswith(('.pyc', '.pyo')): return module # Ignore modules outside our source directory diff --git a/build/midl.py b/build/midl.py index add17006d61c..3f2a08c4f9db 100644 --- a/build/midl.py +++ b/build/midl.py @@ -12,11 +12,11 @@ def relativize(path, base=None): # For absolute path in Unix builds, we need relative paths because # Windows programs run via Wine don't like these Unix absolute paths # (they look like command line arguments). - if path.startswith("/"): + if path.startswith('/'): return os.path.relpath(path, base) # For Windows absolute paths, we can just use the unmodified path. # And if the path starts with '-', it's a command line argument. - if os.path.isabs(path) or path.startswith("-"): + if os.path.isabs(path) or path.startswith('-'): return path # Remaining case is relative paths, which may be relative to a different # directory (os.getcwd()) than the needed `base`, so we "rebase" it. @@ -25,18 +25,18 @@ def relativize(path, base=None): def midl(out, input, *flags): out.avoid_writing_to_file() - midl = buildconfig.substs["MIDL"] - wine = buildconfig.substs.get("WINE") - base = os.path.dirname(out.name) or "." - if midl.lower().endswith(".exe") and wine: + midl = buildconfig.substs['MIDL'] + wine = buildconfig.substs.get('WINE') + base = os.path.dirname(out.name) or '.' + if midl.lower().endswith('.exe') and wine: command = [wine, midl] else: command = [midl] - command.extend(buildconfig.substs["MIDL_FLAGS"]) + command.extend(buildconfig.substs['MIDL_FLAGS']) command.extend([relativize(f, base) for f in flags]) - command.append("-Oicf") + command.append('-Oicf') command.append(relativize(input, base)) - print("Executing:", " ".join(command)) + print('Executing:', ' '.join(command)) result = subprocess.run(command, cwd=base) return result.returncode @@ -49,9 +49,7 @@ def merge_dlldata(out, *inputs): inputs = [open(i) for i in inputs] read_a_line = [True] * len(inputs) while True: - lines = [ - f.readline() if read_a_line[n] else lines[n] for n, f in enumerate(inputs) - ] + lines = [f.readline() if read_a_line[n] else lines[n] for n, f in enumerate(inputs)] unique_lines = set(lines) if len(unique_lines) == 1: # All the lines are identical @@ -59,10 +57,7 @@ def merge_dlldata(out, *inputs): break out.write(lines[0]) read_a_line = [True] * len(inputs) - elif ( - len(unique_lines) == 2 - and len([l for l in unique_lines if "#define" in l]) == 1 - ): + elif len(unique_lines) == 2 and len([l for l in unique_lines if '#define' in l]) == 1: # Most lines are identical. When they aren't, it's typically because some # files have an extra #define that others don't. When that happens, we # print out the #define, and get a new input line from the files that had @@ -72,18 +67,16 @@ def merge_dlldata(out, *inputs): # defines across different files, except when there's a different one # for each file, in which case it's handled further below. a = unique_lines.pop() - if "#define" in a: + if '#define' in a: out.write(a) else: out.write(unique_lines.pop()) - read_a_line = ["#define" in l for l in lines] + read_a_line = ['#define' in l for l in lines] elif len(unique_lines) != len(lines): # If for some reason, we don't get lines that are entirely different # from each other, we have some unexpected input. - print( - "Error while merging dlldata. Last lines read: {}".format(lines), - file=sys.stderr, - ) + print('Error while merging dlldata. Last lines read: {}'.format(lines), + file=sys.stderr) return 1 else: for line in lines: diff --git a/build/mobile/remoteautomation.py b/build/mobile/remoteautomation.py index 60d8d952fa1f..8d98f9ba2522 100644 --- a/build/mobile/remoteautomation.py +++ b/build/mobile/remoteautomation.py @@ -35,17 +35,15 @@ _log = logging.getLogger() resetGlobalLog(sys.stdout) # signatures for logcat messages that we don't care about much -fennecLogcatFilters = [ - "The character encoding of the HTML document was not declared", - "Use of Mutation Events is deprecated. Use MutationObserver instead.", - "Unexpected value from nativeGetEnabledTags: 0", -] +fennecLogcatFilters = ["The character encoding of the HTML document was not declared", + "Use of Mutation Events is deprecated. Use MutationObserver instead.", + "Unexpected value from nativeGetEnabledTags: 0"] class RemoteAutomation(object): - def __init__( - self, device, appName="", remoteProfile=None, remoteLog=None, processArgs=None - ): + + def __init__(self, device, appName='', remoteProfile=None, remoteLog=None, + processArgs=None): super(RemoteAutomation, self).__init__() self.device = device self.appName = appName @@ -55,22 +53,9 @@ class RemoteAutomation(object): self.lastTestSeen = "remoteautomation.py" self.log = _log - def runApp( - self, - testURL, - env, - app, - profileDir, - extraArgs, - utilityPath=None, - xrePath=None, - debuggerInfo=None, - symbolsPath=None, - timeout=-1, - maxTime=None, - e10s=True, - **kwargs - ): + def runApp(self, testURL, env, app, profileDir, extraArgs, + utilityPath=None, xrePath=None, debuggerInfo=None, symbolsPath=None, + timeout=-1, maxTime=None, e10s=True, **kwargs): """ Run the app, log the duration it took to execute, return the status code. Kills the app if it runs for longer than |maxTime| seconds, or outputs nothing @@ -84,26 +69,19 @@ class RemoteAutomation(object): timeout = self.DEFAULT_TIMEOUT self.utilityPath = utilityPath - cmd, args = self.buildCommandLine( - app, debuggerInfo, profileDir, testURL, extraArgs - ) + cmd, args = self.buildCommandLine(app, debuggerInfo, profileDir, testURL, extraArgs) startTime = datetime.datetime.now() self.lastTestSeen = "remoteautomation.py" - self.launchApp( - [cmd] + args, - env=self.environment(env=env, crashreporter=not debuggerInfo), - e10s=e10s, - **self.processArgs - ) + self.launchApp([cmd] + args, + env=self.environment(env=env, crashreporter=not debuggerInfo), + e10s=e10s, **self.processArgs) self.log.info("remoteautomation.py | Application pid: %d" % self.pid) status = self.waitForFinish(timeout, maxTime) - self.log.info( - "remoteautomation.py | Application ran for: %s" - % str(datetime.datetime.now() - startTime) - ) + self.log.info("remoteautomation.py | Application ran for: %s" % + str(datetime.datetime.now() - startTime)) crashed = self.checkForCrashes(symbolsPath) if crashed: @@ -119,36 +97,36 @@ class RemoteAutomation(object): env = {} if crashreporter: - env["MOZ_CRASHREPORTER_NO_REPORT"] = "1" - env["MOZ_CRASHREPORTER"] = "1" - env["MOZ_CRASHREPORTER_SHUTDOWN"] = "1" + env['MOZ_CRASHREPORTER_NO_REPORT'] = '1' + env['MOZ_CRASHREPORTER'] = '1' + env['MOZ_CRASHREPORTER_SHUTDOWN'] = '1' else: - env["MOZ_CRASHREPORTER_DISABLE"] = "1" + env['MOZ_CRASHREPORTER_DISABLE'] = '1' # Crash on non-local network connections by default. # MOZ_DISABLE_NONLOCAL_CONNECTIONS can be set to "0" to temporarily # enable non-local connections for the purposes of local testing. # Don't override the user's choice here. See bug 1049688. - env.setdefault("MOZ_DISABLE_NONLOCAL_CONNECTIONS", "1") + env.setdefault('MOZ_DISABLE_NONLOCAL_CONNECTIONS', '1') # Send an env var noting that we are in automation. Passing any # value except the empty string will declare the value to exist. # # This may be used to disabled network connections during testing, e.g. # Switchboard & telemetry uploads. - env.setdefault("MOZ_IN_AUTOMATION", "1") + env.setdefault('MOZ_IN_AUTOMATION', '1') # Set WebRTC logging in case it is not set yet. - env.setdefault("R_LOG_LEVEL", "6") - env.setdefault("R_LOG_DESTINATION", "stderr") - env.setdefault("R_LOG_VERBOSE", "1") + env.setdefault('R_LOG_LEVEL', '6') + env.setdefault('R_LOG_DESTINATION', 'stderr') + env.setdefault('R_LOG_VERBOSE', '1') return env def waitForFinish(self, timeout, maxTime): - """Wait for tests to finish. - If maxTime seconds elapse or no output is detected for timeout - seconds, kill the process and fail the test. + """ Wait for tests to finish. + If maxTime seconds elapse or no output is detected for timeout + seconds, kill the process and fail the test. """ # maxTime is used to override the default timeout, we should honor that status = self.wait(timeout=maxTime, noOutputTimeout=timeout) @@ -159,44 +137,38 @@ class RemoteAutomation(object): self.kill(True) if status == 1: if maxTime: - self.log.error( - "TEST-UNEXPECTED-FAIL | %s | " - "application ran for longer than allowed maximum time " - "of %s seconds" % (self.lastTestSeen, maxTime) - ) + self.log.error("TEST-UNEXPECTED-FAIL | %s | " + "application ran for longer than allowed maximum time " + "of %s seconds" % (self.lastTestSeen, maxTime)) else: - self.log.error( - "TEST-UNEXPECTED-FAIL | %s | " - "application ran for longer than allowed maximum time" - % self.lastTestSeen - ) + self.log.error("TEST-UNEXPECTED-FAIL | %s | " + "application ran for longer than allowed maximum time" + % self.lastTestSeen) if status == 2: - self.log.error( - "TEST-UNEXPECTED-FAIL | %s | " - "application timed out after %d seconds with no output" - % (self.lastTestSeen, int(timeout)) - ) + self.log.error("TEST-UNEXPECTED-FAIL | %s | " + "application timed out after %d seconds with no output" + % (self.lastTestSeen, int(timeout))) return status def checkForCrashes(self, symbolsPath): try: dumpDir = tempfile.mkdtemp() - remoteCrashDir = posixpath.join(self.remoteProfile, "minidumps") + remoteCrashDir = posixpath.join(self.remoteProfile, 'minidumps') if not self.device.is_dir(remoteCrashDir): return False self.device.pull(remoteCrashDir, dumpDir) logger = get_default_logger() crashed = mozcrash.log_crashes( - logger, dumpDir, symbolsPath, test=self.lastTestSeen - ) + logger, dumpDir, symbolsPath, test=self.lastTestSeen) finally: try: shutil.rmtree(dumpDir) except Exception as e: - print("WARNING: unable to remove directory %s: %s" % (dumpDir, str(e))) + print("WARNING: unable to remove directory %s: %s" % ( + dumpDir, str(e))) return crashed def buildCommandLine(self, app, debuggerInfo, profileDir, testURL, extraArgs): @@ -206,7 +178,7 @@ class RemoteAutomation(object): # Hack for robocop, if app is "am" and extraArgs contains the rest of the stuff, lets # assume extraArgs is all we need - if app == "am" and extraArgs[0] in ("instrument", "start"): + if app == "am" and extraArgs[0] in ('instrument', 'start'): return app, extraArgs cmd = os.path.abspath(app) @@ -226,7 +198,7 @@ class RemoteAutomation(object): args.extend(extraArgs) try: - args.remove("-foreground") + args.remove('-foreground') except Exception: pass return app, args @@ -236,19 +208,17 @@ class RemoteAutomation(object): self.stdoutlen = 0 if self.appName and self.device.process_exist(self.appName): - print( - "remoteautomation.py %s is already running. Stopping..." % self.appName - ) + print("remoteautomation.py %s is already running. Stopping..." % self.appName) self.device.stop_application(self.appName) self.counts = counts if self.counts is not None: - self.counts["pass"] = 0 - self.counts["fail"] = 0 - self.counts["todo"] = 0 + self.counts['pass'] = 0 + self.counts['fail'] = 0 + self.counts['todo'] = 0 - if cmd[0] == "am": - cmd = " ".join(cmd) + if cmd[0] == 'am': + cmd = ' '.join(cmd) self.procName = self.appName if not self.device.shell_bool(cmd): print("remoteautomation.py failed to launch %s" % cmd) @@ -258,25 +228,17 @@ class RemoteAutomation(object): if args[0] == self.appName: args = args[1:] url = args[-1:][0] - if url.startswith("/"): + if url.startswith('/'): # this is probably a reftest profile directory, not a url url = None else: args = args[:-1] - if "geckoview" in self.appName: + if 'geckoview' in self.appName: activity = "TestRunnerActivity" - self.device.launch_activity( - self.appName, - activity_name=activity, - e10s=e10s, - moz_env=env, - extra_args=args, - url=url, - ) + self.device.launch_activity(self.appName, activity_name=activity, e10s=e10s, + moz_env=env, extra_args=args, url=url) else: - self.device.launch_fennec( - self.appName, moz_env=env, extra_args=args, url=url - ) + self.device.launch_fennec(self.appName, moz_env=env, extra_args=args, url=url) # Setting timeout at 1 hour since on a remote device this takes much longer. # Temporarily increased to 110 minutes because no more chunks can be created. @@ -306,15 +268,13 @@ class RemoteAutomation(object): except ADBTimeoutError: raise except Exception as e: - self.log.exception( - "remoteautomation.py | exception reading log: %s" % str(e) - ) + self.log.exception("remoteautomation.py | exception reading log: %s" % str(e)) return False if not newLogContent: return False self.stdoutlen += len(newLogContent) - newLogContent = six.ensure_str(newLogContent, errors="replace") + newLogContent = six.ensure_str(newLogContent, errors='replace') if self.messageLogger is None: testStartFilenames = re.findall(r"TEST-START \| ([^\s]*)", newLogContent) @@ -324,11 +284,11 @@ class RemoteAutomation(object): return True self.logBuffer += newLogContent - lines = self.logBuffer.split("\n") + lines = self.logBuffer.split('\n') lines = [l for l in lines if l] if lines: - if self.logBuffer.endswith("\n"): + if self.logBuffer.endswith('\n'): # all lines are complete; no need to buffer self.logBuffer = "" else: @@ -343,35 +303,33 @@ class RemoteAutomation(object): # This passes the line to the logger (to be logged or buffered) if isinstance(line, six.text_type): # if line is unicode - let's encode it to bytes - parsed_messages = self.messageLogger.write( - line.encode("UTF-8", "replace") - ) + parsed_messages = self.messageLogger.write(line.encode('UTF-8', 'replace')) else: # if line is bytes type, write it as it is parsed_messages = self.messageLogger.write(line) for message in parsed_messages: if isinstance(message, dict): - if message.get("action") == "test_start": - self.lastTestSeen = message["test"] - elif message.get("action") == "test_end": - self.lastTestSeen = "{} (finished)".format(message["test"]) - elif message.get("action") == "suite_end": + if message.get('action') == 'test_start': + self.lastTestSeen = message['test'] + elif message.get('action') == 'test_end': + self.lastTestSeen = '{} (finished)'.format(message['test']) + elif message.get('action') == 'suite_end': self.lastTestSeen = "Last test finished" - elif message.get("action") == "log": - line = message["message"].strip() + elif message.get('action') == 'log': + line = message['message'].strip() if self.counts: m = re.match(".*:\s*(\d*)", line) if m: try: val = int(m.group(1)) if "Passed:" in line: - self.counts["pass"] += val + self.counts['pass'] += val self.lastTestSeen = "Last test finished" elif "Failed:" in line: - self.counts["fail"] += val + self.counts['fail'] += val elif "Todo:" in line: - self.counts["todo"] += val + self.counts['todo'] += val except ADBTimeoutError: raise except Exception: @@ -412,13 +370,11 @@ class RemoteAutomation(object): if (not slowLog) or (timer % 60 == 0): startRead = datetime.datetime.now() hasOutput = self.read_stdout() - if (datetime.datetime.now() - startRead) > datetime.timedelta( - seconds=5 - ): + if (datetime.datetime.now() - startRead) > datetime.timedelta(seconds=5): slowLog = True if hasOutput: noOutputTimer = 0 - if self.counts and "pass" in self.counts and self.counts["pass"] > 0: + if self.counts and 'pass' in self.counts and self.counts['pass'] > 0: interval = 0.5 time.sleep(interval) timer += interval @@ -426,7 +382,7 @@ class RemoteAutomation(object): if datetime.datetime.now() > endTime: status = 1 break - if noOutputTimeout and noOutputTimer > noOutputTimeout: + if (noOutputTimeout and noOutputTimer > noOutputTimeout): status = 2 break if not hasOutput: @@ -446,7 +402,7 @@ class RemoteAutomation(object): # they rarely work well with Firefox on the Android # emulator. dump_screen provides an effective # screenshot of the emulator and its host desktop. - if not self.device._device_serial.startswith("emulator-"): + if not self.device._device_serial.startswith('emulator-'): dump_device_screen(self.device, get_default_logger()) elif self.utilityPath: dump_screen(self.utilityPath, get_default_logger()) @@ -503,5 +459,5 @@ class RemoteAutomation(object): @staticmethod def elf_arm(filename): - data = open(filename, "rb").read(20) + data = open(filename, 'rb').read(20) return data[:4] == "\x7fELF" and ord(data[18]) == 40 # EM_ARM diff --git a/build/moz.build b/build/moz.build index 3d7aed0d5651..43b253722752 100644 --- a/build/moz.build +++ b/build/moz.build @@ -4,126 +4,114 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -with Files("**"): - BUG_COMPONENT = ("Firefox Build System", "General") +with Files('**'): + BUG_COMPONENT = ('Firefox Build System', 'General') # This cannot be named "build" because of bug 922191. -SPHINX_TREES["buildsystem"] = "docs" +SPHINX_TREES['buildsystem'] = 'docs' -with Files("docs/**"): - SCHEDULES.exclusive = ["docs"] +with Files('docs/**'): + SCHEDULES.exclusive = ['docs'] -if CONFIG["OS_ARCH"] == "WINNT": - DIRS += ["win32"] +if CONFIG['OS_ARCH'] == 'WINNT': + DIRS += ['win32'] else: - DIRS += ["unix"] + DIRS += ['unix'] CRAMTEST_MANIFESTS += [ - "tests/cram/cram.ini", + 'tests/cram/cram.ini', ] -DEFINES["ACCEPTED_MAR_CHANNEL_IDS"] = CONFIG["ACCEPTED_MAR_CHANNEL_IDS"] +DEFINES['ACCEPTED_MAR_CHANNEL_IDS'] = CONFIG['ACCEPTED_MAR_CHANNEL_IDS'] -if CONFIG["MOZ_BUILD_APP"] == "browser": +if CONFIG['MOZ_BUILD_APP'] == 'browser': PYTHON_UNITTEST_MANIFESTS += [ - "compare-mozconfig/python.ini", + 'compare-mozconfig/python.ini', ] -if CONFIG["ENABLE_TESTS"] or CONFIG["MOZ_DMD"]: - FINAL_TARGET_FILES += ["/tools/rb/fix_stacks.py"] +if CONFIG['ENABLE_TESTS'] or CONFIG['MOZ_DMD']: + FINAL_TARGET_FILES += ['/tools/rb/fix_stacks.py'] -if CONFIG["MOZ_DMD"]: - FINAL_TARGET_FILES += ["/memory/replace/dmd/dmd.py"] +if CONFIG['MOZ_DMD']: + FINAL_TARGET_FILES += ['/memory/replace/dmd/dmd.py'] # Put a useful .gdbinit and .gdbinit.py in $objdir/build, to be picked up # automatically by GDB via either libxul.so-gdb.py or js-gdb.py. -OBJDIR_PP_FILES.build += [".gdbinit.py.in"] -OBJDIR_FILES.build += [".gdbinit.loader"] -OBJDIR_FILES.build += [".gdbinit"] +OBJDIR_PP_FILES.build += ['.gdbinit.py.in'] +OBJDIR_FILES.build += ['.gdbinit.loader'] +OBJDIR_FILES.build += ['.gdbinit'] # Install the clang-cl runtime library for ASAN next to the binaries we produce. -if CONFIG["MOZ_ASAN"] and CONFIG["CC_TYPE"] == "clang-cl": - FINAL_TARGET_FILES += ["%" + CONFIG["MOZ_CLANG_RT_ASAN_LIB_PATH"]] - FINAL_TARGET_FILES += [ - "%" + CONFIG["MOZ_CLANG_RT_ASAN_LIB_PATH"].replace(".dll", ".pdb") - ] +if CONFIG['MOZ_ASAN'] and CONFIG['CC_TYPE'] == 'clang-cl': + FINAL_TARGET_FILES += ['%' + CONFIG['MOZ_CLANG_RT_ASAN_LIB_PATH']] + FINAL_TARGET_FILES += ['%' + CONFIG['MOZ_CLANG_RT_ASAN_LIB_PATH'].replace(".dll", ".pdb")] # Install the clang runtime library for ASAN next to the binaries we produce. -if CONFIG["MOZ_WIDGET_TOOLKIT"] == "android" and CONFIG["MOZ_ASAN"]: - FINAL_TARGET_FILES += ["%" + CONFIG["MOZ_CLANG_RT_ASAN_LIB_PATH"]] +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android' and CONFIG['MOZ_ASAN']: + FINAL_TARGET_FILES += ['%' + CONFIG['MOZ_CLANG_RT_ASAN_LIB_PATH']] -if CONFIG["LLVM_SYMBOLIZER"]: - FINAL_TARGET_FILES += ["/" + CONFIG["LLVM_SYMBOLIZER"]] +if CONFIG['LLVM_SYMBOLIZER']: + FINAL_TARGET_FILES += ['/' + CONFIG['LLVM_SYMBOLIZER']] -if CONFIG["MOZ_APP_BASENAME"]: +if CONFIG['MOZ_APP_BASENAME']: appini_defines = { - "TOPOBJDIR": TOPOBJDIR, + 'TOPOBJDIR': TOPOBJDIR, } - for var in ( - "GRE_MILESTONE", - "MOZ_APP_VERSION", - "MOZ_APP_BASENAME", - "MOZ_APP_VENDOR", - "MOZ_APP_ID", - "MAR_CHANNEL_ID", - "MOZ_APP_REMOTINGNAME", - ): + for var in ('GRE_MILESTONE', 'MOZ_APP_VERSION', 'MOZ_APP_BASENAME', + 'MOZ_APP_VENDOR', 'MOZ_APP_ID', 'MAR_CHANNEL_ID', + 'MOZ_APP_REMOTINGNAME'): appini_defines[var] = CONFIG[var] - if CONFIG["MOZ_APP_DISPLAYNAME"] != CONFIG["MOZ_APP_BASENAME"]: - appini_defines["MOZ_APP_DISPLAYNAME"] = CONFIG["MOZ_APP_DISPLAYNAME"] + if CONFIG['MOZ_APP_DISPLAYNAME'] != CONFIG['MOZ_APP_BASENAME']: + appini_defines['MOZ_APP_DISPLAYNAME'] = CONFIG['MOZ_APP_DISPLAYNAME'] - if CONFIG["MOZ_BUILD_APP"] == "browser": - appini_defines["MOZ_BUILD_APP_IS_BROWSER"] = True + if CONFIG['MOZ_BUILD_APP'] == 'browser': + appini_defines['MOZ_BUILD_APP_IS_BROWSER'] = True - if CONFIG["MOZ_APP_PROFILE"]: - appini_defines["MOZ_APP_PROFILE"] = CONFIG["MOZ_APP_PROFILE"] + if CONFIG['MOZ_APP_PROFILE']: + appini_defines['MOZ_APP_PROFILE'] = CONFIG['MOZ_APP_PROFILE'] - for var in ("MOZ_CRASHREPORTER", "MOZ_PROFILE_MIGRATOR", "MOZ_UPDATER"): + for var in ('MOZ_CRASHREPORTER', 'MOZ_PROFILE_MIGRATOR', 'MOZ_UPDATER'): if CONFIG[var]: appini_defines[var] = True - appini_defines["MOZ_APPUPDATE_HOST"] = "aus5.mozilla.org" - if CONFIG["MOZ_APPUPDATE_HOST"]: - appini_defines["MOZ_APPUPDATE_HOST"] = CONFIG["MOZ_APPUPDATE_HOST"] + appini_defines['MOZ_APPUPDATE_HOST'] = 'aus5.mozilla.org' + if CONFIG['MOZ_APPUPDATE_HOST']: + appini_defines['MOZ_APPUPDATE_HOST'] = CONFIG['MOZ_APPUPDATE_HOST'] GeneratedFile( - "application.ini", - script="../python/mozbuild/mozbuild/action/preprocessor.py", - entry_point="generate", - inputs=["application.ini.in"], - flags=[ - "-D%s=%s" % (k, "1" if v is True else v) - for k, v in sorted(appini_defines.items(), key=lambda t: t[0]) - ], - ) - - FINAL_TARGET_FILES += ["!application.ini"] - if CONFIG["MOZ_WIDGET_TOOLKIT"] != "android" and CONFIG["MOZ_UPDATER"]: - FINAL_TARGET_PP_FILES += ["update-settings.ini"] + 'application.ini', + script='../python/mozbuild/mozbuild/action/preprocessor.py', + entry_point='generate', + inputs=['application.ini.in'], + flags=['-D%s=%s' % (k, '1' if v is True else v) + for k, v in sorted(appini_defines.items(), key=lambda t: t[0])]) - GeneratedFile( - "application.ini.h", script="appini_header.py", inputs=["!application.ini"] - ) + FINAL_TARGET_FILES += ['!application.ini'] + if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android' and CONFIG['MOZ_UPDATER']: + FINAL_TARGET_PP_FILES += ['update-settings.ini'] + + GeneratedFile('application.ini.h', script='appini_header.py', + inputs=['!application.ini']) # Put a .lldbinit in the bin directory and the objdir, to be picked up # automatically by LLDB when we debug executables using either of those two # directories as the current working directory. The .lldbinit file will # load $(topsrcdir)/.lldbinit, which is where the actual debugging commands are. -DEFINES["topsrcdir"] = TOPSRCDIR -DEFINES["topobjdir"] = TOPOBJDIR -FINAL_TARGET_PP_FILES += [".lldbinit.in"] -OBJDIR_FILES += ["!/dist/bin/.lldbinit"] +DEFINES['topsrcdir'] = TOPSRCDIR +DEFINES['topobjdir'] = TOPOBJDIR +FINAL_TARGET_PP_FILES += ['.lldbinit.in'] +OBJDIR_FILES += ['!/dist/bin/.lldbinit'] # Put the .ycm_extra_conf.py file at the root of the objdir. It is used by # the vim plugin YouCompleteMe. -OBJDIR_FILES += ["/.ycm_extra_conf.py"] +OBJDIR_FILES += ['/.ycm_extra_conf.py'] -if CONFIG["MOZ_VALGRIND"]: +if CONFIG['MOZ_VALGRIND']: OBJDIR_FILES._valgrind += [ - "valgrind/cross-architecture.sup", - "valgrind/i386-pc-linux-gnu.sup", - "valgrind/x86_64-pc-linux-gnu.sup", + 'valgrind/cross-architecture.sup', + 'valgrind/i386-pc-linux-gnu.sup', + 'valgrind/x86_64-pc-linux-gnu.sup', ] diff --git a/build/moz.configure/android-ndk.configure b/build/moz.configure/android-ndk.configure index b6d198b149e3..dd12b5357336 100644 --- a/build/moz.configure/android-ndk.configure +++ b/build/moz.configure/android-ndk.configure @@ -5,95 +5,85 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. -@depends(mozbuild_state_path, "--help") -@imports(_from="os.path", _import="isdir") -@imports(_from="mozboot.android", _import="NDK_VERSION") +@depends(mozbuild_state_path, '--help') +@imports(_from='os.path', _import='isdir') +@imports(_from='mozboot.android', _import='NDK_VERSION') def default_android_ndk_root(mozbuild_state_path, _): - path = os.path.join(mozbuild_state_path, "android-ndk-%s" % NDK_VERSION) + path = os.path.join(mozbuild_state_path, 'android-ndk-%s' % NDK_VERSION) if isdir(path): return path -option( - "--with-android-ndk", - nargs=1, - default=default_android_ndk_root, - help="location where the Android NDK can be found{|}", -) +option('--with-android-ndk', nargs=1, + default=default_android_ndk_root, + help='location where the Android NDK can be found{|}') -option("--with-android-toolchain", nargs=1, help="location of the Android toolchain") +option('--with-android-toolchain', nargs=1, + help='location of the Android toolchain') -option( - "--with-android-googlevr-sdk", nargs=1, help="location of the Android GoogleVR SDK" -) +option('--with-android-googlevr-sdk', nargs=1, + help='location of the Android GoogleVR SDK') @depends(target) def min_android_version(target): - if target.cpu in ["aarch64", "x86_64"]: + if target.cpu in ['aarch64', 'x86_64']: # 64-bit support was added in API 21. - return "21" - return "16" + return '21' + return '16' -option( - "--with-android-version", - nargs=1, - help="android platform version{|}", - default=min_android_version, -) +option('--with-android-version', + nargs=1, + help='android platform version{|}', + default=min_android_version) -@depends("--with-android-version", min_android_version) -@imports(_from="__builtin__", _import="ValueError") +@depends('--with-android-version', min_android_version) +@imports(_from='__builtin__', _import='ValueError') def android_version(value, min_version): if not value: # Someone has passed --without-android-version. - die("--with-android-version cannot be disabled.") + die('--with-android-version cannot be disabled.') try: version = int(value[0]) except ValueError: - die("--with-android-version expects an integer value") + die('--with-android-version expects an integer value') if version < int(min_version): - die( - "--with-android-version must be at least %s (got %s)", min_version, value[0] - ) + die('--with-android-version must be at least %s (got %s)', + min_version, value[0]) return version -add_old_configure_assignment("android_version", android_version) +add_old_configure_assignment('android_version', android_version) -@depends("--with-android-ndk") -@imports(_from="os.path", _import="isdir") +@depends('--with-android-ndk') +@imports(_from='os.path', _import='isdir') def ndk(value): if value: if not isdir(value[0]): - die( - "The path you specified with --with-android-ndk (%s) is not " - "a directory" % value[0] - ) + die("The path you specified with --with-android-ndk (%s) is not " + "a directory" % value[0]) return value[0] - die( - "You must specify --with-android-ndk=/path/to/ndk when targeting Android, " - "or try |mach bootstrap|." - ) + die('You must specify --with-android-ndk=/path/to/ndk when targeting Android, ' + 'or try |mach bootstrap|.') -set_config("ANDROID_NDK", ndk) -add_old_configure_assignment("android_ndk", ndk) +set_config('ANDROID_NDK', ndk) +add_old_configure_assignment('android_ndk', ndk) @depends(ndk) -@checking("for android ndk version") -@imports(_from="__builtin__", _import="open") -@imports(_from="mozboot.android", _import="NDK_VERSION") -@imports(_from="mozboot.android", _import="get_ndk_version") -@imports(_from="mozboot.android", _import="GetNdkVersionError") +@checking('for android ndk version') +@imports(_from='__builtin__', _import='open') +@imports(_from='mozboot.android', _import='NDK_VERSION') +@imports(_from='mozboot.android', _import='get_ndk_version') +@imports(_from='mozboot.android', _import='GetNdkVersionError') def ndk_version(ndk): if not ndk: # Building 'js/src' for non-Android. @@ -105,30 +95,28 @@ def ndk_version(ndk): die(str(e)) if NDK_VERSION != human: - die( - "The only supported version of the NDK is %s (have %s)\n" - "Please run |mach bootstrap| " - "to install the correct NDK." % (NDK_VERSION, human) - ) + die('The only supported version of the NDK is %s (have %s)\n' + 'Please run |mach bootstrap| ' + 'to install the correct NDK.' % (NDK_VERSION, human)) return namespace( major=major, minor=minor, ) -set_config("ANDROID_NDK_MAJOR_VERSION", ndk_version.major) -set_config("ANDROID_NDK_MINOR_VERSION", ndk_version.minor) +set_config('ANDROID_NDK_MAJOR_VERSION', ndk_version.major) +set_config('ANDROID_NDK_MINOR_VERSION', ndk_version.minor) @depends(target, android_version, ndk) -@checking("for android platform directory") -@imports(_from="os.path", _import="isdir") +@checking('for android platform directory') +@imports(_from='os.path', _import='isdir') def android_platform(target, android_version, ndk): - if target.os != "Android": + if target.os != 'Android': return - if "aarch64" == target.cpu: - target_dir_name = "arm64" + if 'aarch64' == target.cpu: + target_dir_name = 'arm64' else: target_dir_name = target.cpu @@ -141,63 +129,60 @@ def android_platform(target, android_version, ndk): else: platform_version = android_version - platform_dir = os.path.join( - ndk, "platforms", "android-%s" % platform_version, "arch-%s" % target_dir_name - ) + platform_dir = os.path.join(ndk, + 'platforms', + 'android-%s' % platform_version, + 'arch-%s' % target_dir_name) if not isdir(platform_dir): - die( - "Android platform directory not found. With the current " - "configuration, it should be in %s" % platform_dir - ) + die("Android platform directory not found. With the current " + "configuration, it should be in %s" % platform_dir) return platform_dir -add_old_configure_assignment("android_platform", android_platform) -set_config("ANDROID_PLATFORM", android_platform) +add_old_configure_assignment('android_platform', android_platform) +set_config('ANDROID_PLATFORM', android_platform) @depends(android_platform, ndk, target) -@checking("for android sysroot directory") -@imports(_from="os.path", _import="isdir") +@checking('for android sysroot directory') +@imports(_from='os.path', _import='isdir') def android_sysroot(android_platform, ndk, target): - if target.os != "Android": + if target.os != 'Android': return # NDK r15 has both unified and non-unified headers, but we only support # non-unified for that NDK, so look for that first. search_dirs = [ # (, ) - (os.path.join(android_platform, "usr", "include"), android_platform), - (os.path.join(ndk, "sysroot"), os.path.join(ndk, "sysroot")), + (os.path.join(android_platform, 'usr', 'include'), android_platform), + (os.path.join(ndk, 'sysroot'), os.path.join(ndk, 'sysroot')), ] for test_dir, sysroot_dir in search_dirs: if isdir(test_dir): return sysroot_dir - die( - "Android sysroot directory not found in %s." - % str([sysroot_dir for test_dir, sysroot_dir in search_dirs]) - ) + die("Android sysroot directory not found in %s." % + str([sysroot_dir for test_dir, sysroot_dir in search_dirs])) -add_old_configure_assignment("android_sysroot", android_sysroot) +add_old_configure_assignment('android_sysroot', android_sysroot) @depends(android_platform, ndk, target) -@checking("for android system directory") -@imports(_from="os.path", _import="isdir") +@checking('for android system directory') +@imports(_from='os.path', _import='isdir') def android_system(android_platform, ndk, target): - if target.os != "Android": + if target.os != 'Android': return # NDK r15 has both unified and non-unified headers, but we only support # non-unified for that NDK, so look for that first. search_dirs = [ - os.path.join(android_platform, "usr", "include"), - os.path.join(ndk, "sysroot", "usr", "include", target.toolchain), + os.path.join(android_platform, 'usr', 'include'), + os.path.join(ndk, 'sysroot', 'usr', 'include', target.toolchain), ] for system_dir in search_dirs: @@ -207,85 +192,86 @@ def android_system(android_platform, ndk, target): die("Android system directory not found in %s." % str(search_dirs)) -add_old_configure_assignment("android_system", android_system) +add_old_configure_assignment('android_system', android_system) -@depends(target, host, ndk, "--with-android-toolchain") -@checking("for the Android toolchain directory", lambda x: x or "not found") -@imports(_from="os.path", _import="isdir") -@imports(_from="mozbuild.shellutil", _import="quote") +@depends(target, host, ndk, '--with-android-toolchain') +@checking('for the Android toolchain directory', lambda x: x or 'not found') +@imports(_from='os.path', _import='isdir') +@imports(_from='mozbuild.shellutil', _import='quote') def android_toolchain(target, host, ndk, toolchain): if not ndk: return if toolchain: return toolchain[0] else: - if target.cpu == "arm" and target.endianness == "little": - target_base = "arm-linux-androideabi" - elif target.cpu == "x86": - target_base = "x86" - elif target.cpu == "x86_64": - target_base = "x86_64" - elif target.cpu == "aarch64" and target.endianness == "little": - target_base = "aarch64-linux-android" + if target.cpu == 'arm' and target.endianness == 'little': + target_base = 'arm-linux-androideabi' + elif target.cpu == 'x86': + target_base = 'x86' + elif target.cpu == 'x86_64': + target_base = 'x86_64' + elif target.cpu == 'aarch64' and target.endianness == 'little': + target_base = 'aarch64-linux-android' else: - die("Target cpu is not supported.") - - toolchain_format = "%s/toolchains/%s-4.9/prebuilt/%s-%s" - host_kernel = "windows" if host.kernel == "WINNT" else host.kernel.lower() - - toolchain = toolchain_format % (ndk, target_base, host_kernel, host.cpu) - log.debug("Trying %s" % quote(toolchain)) - if not isdir(toolchain) and host.cpu == "x86_64": - toolchain = toolchain_format % (ndk, target_base, host_kernel, "x86") - log.debug("Trying %s" % quote(toolchain)) + die('Target cpu is not supported.') + + toolchain_format = '%s/toolchains/%s-4.9/prebuilt/%s-%s' + host_kernel = 'windows' if host.kernel == 'WINNT' else host.kernel.lower() + + toolchain = toolchain_format % (ndk, target_base, + host_kernel, host.cpu) + log.debug('Trying %s' % quote(toolchain)) + if not isdir(toolchain) and host.cpu == 'x86_64': + toolchain = toolchain_format % (ndk, target_base, + host_kernel, 'x86') + log.debug('Trying %s' % quote(toolchain)) if isdir(toolchain): return toolchain - die("You have to specify --with-android-toolchain=" "/path/to/ndk/toolchain.") + die('You have to specify --with-android-toolchain=' + '/path/to/ndk/toolchain.') -set_config("ANDROID_TOOLCHAIN", android_toolchain) +set_config('ANDROID_TOOLCHAIN', android_toolchain) @depends(target) def android_toolchain_prefix_base(target): - if target.cpu == "x86": + if target.cpu == 'x86': # Ideally, the --target should just have the right x86 variant # in the first place. - return "i686-linux-android" + return 'i686-linux-android' return target.toolchain -option( - env="STLPORT_CPPFLAGS", - nargs=1, - help="Options compiler should pass for standard C++ library", -) +option(env='STLPORT_CPPFLAGS', + nargs=1, + help='Options compiler should pass for standard C++ library') -@depends("STLPORT_CPPFLAGS", ndk) -@imports(_from="os.path", _import="isdir") +@depends('STLPORT_CPPFLAGS', ndk) +@imports(_from='os.path', _import='isdir') def stlport_cppflags(value, ndk): if value and len(value): return value.split() if not ndk: return - ndk_base = os.path.join(ndk, "sources", "cxx-stl") - cxx_base = os.path.join(ndk_base, "llvm-libc++") - cxx_include = os.path.join(cxx_base, "libcxx", "include") - cxxabi_base = os.path.join(ndk_base, "llvm-libc++abi") - cxxabi_include = os.path.join(cxxabi_base, "libcxxabi", "include") + ndk_base = os.path.join(ndk, 'sources', 'cxx-stl') + cxx_base = os.path.join(ndk_base, 'llvm-libc++') + cxx_include = os.path.join(cxx_base, 'libcxx', 'include') + cxxabi_base = os.path.join(ndk_base, 'llvm-libc++abi') + cxxabi_include = os.path.join(cxxabi_base, 'libcxxabi', 'include') if not isdir(cxx_include): # NDK r13 removes the inner "libcxx" directory. - cxx_include = os.path.join(cxx_base, "include") + cxx_include = os.path.join(cxx_base, 'include') if not isdir(cxx_include): die("Couldn't find path to libc++ includes in the android ndk") if not isdir(cxxabi_include): # NDK r13 removes the inner "libcxxabi" directory. - cxxabi_include = os.path.join(cxxabi_base, "include") + cxxabi_include = os.path.join(cxxabi_base, 'include') if not isdir(cxxabi_include): die("Couldn't find path to libc++abi includes in the android ndk") @@ -298,99 +284,87 @@ def stlport_cppflags(value, ndk): # Using -stdlib=libc++ and removing some of the -I below also doesn't # work because not everything that is in cxx_include comes in the C++ # header directory that comes with clang. - "-stdlib=libstdc++", - "-I%s" % cxx_include, - "-I%s" % os.path.join(ndk, "sources", "android", "support", "include"), - "-I%s" % cxxabi_include, - ] + '-stdlib=libstdc++', + '-I%s' % cxx_include, + '-I%s' % os.path.join(ndk, 'sources', 'android', 'support', 'include'), + '-I%s' % cxxabi_include] -add_old_configure_assignment("stlport_cppflags", stlport_cppflags) +add_old_configure_assignment('stlport_cppflags', stlport_cppflags) @depends(android_system, android_sysroot, android_toolchain, android_version) -def extra_toolchain_flags( - android_system, android_sysroot, toolchain_dir, android_version -): +def extra_toolchain_flags(android_system, android_sysroot, toolchain_dir, + android_version): if not android_sysroot: return [] - flags = [ - "-isystem", - android_system, - "-isystem", - os.path.join(android_sysroot, "usr", "include"), - "-gcc-toolchain", - toolchain_dir, - "-D__ANDROID_API__=%d" % android_version, - ] + flags = ['-isystem', + android_system, + '-isystem', + os.path.join(android_sysroot, 'usr', 'include'), + '-gcc-toolchain', + toolchain_dir, + '-D__ANDROID_API__=%d' % android_version] return flags @depends(android_toolchain_prefix_base, android_toolchain) def android_toolchain_prefix(prefix_base, toolchain): if toolchain: - return "%s/bin/%s-" % (toolchain, prefix_base) + return '%s/bin/%s-' % (toolchain, prefix_base) -imply_option( - "--with-toolchain-prefix", android_toolchain_prefix, reason="--with-android-ndk" -) +imply_option('--with-toolchain-prefix', android_toolchain_prefix, + reason='--with-android-ndk') -@depends( - extra_toolchain_flags, - stlport_cppflags, - android_toolchain, - android_toolchain_prefix_base, -) -@imports(_from="os.path", _import="isdir") -def bindgen_cflags_android(toolchain_flags, stlport_flags, toolchain, toolchain_prefix): +@depends(extra_toolchain_flags, stlport_cppflags, android_toolchain, + android_toolchain_prefix_base) +@imports(_from='os.path', _import='isdir') +def bindgen_cflags_android(toolchain_flags, stlport_flags, toolchain, + toolchain_prefix): if not toolchain_flags: return - gcc_include = os.path.join(toolchain, "lib", "gcc", toolchain_prefix, "4.9.x") + gcc_include = os.path.join( + toolchain, 'lib', 'gcc', toolchain_prefix, '4.9.x') if not isdir(gcc_include): - gcc_include = os.path.join(toolchain, "lib", "gcc", toolchain_prefix, "4.9") - - return ( - toolchain_flags - + stlport_flags - + [ - "-I%s" % os.path.join(gcc_include, "include"), - "-I%s" % os.path.join(gcc_include, "include-fixed"), - ] - ) + gcc_include = os.path.join( + toolchain, 'lib', 'gcc', toolchain_prefix, '4.9') + return toolchain_flags + stlport_flags + [ + '-I%s' % os.path.join(gcc_include, 'include'), + '-I%s' % os.path.join(gcc_include, 'include-fixed'), + ] -@depends("--with-android-googlevr-sdk", target) -@checking("for GoogleVR SDK", lambda x: x.result) -@imports(_from="os.path", _import="exists") -@imports(_from="os.path", _import="abspath") + +@depends('--with-android-googlevr-sdk', target) +@checking('for GoogleVR SDK', lambda x: x.result) +@imports(_from='os.path', _import='exists') +@imports(_from='os.path', _import='abspath') def googlevr_sdk(value, target): if not value: - return namespace(result="Not specified") + return namespace( + result='Not specified' + ) path = abspath(value[0]) if not exists(path): - die("Could not find GoogleVR SDK %s", path) - include = "%s/libraries/headers/" % path - if "arm" == target.cpu: - arch = "armeabi-v7a" - elif "aarch64" == target.cpu: - arch = "arm64-v8a" - elif "x86" == target.cpu: - arch = "x86" + die('Could not find GoogleVR SDK %s', path) + include = '%s/libraries/headers/' % path + if 'arm' == target.cpu: + arch = 'armeabi-v7a' + elif 'aarch64' == target.cpu: + arch = 'arm64-v8a' + elif 'x86' == target.cpu: + arch = 'x86' else: - die("Unsupported GoogleVR cpu architecture %s" % target.cpu) + die('Unsupported GoogleVR cpu architecture %s' % target.cpu) - libs = "{0}/libraries/jni/{1}/".format(path, arch) + libs = '{0}/libraries/jni/{1}/'.format(path, arch) if not exists(libs): - die( - "Could not find GoogleVR NDK at %s. Did you try running " - "'./gradlew :extractNdk' in %s?", - libs, - path, - ) + die('Could not find GoogleVR NDK at %s. Did you try running ' + '\'./gradlew :extractNdk\' in %s?', libs, path) return namespace( result=path, @@ -400,7 +374,7 @@ def googlevr_sdk(value, target): ) -set_define("MOZ_ANDROID_GOOGLE_VR", googlevr_sdk.enabled) -set_config("MOZ_ANDROID_GOOGLE_VR", googlevr_sdk.enabled) -set_config("MOZ_ANDROID_GOOGLE_VR_INCLUDE", googlevr_sdk.include) -set_config("MOZ_ANDROID_GOOGLE_VR_LIBS", googlevr_sdk.libs) +set_define('MOZ_ANDROID_GOOGLE_VR', googlevr_sdk.enabled) +set_config('MOZ_ANDROID_GOOGLE_VR', googlevr_sdk.enabled) +set_config('MOZ_ANDROID_GOOGLE_VR_INCLUDE', googlevr_sdk.include) +set_config('MOZ_ANDROID_GOOGLE_VR_LIBS', googlevr_sdk.libs) diff --git a/build/moz.configure/android-sdk.configure b/build/moz.configure/android-sdk.configure index 8f12de584973..2eb4c8ceae09 100644 --- a/build/moz.configure/android-sdk.configure +++ b/build/moz.configure/android-sdk.configure @@ -7,13 +7,13 @@ # Ensure Android SDK and build-tools versions depending on mobile target. -@depends(host, mozbuild_state_path, "--help") -@imports(_from="os.path", _import="isdir") +@depends(host, mozbuild_state_path, '--help') +@imports(_from='os.path', _import='isdir') def default_android_sdk_root(host, mozbuild_state_path, _): sdk_basename = { - "Darwin": "android-sdk-macosx", - "Linux": "android-sdk-linux", - "WINNT": "android-sdk-windows", + 'Darwin': 'android-sdk-macosx', + 'Linux': 'android-sdk-linux', + 'WINNT': 'android-sdk-windows', }.get(host.kernel) if sdk_basename: path = os.path.join(mozbuild_state_path, sdk_basename) @@ -21,61 +21,52 @@ def default_android_sdk_root(host, mozbuild_state_path, _): return path -option( - "--with-android-sdk", - nargs=1, - default=default_android_sdk_root, - help="location where the Android SDK can be found (like ~/.mozbuild/android-sdk-linux){|}", -) +option('--with-android-sdk', nargs=1, + default=default_android_sdk_root, + help='location where the Android SDK can be found (like ~/.mozbuild/android-sdk-linux){|}') -@depends("--with-android-sdk") -@imports(_from="os.path", _import="isdir") +@depends('--with-android-sdk') +@imports(_from='os.path', _import='isdir') def android_sdk_root(value): if value: if not isdir(value[0]): - die( - "The path you specified with --with-android-sdk (%s) is not " - "a directory" % value[0] - ) + die("The path you specified with --with-android-sdk (%s) is not " + "a directory" % value[0]) return value[0] - die( - "You must specify --with-android-sdk=/path/to/sdk when targeting Android, " - "or try |mach bootstrap|." - ) + die("You must specify --with-android-sdk=/path/to/sdk when targeting Android, " + "or try |mach bootstrap|.") -@depends("--help") +@depends('--help') def android_sdk_version(_): - return namespace(build_tools_version="29.0.3", target_sdk_version="29") + return namespace(build_tools_version='29.0.3', target_sdk_version='29') @depends(android_sdk_root, android_sdk_version) -@checking("for Android build-tools") -@imports(_from="os.path", _import="exists") -@imports(_from="os.path", _import="isdir") +@checking('for Android build-tools') +@imports(_from='os.path', _import='exists') +@imports(_from='os.path', _import='isdir') def android_build_tools(sdk_root, sdk_version): - android_build_tools_base = os.path.join(sdk_root, "build-tools") + android_build_tools_base = os.path.join(sdk_root, 'build-tools') version = sdk_version.build_tools_version if isdir(os.path.join(android_build_tools_base, version)): tools = os.path.join(android_build_tools_base, version) - for zipalign in ("zipalign", "zipalign.exe"): + for zipalign in ('zipalign', 'zipalign.exe'): if exists(os.path.join(tools, zipalign)): return [tools] - die( - "You must install the Android build-tools version %s. " - "Try |mach bootstrap|. (Looked for %s/%s)" - % (version, android_build_tools_base, version) - ) + die("You must install the Android build-tools version %s. " + "Try |mach bootstrap|. (Looked for %s/%s)" % + (version, android_build_tools_base, version)) @depends(android_sdk_root) -@checking("for Android tools") -@imports(_from="os.path", _import="isdir") +@checking('for Android tools') +@imports(_from='os.path', _import='isdir') def android_tools(sdk_root): - tools = os.path.join(sdk_root, "tools") + tools = os.path.join(sdk_root, 'tools') if isdir(tools): return tools @@ -83,50 +74,45 @@ def android_tools(sdk_root): @depends(android_sdk_root) -@checking("for Android platform-tools") -@imports(_from="os.path", _import="exists") -@imports(_from="os.path", _import="isdir") +@checking('for Android platform-tools') +@imports(_from='os.path', _import='exists') +@imports(_from='os.path', _import='isdir') def android_platform_tools(sdk_root): - tools = os.path.join(sdk_root, "platform-tools") - for adb in ("adb", "adb.exe"): + tools = os.path.join(sdk_root, 'platform-tools') + for adb in ('adb', 'adb.exe'): if exists(os.path.join(tools, adb)): return [tools] - die( - "You must install the Android platform-tools. Try |mach bootstrap|. (Looked for %s)" - % tools - ) + die("You must install the Android platform-tools. Try |mach bootstrap|. (Looked for %s)" % + tools) @depends(android_sdk_root) def android_emulator_path(sdk_root): - return [os.path.join(sdk_root, "emulator")] + return [os.path.join(sdk_root, 'emulator')] @template def check_android_tools(tool, tool_dir): - check = check_prog( - tool.upper(), (tool, tool + ".exe"), paths=tool_dir, allow_missing=True - ) + check = check_prog(tool.upper(), (tool, tool + '.exe'), paths=tool_dir, + allow_missing=True) @depends(check) def require_tool(result): if result is None: - die("The program %s was not found. Try |mach bootstrap|" % tool) + die('The program %s was not found. Try |mach bootstrap|' % tool) return result return require_tool -check_android_tools("zipalign", android_build_tools) -check_android_tools("adb", android_platform_tools) -check_android_tools("emulator", android_emulator_path) +check_android_tools('zipalign', android_build_tools) +check_android_tools('adb', android_platform_tools) +check_android_tools('emulator', android_emulator_path) -set_config("ANDROID_SDK_ROOT", android_sdk_root) -set_config("ANDROID_TOOLS", android_tools) +set_config('ANDROID_SDK_ROOT', android_sdk_root) +set_config('ANDROID_TOOLS', android_tools) -set_config("ANDROID_BUILD_TOOLS_VERSION", android_sdk_version.build_tools_version) -set_config("ANDROID_TARGET_SDK", android_sdk_version.target_sdk_version) -add_old_configure_assignment( - "ANDROID_TARGET_SDK", android_sdk_version.target_sdk_version -) +set_config('ANDROID_BUILD_TOOLS_VERSION', android_sdk_version.build_tools_version) +set_config('ANDROID_TARGET_SDK', android_sdk_version.target_sdk_version) +add_old_configure_assignment('ANDROID_TARGET_SDK', android_sdk_version.target_sdk_version) diff --git a/build/moz.configure/arm.configure b/build/moz.configure/arm.configure index 2082fa640f49..d767fb8d99f7 100644 --- a/build/moz.configure/arm.configure +++ b/build/moz.configure/arm.configure @@ -4,16 +4,15 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. - -@depends(target.os, "--help") +@depends(target.os, '--help') def arm_option_defaults(os, _): - if os == "Android": - arch = "armv7-a" - thumb = "yes" - fpu = "neon" - float_abi = "softfp" + if os == 'Android': + arch = 'armv7-a' + thumb = 'yes' + fpu = 'neon' + float_abi = 'softfp' else: - arch = thumb = fpu = float_abi = "toolchain-default" + arch = thumb = fpu = float_abi = 'toolchain-default' return namespace( arch=arch, thumb=thumb, @@ -27,154 +26,124 @@ def arm_option_defaults(os, _): # default is always returned. The lint is fooled by this file being # conditional. If it weren't conditional, the lint wouldn't ask for '{|}' to # be there. -option( - "--with-arch", - nargs=1, - default=arm_option_defaults.arch, - help="{Use specific CPU features (-march=type). Resets thumb, fpu, " - "float-abi, etc. defaults when set|}", -) +option('--with-arch', nargs=1, + default=arm_option_defaults.arch, + help='{Use specific CPU features (-march=type). Resets thumb, fpu, ' + 'float-abi, etc. defaults when set|}') -@depends("--with-arch") +@depends('--with-arch') def arch_option(value): if value: - if value[0] != "toolchain-default": - return ["-march={}".format(value[0])] + if value[0] != 'toolchain-default': + return ['-march={}'.format(value[0])] return [] -option( - "--with-thumb", - choices=("yes", "no", "toolchain-default"), - default=arm_option_defaults.thumb, - nargs="?", - help="{Use Thumb instruction set (-mthumb)|}", -) +option('--with-thumb', choices=('yes', 'no', 'toolchain-default'), + default=arm_option_defaults.thumb, + nargs='?', help='{Use Thumb instruction set (-mthumb)|}') def normalize_arm_option(value): if value: if len(value): - if value[0] == "yes": + if value[0] == 'yes': return True - elif value[0] == "no": + elif value[0] == 'no': return False else: return value[0] return True return False - -@depends("--with-thumb") +@depends('--with-thumb') def thumb_option(value): value = normalize_arm_option(value) if value is True: - return ["-mthumb"] + return ['-mthumb'] if value is False: - return ["-marm"] + return ['-marm'] return [] -option( - "--with-thumb-interwork", - choices=("yes", "no", "toolchain-default"), - default="toolchain-default", - nargs="?", - help="Use Thumb/ARM instuctions interwork (-mthumb-interwork)", -) +option('--with-thumb-interwork', choices=('yes', 'no', 'toolchain-default'), + default='toolchain-default', + nargs='?', help='Use Thumb/ARM instuctions interwork (-mthumb-interwork)') -@depends("--with-thumb-interwork") +@depends('--with-thumb-interwork') def thumb_interwork_option(value): value = normalize_arm_option(value) if value is True: - return ["-mthumb-interwork"] + return ['-mthumb-interwork'] if value is False: - return ["-mno-thumb-interwork"] + return ['-mno-thumb-interwork'] return [] -option( - "--with-fpu", - nargs=1, - default=arm_option_defaults.fpu, - help="{Use specific FPU type (-mfpu=type)|}", -) +option('--with-fpu', nargs=1, + default=arm_option_defaults.fpu, + help='{Use specific FPU type (-mfpu=type)|}') -@depends("--with-fpu") +@depends('--with-fpu') def fpu_option(value): if value: - if value[0] != "toolchain-default": - return ["-mfpu={}".format(value[0])] + if value[0] != 'toolchain-default': + return ['-mfpu={}'.format(value[0])] return [] -option( - "--with-float-abi", - nargs=1, - default=arm_option_defaults.float_abi, - help="{Use specific arm float ABI (-mfloat-abi=type)|}", -) +option('--with-float-abi', nargs=1, + default=arm_option_defaults.float_abi, + help='{Use specific arm float ABI (-mfloat-abi=type)|}') -@depends("--with-float-abi") +@depends('--with-float-abi') def float_abi_option(value): if value: - if value[0] != "toolchain-default": - return ["-mfloat-abi={}".format(value[0])] + if value[0] != 'toolchain-default': + return ['-mfloat-abi={}'.format(value[0])] return [] -option( - "--with-soft-float", - choices=("yes", "no", "toolchain-default"), - default="toolchain-default", - nargs="?", - help="Use soft float library (-msoft-float)", -) +option('--with-soft-float', choices=('yes', 'no', 'toolchain-default'), + default='toolchain-default', + nargs='?', help='Use soft float library (-msoft-float)') -@depends("--with-soft-float") +@depends('--with-soft-float') def soft_float_option(value): value = normalize_arm_option(value) if value is True: - return ["-msoft-float"] + return ['-msoft-float'] if value is False: - return ["-mno-soft-float"] + return ['-mno-soft-float'] return [] -check_and_add_gcc_flag( - "-mno-unaligned-access", when=depends(target.os)(lambda os: os == "Android") -) +check_and_add_gcc_flag('-mno-unaligned-access', + when=depends(target.os)(lambda os: os == 'Android')) -@depends( - arch_option, - thumb_option, - thumb_interwork_option, - fpu_option, - float_abi_option, - soft_float_option, -) +@depends(arch_option, thumb_option, thumb_interwork_option, fpu_option, + float_abi_option, soft_float_option) def all_flags(arch, thumb, interwork, fpu, float_abi, soft_float): return arch + thumb + interwork + fpu + float_abi + soft_float -add_old_configure_assignment("_ARM_FLAGS", all_flags) -add_old_configure_assignment("_THUMB_FLAGS", thumb_option) +add_old_configure_assignment('_ARM_FLAGS', all_flags) +add_old_configure_assignment('_THUMB_FLAGS', thumb_option) @depends(c_compiler, all_flags) -@checking("ARM version support in compiler", lambda x: x.arm_arch) -@imports(_from="textwrap", _import="dedent") +@checking('ARM version support in compiler', lambda x: x.arm_arch) +@imports(_from='textwrap', _import='dedent') def arm_target(compiler, all_flags): # We're going to preprocess the following source to figure out some details # about the arm target options we have enabled. - source = dedent( - """\ + source = dedent('''\ %ARM_ARCH __ARM_ARCH #if __thumb2__ %THUMB2 yes @@ -203,58 +172,54 @@ def arm_target(compiler, all_flags): #elif __ARM_FPV5__ %FPU fp-armv8 #endif - """ - ) + ''') result = try_invoke_compiler( compiler.wrapper + [compiler.compiler] + compiler.flags, compiler.language, source, - ["-E"] + all_flags, + ['-E'] + all_flags, ) # Metadata emitted by preprocessors such as GCC with LANG=ja_JP.utf-8 may # have non-ASCII characters. Treat the output as bytearray. - data = {"fpu": None} # fpu may not get a value from the preprocessor. + data = {'fpu': None} # fpu may not get a value from the preprocessor. for line in result.splitlines(): - if line.startswith("%"): - k, _, v = line.partition(" ") - k = k.lstrip("%").lower() - if k == "arm_arch": + if line.startswith('%'): + k, _, v = line.partition(' ') + k = k.lstrip('%').lower() + if k == 'arm_arch': data[k] = int(v) else: data[k] = { - "yes": True, - "no": False, + 'yes': True, + 'no': False, }.get(v, v) - log.debug("%s = %s", k, data[k]) + log.debug('%s = %s', k, data[k]) return namespace(**data) -@depends(arm_target.arm_arch, when=depends(target.os)(lambda os: os == "Android")) +@depends(arm_target.arm_arch, when=depends(target.os)(lambda os: os == 'Android')) def armv7(arch): if arch < 7: - die("Android/armv6 and earlier are not supported") + die('Android/armv6 and earlier are not supported') -set_config("MOZ_THUMB2", True, when=arm_target.thumb2) -set_define("MOZ_THUMB2", True, when=arm_target.thumb2) -add_old_configure_assignment("MOZ_THUMB2", True, when=arm_target.thumb2) +set_config('MOZ_THUMB2', True, when=arm_target.thumb2) +set_define('MOZ_THUMB2', True, when=arm_target.thumb2) +add_old_configure_assignment('MOZ_THUMB2', True, when=arm_target.thumb2) -have_arm_simd = c_compiler.try_compile( - body='asm("uqadd8 r1, r1, r2");', check_msg="for ARM SIMD support in compiler" -) +have_arm_simd = c_compiler.try_compile(body='asm("uqadd8 r1, r1, r2");', + check_msg='for ARM SIMD support in compiler') -set_config("HAVE_ARM_SIMD", have_arm_simd) -set_define("HAVE_ARM_SIMD", have_arm_simd) +set_config('HAVE_ARM_SIMD', have_arm_simd) +set_define('HAVE_ARM_SIMD', have_arm_simd) -have_arm_neon = c_compiler.try_compile( - body='asm(".fpu neon\\n vadd.i8 d0, d0, d0");', - check_msg="for ARM NEON support in compiler", -) +have_arm_neon = c_compiler.try_compile(body='asm(".fpu neon\\n vadd.i8 d0, d0, d0");', + check_msg='for ARM NEON support in compiler') -set_config("HAVE_ARM_NEON", have_arm_neon) -set_define("HAVE_ARM_NEON", have_arm_neon) +set_config('HAVE_ARM_NEON', have_arm_neon) +set_define('HAVE_ARM_NEON', have_arm_neon) # We don't need to build NEON support if we're targetting a non-NEON device. @@ -264,13 +229,13 @@ def build_arm_neon(arm_arch): return arm_arch >= 7 -set_config("BUILD_ARM_NEON", build_arm_neon) -set_define("BUILD_ARM_NEON", build_arm_neon) +set_config('BUILD_ARM_NEON', build_arm_neon) +set_define('BUILD_ARM_NEON', build_arm_neon) -set_config("ARM_ARCH", depends(arm_target.arm_arch)(lambda x: str(x))) -add_old_configure_assignment("ARM_ARCH", depends(arm_target.arm_arch)(lambda x: str(x))) -set_config("MOZ_FPU", arm_target.fpu) +set_config('ARM_ARCH', depends(arm_target.arm_arch)(lambda x: str(x))) +add_old_configure_assignment('ARM_ARCH', depends(arm_target.arm_arch)(lambda x: str(x))) +set_config('MOZ_FPU', arm_target.fpu) @depends(arm_target.float_abi) @@ -283,10 +248,10 @@ def neon_flags(float_abi): # we can safely mix code built with both ABIs. So, if we detect # that compiling uses the "softfloat" ABI, force the use of the # "softfp" ABI instead. - flags = ["-mfpu=neon"] - if float_abi == "soft": - flags.append("-mfloat-abi=softfp") + flags = ['-mfpu=neon'] + if float_abi == 'soft': + flags.append('-mfloat-abi=softfp') return tuple(flags) -set_config("NEON_FLAGS", neon_flags) +set_config('NEON_FLAGS', neon_flags) diff --git a/build/moz.configure/bindgen.configure b/build/moz.configure/bindgen.configure index da8a5d57af1d..79e1c3b14dcb 100644 --- a/build/moz.configure/bindgen.configure +++ b/build/moz.configure/bindgen.configure @@ -4,52 +4,45 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. - -@depends(build_project, "--enable-smoosh") +@depends(build_project, '--enable-smoosh') def cbindgen_is_needed(build_project, js_enable_smoosh): - if build_project != "js": + if build_project != 'js': # cbindgen is needed by the style system build and webrender. return True # cbindgen is needed by SmooshMonkey. return js_enable_smoosh - -option(env="CBINDGEN", nargs=1, when=cbindgen_is_needed, help="Path to cbindgen") +option(env='CBINDGEN', nargs=1, when=cbindgen_is_needed, + help='Path to cbindgen') -@imports(_from="textwrap", _import="dedent") +@imports(_from='textwrap', _import='dedent') def check_cbindgen_version(cbindgen, fatal=False): log.debug("trying cbindgen: %s" % cbindgen) - cbindgen_min_version = Version("0.15.0") + cbindgen_min_version = Version('0.15.0') # cbindgen x.y.z - version = Version(check_cmd_output(cbindgen, "--version").strip().split(" ")[1]) + version = Version(check_cmd_output(cbindgen, '--version').strip().split(" ")[1]) log.debug("%s has version %s" % (cbindgen, version)) if version >= cbindgen_min_version: return True if not fatal: return False - die( - dedent( - """\ + die(dedent('''\ cbindgen version {} is too old. At least version {} is required. Please update using 'cargo install cbindgen --force' or running './mach bootstrap', after removing the existing executable located at {}. - """.format( - version, cbindgen_min_version, cbindgen - ) - ) - ) + '''.format(version, cbindgen_min_version, cbindgen))) -@depends_if("CBINDGEN", toolchain_search_path, when=cbindgen_is_needed) -@checking("for cbindgen") -@imports(_from="textwrap", _import="dedent") +@depends_if('CBINDGEN', toolchain_search_path, when=cbindgen_is_needed) +@checking('for cbindgen') +@imports(_from='textwrap', _import='dedent') def cbindgen(cbindgen_override, toolchain_search_path): if cbindgen_override: check_cbindgen_version(cbindgen_override[0], fatal=True) @@ -57,7 +50,7 @@ def cbindgen(cbindgen_override, toolchain_search_path): candidates = [] for path in toolchain_search_path: - candidate = find_program("cbindgen", [path]) + candidate = find_program('cbindgen', [path]) if not candidate: continue if check_cbindgen_version(candidate): @@ -65,136 +58,104 @@ def cbindgen(cbindgen_override, toolchain_search_path): candidates.append(candidate) if not candidates: - raise FatalCheckError( - dedent( - """\ + raise FatalCheckError(dedent('''\ Cannot find cbindgen. Please run `mach bootstrap`, `cargo install cbindgen`, ensure that `cbindgen` is on your PATH, or point at an executable with `CBINDGEN`. - """ - ) - ) + ''')) check_cbindgen_version(candidates[0], fatal=True) - -set_config("CBINDGEN", cbindgen) +set_config('CBINDGEN', cbindgen) # Bindgen can use rustfmt to format Rust file, but it's not required. -option(env="RUSTFMT", nargs=1, help="Path to the rustfmt program") - -rustfmt = check_prog( - "RUSTFMT", - ["rustfmt"], - paths=toolchain_search_path, - input="RUSTFMT", - allow_missing=True, -) - - -option( - "--with-libclang-path", - nargs=1, - help="Absolute path to a directory containing Clang/LLVM libraries for bindgen (version 3.9.x or above)", -) -option( - "--with-clang-path", - nargs=1, - help="Absolute path to a Clang binary for bindgen (version 3.9.x or above)", -) - - -@depends( - "--with-clang-path", - c_compiler, - cxx_compiler, - toolchain_search_path, - target, - macos_sdk, -) -@checking("for clang for bindgen", lambda x: x.path if x else "not found") -def bindgen_clang_compiler( - clang_path, c_compiler, cxx_compiler, toolchain_search_path, target, macos_sdk -): +option(env='RUSTFMT', nargs=1, help='Path to the rustfmt program') + +rustfmt = check_prog('RUSTFMT', ['rustfmt'], paths=toolchain_search_path, + input='RUSTFMT', allow_missing=True) + + +option('--with-libclang-path', nargs=1, + help='Absolute path to a directory containing Clang/LLVM libraries for bindgen (version 3.9.x or above)') +option('--with-clang-path', nargs=1, + help='Absolute path to a Clang binary for bindgen (version 3.9.x or above)') + + +@depends('--with-clang-path', c_compiler, cxx_compiler, toolchain_search_path, + target, macos_sdk) +@checking('for clang for bindgen', lambda x: x.path if x else 'not found') +def bindgen_clang_compiler(clang_path, c_compiler, cxx_compiler, + toolchain_search_path, target, macos_sdk): # When the target compiler is clang, use that, including flags. - if cxx_compiler.type == "clang": - if clang_path and clang_path[0] not in ( - c_compiler.compiler, - cxx_compiler.compiler, - ): - die( - "--with-clang-path is not valid when the target compiler is %s", - cxx_compiler.type, - ) + if cxx_compiler.type == 'clang': + if clang_path and clang_path[0] not in (c_compiler.compiler, + cxx_compiler.compiler): + die('--with-clang-path is not valid when the target compiler is %s', + cxx_compiler.type) return namespace( path=cxx_compiler.compiler, flags=cxx_compiler.flags, ) # When the target compiler is clang-cl, use clang in the same directory, # and figure the right flags to use. - if cxx_compiler.type == "clang-cl": - if clang_path and os.path.dirname(clang_path[0]) != os.path.dirname( - cxx_compiler.compiler - ): - die( - "--with-clang-path must point to clang in the same directory " - "as the target compiler" - ) + if cxx_compiler.type == 'clang-cl': + if clang_path and os.path.dirname(clang_path[0]) != \ + os.path.dirname(cxx_compiler.compiler): + die('--with-clang-path must point to clang in the same directory ' + 'as the target compiler') if not clang_path: - clang_path = [os.path.join(os.path.dirname(cxx_compiler.compiler), "clang")] + clang_path = [os.path.join(os.path.dirname(cxx_compiler.compiler), + 'clang')] - clang_path = find_program( - clang_path[0] if clang_path else "clang++", toolchain_search_path - ) + clang_path = find_program(clang_path[0] if clang_path else 'clang++', + toolchain_search_path) if not clang_path: return # Hack before bug 1617793: if the compiler is clang-cl, hack the target - if cxx_compiler.type == "clang-cl": - target = split_triplet("%s-pc-windows-msvc" % target.raw_cpu, allow_msvc=True) + if cxx_compiler.type == 'clang-cl': + target = split_triplet('%s-pc-windows-msvc' % target.raw_cpu, allow_msvc=True) flags = prepare_flags(target, macos_sdk) - info = check_compiler([clang_path] + flags, "C++", target) + info = check_compiler([clang_path] + flags, 'C++', target) return namespace( path=clang_path, flags=flags + info.flags, ) -@depends("--with-libclang-path", bindgen_clang_compiler, host_library_name_info, host) -@checking("for libclang for bindgen", lambda x: x if x else "not found") -@imports("glob") -@imports(_from="os", _import="pathsep") -@imports(_from="os.path", _import="split", _as="pathsplit") -@imports("re") +@depends('--with-libclang-path', bindgen_clang_compiler, + host_library_name_info, host) +@checking('for libclang for bindgen', lambda x: x if x else 'not found') +@imports('glob') +@imports(_from='os', _import='pathsep') +@imports(_from='os.path', _import='split', _as='pathsplit') +@imports('re') def bindgen_libclang_path(libclang_path, clang, library_name_info, host): if not clang: if libclang_path: - die( - "--with-libclang-path is not valid without a clang compiler " - "for bindgen" - ) + die('--with-libclang-path is not valid without a clang compiler ' + 'for bindgen') return # Try to ensure that the clang shared library that bindgen is going # to look for is actually present. The files that we search for # mirror the logic in clang-sys/build.rs. libclang_choices = [] - if host.os == "WINNT": - libclang_choices.append("libclang.dll") - libclang_choices.append( - "%sclang%s" % (library_name_info.dll.prefix, library_name_info.dll.suffix) - ) - if host.kernel == "Linux": - libclang_choices.append("libclang.so.*") + if host.os == 'WINNT': + libclang_choices.append('libclang.dll') + libclang_choices.append('%sclang%s' % (library_name_info.dll.prefix, + library_name_info.dll.suffix)) + if host.kernel == 'Linux': + libclang_choices.append('libclang.so.*') - if host.os == "OpenBSD": - libclang_choices.append("libclang.so.*.*") + if host.os == 'OpenBSD': + libclang_choices.append('libclang.so.*.*') candidates = [] if not libclang_path: # Try to find libclang_path based on clang search dirs. - clang_search_dirs = check_cmd_output(clang.path, "-print-search-dirs") + clang_search_dirs = check_cmd_output(clang.path, '-print-search-dirs') for line in clang_search_dirs.splitlines(): - name, _, value = line.partition(": =") - if host.os == "WINNT" and name == "programs": + name, _, value = line.partition(': =') + if host.os == 'WINNT' and name == 'programs': # On Windows, libclang.dll is in bin/ rather than lib/, # so scan the programs search dirs. # To make matters complicated, clang before version 9 uses `:` @@ -202,22 +163,22 @@ def bindgen_libclang_path(libclang_path, clang, library_name_info, host): if pathsep in value: candidates.extend(value.split(pathsep)) else: - for part in value.split(":"): + for part in value.split(':'): # Assume that if previous "candidate" was of length 1, # it's a drive letter and the current part is the rest of # the corresponding full path. if candidates and len(candidates[-1]) == 1: - candidates[-1] += ":" + part + candidates[-1] += ':' + part else: candidates.append(part) - elif host.os != "WINNT" and name == "libraries": + elif host.os != 'WINNT' and name == 'libraries': # On other platforms, use the directories from the libraries # search dirs that looks like $something/clang/$version. for dir in value.split(pathsep): dir, version = pathsplit(dir) - if re.match(r"[0-9.]+", version): + if re.match(r'[0-9.]+', version): dir, name = pathsplit(dir) - if name == "clang": + if name == 'clang': candidates.append(dir) else: candidates.append(libclang_path[0]) @@ -237,20 +198,16 @@ def bindgen_config_paths(clang, libclang, build_project): # Actually, we don't want to force an error if we're not building the # browser generally. We therefore whitelist the projects that require # bindgen facilities at this point and leave it at that. - if build_project in ("browser", "mobile/android"): + if build_project in ('browser', 'mobile/android'): if not clang: - die( - "Could not find clang to generate run bindings for C/C++. " - "Please install the necessary packages, run `mach bootstrap`, " - "or use --with-clang-path to give the location of clang." - ) + die('Could not find clang to generate run bindings for C/C++. ' + 'Please install the necessary packages, run `mach bootstrap`, ' + 'or use --with-clang-path to give the location of clang.') if not libclang: - die( - "Could not find libclang to generate rust bindings for C/C++. " - "Please install the necessary packages, run `mach bootstrap`, " - "or use --with-libclang-path to give the path containing it." - ) + die('Could not find libclang to generate rust bindings for C/C++. ' + 'Please install the necessary packages, run `mach bootstrap`, ' + 'or use --with-libclang-path to give the path containing it.') if clang and libclang: return namespace( @@ -262,9 +219,9 @@ def bindgen_config_paths(clang, libclang, build_project): @depends(bindgen_config_paths.libclang, when=bindgen_config_paths) -@checking("that libclang is new enough", lambda s: "yes" if s else "no") -@imports(_from="ctypes", _import="CDLL") -@imports(_from="textwrap", _import="dedent") +@checking('that libclang is new enough', lambda s: 'yes' if s else 'no') +@imports(_from='ctypes', _import='CDLL') +@imports(_from='textwrap', _import='dedent') def min_libclang_version(libclang): try: lib = CDLL(libclang) @@ -273,94 +230,77 @@ def min_libclang_version(libclang): fun = lib.clang_getAddressSpace return True except: - die( - dedent( - """\ + die(dedent('''\ The libclang located at {} is too old (need at least 5.0). Please make sure to update it or point to a newer libclang using --with-libclang-path. - """.format( - libclang - ) - ) - ) + '''.format(libclang))) return False -set_config("MOZ_LIBCLANG_PATH", bindgen_config_paths.libclang_path) -set_config("MOZ_CLANG_PATH", bindgen_config_paths.clang_path) +set_config('MOZ_LIBCLANG_PATH', bindgen_config_paths.libclang_path) +set_config('MOZ_CLANG_PATH', bindgen_config_paths.clang_path) -@depends( - target, - target_is_unix, - cxx_compiler, - bindgen_cflags_android, - bindgen_config_paths.clang_flags, -) -def basic_bindgen_cflags(target, is_unix, compiler_info, android_cflags, clang_flags): +@depends(target, target_is_unix, cxx_compiler, bindgen_cflags_android, + bindgen_config_paths.clang_flags) +def basic_bindgen_cflags(target, is_unix, compiler_info, android_cflags, + clang_flags): args = [ - "-x", - "c++", - "-fno-sized-deallocation", - "-fno-aligned-new", - "-DTRACING=1", - "-DIMPL_LIBXUL", - "-DMOZILLA_INTERNAL_API", - "-DRUST_BINDGEN", + '-x', 'c++', '-fno-sized-deallocation', '-fno-aligned-new', + '-DTRACING=1', '-DIMPL_LIBXUL', '-DMOZILLA_INTERNAL_API', + '-DRUST_BINDGEN' ] if is_unix: - args += ["-DOS_POSIX=1"] + args += ['-DOS_POSIX=1'] - if target.os == "Android": + if target.os == 'Android': args += android_cflags args += { - "Android": ["-DOS_ANDROID=1"], - "DragonFly": ["-DOS_BSD=1", "-DOS_DRAGONFLY=1"], - "FreeBSD": ["-DOS_BSD=1", "-DOS_FREEBSD=1"], - "GNU": ["-DOS_LINUX=1"], - "NetBSD": ["-DOS_BSD=1", "-DOS_NETBSD=1"], - "OpenBSD": ["-DOS_BSD=1", "-DOS_OPENBSD=1"], - "OSX": ["-DOS_MACOSX=1", "-stdlib=libc++"], - "SunOS": ["-DOS_SOLARIS=1"], - "WINNT": [ - "-DOS_WIN=1", - "-DWIN32=1", + 'Android': ['-DOS_ANDROID=1'], + 'DragonFly': ['-DOS_BSD=1', '-DOS_DRAGONFLY=1'], + 'FreeBSD': ['-DOS_BSD=1', '-DOS_FREEBSD=1'], + 'GNU': ['-DOS_LINUX=1'], + 'NetBSD': ['-DOS_BSD=1', '-DOS_NETBSD=1'], + 'OpenBSD': ['-DOS_BSD=1', '-DOS_OPENBSD=1'], + 'OSX': ['-DOS_MACOSX=1', '-stdlib=libc++'], + 'SunOS': ['-DOS_SOLARIS=1'], + 'WINNT': [ + '-DOS_WIN=1', + '-DWIN32=1', ], }.get(target.os, []) - if compiler_info.type == "clang-cl": + if compiler_info.type == 'clang-cl': args += [ # To enable the builtin __builtin_offsetof so that CRT wouldn't # use reinterpret_cast in offsetof() which is not allowed inside # static_assert(). - "-D_CRT_USE_BUILTIN_OFFSETOF", + '-D_CRT_USE_BUILTIN_OFFSETOF', # Enable hidden attribute (which is not supported by MSVC and # thus not enabled by default with a MSVC-compatibile build) # to exclude hidden symbols from the generated file. - "-DHAVE_VISIBILITY_HIDDEN_ATTRIBUTE=1", + '-DHAVE_VISIBILITY_HIDDEN_ATTRIBUTE=1', ] return args + (clang_flags or []) -option( - env="BINDGEN_CFLAGS", - nargs=1, - help="Options bindgen should pass to the C/C++ parser", -) +option(env='BINDGEN_CFLAGS', + nargs=1, + help='Options bindgen should pass to the C/C++ parser') -@depends(basic_bindgen_cflags, "BINDGEN_CFLAGS") -@checking("bindgen cflags", lambda s: s if s else "no") +@depends(basic_bindgen_cflags, 'BINDGEN_CFLAGS') +@checking('bindgen cflags', lambda s: s if s else 'no') def bindgen_cflags(base_flags, extra_flags): flags = base_flags if extra_flags and len(extra_flags): flags += extra_flags[0].split() - return " ".join(flags) + return ' '.join(flags) -add_old_configure_assignment("_BINDGEN_CFLAGS", bindgen_cflags) +add_old_configure_assignment('_BINDGEN_CFLAGS', bindgen_cflags) diff --git a/build/moz.configure/checks.configure b/build/moz.configure/checks.configure index cfff05933a5a..5bb026dfdfa1 100644 --- a/build/moz.configure/checks.configure +++ b/build/moz.configure/checks.configure @@ -14,14 +14,13 @@ @template -@imports(_from="__builtin__", _import="Exception") +@imports(_from='__builtin__', _import='Exception') def _declare_exceptions(): class FatalCheckError(Exception): - """An exception to throw from a function decorated with @checking. + '''An exception to throw from a function decorated with @checking. It will result in calling die() with the given message. Debugging messages emitted from the decorated function will also be - printed out.""" - + printed out.''' return (FatalCheckError,) @@ -52,7 +51,7 @@ del _declare_exceptions def checking(what, callback=None): def decorator(func): def wrapped(*args, **kwargs): - log.info("checking %s... ", what) + log.info('checking %s... ', what) with log.queue_debug(): error, ret = None, None try: @@ -61,17 +60,15 @@ def checking(what, callback=None): error = str(e) display_ret = callback(ret) if callback else ret if display_ret is True: - log.info("yes") + log.info('yes') elif display_ret is False or display_ret is None: - log.info("no") + log.info('no') else: log.info(display_ret) if error is not None: die(error) return ret - return wrapped - return decorator @@ -104,17 +101,9 @@ def checking(what, callback=None): # it can find. If PROG is already set from the environment or command line, # use that value instead. @template -@imports(_from="mozbuild.shellutil", _import="quote") -def check_prog( - var, - progs, - what=None, - input=None, - allow_missing=False, - paths=None, - paths_have_priority=False, - when=None, -): +@imports(_from='mozbuild.shellutil', _import='quote') +def check_prog(var, progs, what=None, input=None, allow_missing=False, + paths=None, paths_have_priority=False, when=None): if input is not None: # Wrap input with type checking and normalization. @depends(input, when=when) @@ -125,18 +114,11 @@ def check_prog( return (value,) if isinstance(value, (tuple, list)) and len(value) == 1: return value - configure_error( - "input must resolve to a tuple or a list with a " - "single element, or a string" - ) - + configure_error('input must resolve to a tuple or a list with a ' + 'single element, or a string') else: - option( - env=var, - nargs=1, - when=when, - help="Path to %s" % (what or "the %s program" % var.lower()), - ) + option(env=var, nargs=1, when=when, + help='Path to %s' % (what or 'the %s program' % var.lower())) input = var what = what or var.lower() @@ -156,12 +138,12 @@ def check_prog( progs = () if not isinstance(progs, (tuple, list)): - configure_error("progs must resolve to a list or tuple!") + configure_error('progs must resolve to a list or tuple!') return namespace(value=input, progs=progs, paths=paths) @depends(inputs, allow_missing, when=inputs) - @checking("for %s" % what, lambda x: quote(x) if x else "not found") + @checking('for %s' % what, lambda x: quote(x) if x else 'not found') def check(inputs, allow_missing): value = inputs.value progs = inputs.progs @@ -170,19 +152,19 @@ def check_prog( if paths_have_priority: for path in paths: for prog in value or progs: - log.debug("%s: Trying %s", var.lower(), quote(prog)) + log.debug('%s: Trying %s', var.lower(), quote(prog)) result = find_program(prog, [path]) if result: return result else: for prog in value or progs: - log.debug("%s: Trying %s", var.lower(), quote(prog)) + log.debug('%s: Trying %s', var.lower(), quote(prog)) result = find_program(prog, paths) if result: return result if not allow_missing or value: - raise FatalCheckError("Cannot find %s" % what) + raise FatalCheckError('Cannot find %s' % what) set_config(var, check) diff --git a/build/moz.configure/compile-checks.configure b/build/moz.configure/compile-checks.configure index 25e4f80bf5b7..b795c23c58d2 100755 --- a/build/moz.configure/compile-checks.configure +++ b/build/moz.configure/compile-checks.configure @@ -18,23 +18,14 @@ # - `check_msg` is the message to be printed to accompany compiling the test # program. @template -def try_compile( - includes=None, - body="", - language="C++", - flags=None, - check_msg=None, - when=None, - onerror=lambda: None, -): +def try_compile(includes=None, body='', language='C++', flags=None, check_msg=None, + when=None, onerror=lambda: None): compiler = { - "C": c_compiler, - "C++": cxx_compiler, + 'C': c_compiler, + 'C++': cxx_compiler, }[language] - return compiler.try_compile( - includes, body, flags, check_msg, when=when, onerror=onerror - ) + return compiler.try_compile(includes, body, flags, check_msg, when=when, onerror=onerror) # Checks for the presence of the given header on the target system by compiling @@ -53,9 +44,8 @@ def try_compile( # - `when` is a depends function that if present will make performing the check # conditional on the value of that function. @template -def check_header( - header, language="C++", flags=None, includes=None, when=None, onerror=lambda: None -): +def check_header(header, language='C++', flags=None, includes=None, when=None, + onerror=lambda: None): if when is None: when = always @@ -65,21 +55,15 @@ def check_header( includes = [] includes.append(header) - have_header = try_compile( - includes=includes, - language=language, - flags=flags, - check_msg="for %s" % header, - when=when, - onerror=onerror, - ) - header_var = "HAVE_%s" % ( - header.upper().replace("-", "_").replace("/", "_").replace(".", "_") - ) + have_header = try_compile(includes=includes, language=language, flags=flags, + check_msg='for %s' % header, when=when, onerror=onerror) + header_var = 'HAVE_%s' % (header.upper() + .replace('-', '_') + .replace('/', '_') + .replace('.', '_')) set_define(header_var, have_header) return have_header - # A convenience wrapper for check_header for checking multiple headers. # returns an array of the resulting checks in order corresponding to the # provided headers. @@ -99,28 +83,28 @@ def check_headers(*headers, **kwargs): # a test program. The return value of the template is a check function # returning True if the symbol can be found, and None if it is not. @template -def check_symbol(symbol, language="C", flags=None, when=None, onerror=lambda: None): +def check_symbol(symbol, language='C', flags=None, when=None, onerror=lambda: None): if when is None: when = always compiler = { - "C": c_compiler, - "C++": cxx_compiler, + 'C': c_compiler, + 'C++': cxx_compiler, }[language] # Stolen from autoconf 2.13 ; might be irrelevant now, but it doesn't hurt to # keep using a char return type. comment = [ - "/* Override any gcc2 internal prototype to avoid an error. */", - "/* We use char because int might match the return type of a gcc2", - " builtin and then its argument prototype would still apply. */", + '/* Override any gcc2 internal prototype to avoid an error. */', + '/* We use char because int might match the return type of a gcc2', + ' builtin and then its argument prototype would still apply. */', ] return compiler.try_run( - header=comment + ["char %s();" % symbol], - body="%s();" % symbol, + header=comment + ['char %s();' % symbol], + body='%s();' % symbol, flags=flags, - check_msg="for %s" % symbol, + check_msg='for %s' % symbol, when=when, onerror=onerror, ) @@ -142,9 +126,8 @@ def check_symbol(symbol, language="C", flags=None, when=None, onerror=lambda: No # - `check`, when not set, skips checking whether the flag is supported and # adds it to the list of flags unconditionally. @template -def check_and_add_flags( - flag, flags_collection, test_flags, compiler=None, when=None, check=True -): +def check_and_add_flags(flag, flags_collection, test_flags, + compiler=None, when=None, check=True): if compiler is not None: compilers = (compiler,) else: @@ -161,34 +144,32 @@ def check_and_add_flags( flags = [flag] for c in compilers: - assert c in {c_compiler, cxx_compiler, host_c_compiler, host_cxx_compiler} + assert c in {c_compiler, cxx_compiler, + host_c_compiler, host_cxx_compiler} lang, list_of_flags = { - c_compiler: ("C", flags_collection.cflags), - cxx_compiler: ("C++", flags_collection.cxxflags), - host_c_compiler: ("host C", flags_collection.host_cflags), - host_cxx_compiler: ("host C++", flags_collection.host_cxxflags), + c_compiler: ('C', flags_collection.cflags), + cxx_compiler: ('C++', flags_collection.cxxflags), + host_c_compiler: ('host C', flags_collection.host_cflags), + host_cxx_compiler: ('host C++', flags_collection.host_cxxflags), }[c] @depends(c, when) def result(c, when): - if when and c.type in ("clang", "gcc"): + if when and c.type in ('clang', 'gcc'): return True if check: - @depends(c, dependable(flags)) def flags(c, flags): # Don't error out just because clang complains about other things. - if c.type == "clang": - flags += ["-Wno-error=unused-command-line-argument"] + if c.type == 'clang': + flags += ['-Wno-error=unused-command-line-argument'] return flags result = c.try_compile( - flags=flags, - when=result, - check_msg="whether the %s compiler supports %s" % (lang, flag), - ) + flags=flags, when=result, + check_msg='whether the %s compiler supports %s' % (lang, flag)) @depends(result, list_of_flags) def maybe_add_flag(result, list_of_flags): @@ -223,16 +204,15 @@ def check_and_add_gcc_warning(warning, compiler=None, when=None, check=True): # warning option like -Wno-foobar. So when we are checking for support # of a negated warning option, we actually test the positive form, but # add the negated form to the flags variable. - if warning.startswith("-Wno-") and not warning.startswith("-Wno-error="): - flags = ["-Werror", "-W" + warning[5:]] - elif warning.startswith("-Werror="): + if warning.startswith('-Wno-') and not warning.startswith('-Wno-error='): + flags = ['-Werror', '-W' + warning[5:]] + elif warning.startswith('-Werror='): flags = [warning] else: - flags = ["-Werror", warning] + flags = ['-Werror', warning] - return check_and_add_flags( - warning, warnings_flags, flags, compiler=compiler, when=when, check=check - ) + return check_and_add_flags(warning, warnings_flags, flags, + compiler=compiler, when=when, check=check) # Add the given warning to the list of warning flags for the build. @@ -268,11 +248,10 @@ def compilation_flags(): # add_gcc_flag(). @template def check_and_add_gcc_flag(flag, compiler=None, when=None, check=True): - flags = ["-Werror", flag] + flags = ['-Werror', flag] - return check_and_add_flags( - flag, compilation_flags, flags, compiler=compiler, when=when, check=check - ) + return check_and_add_flags(flag, compilation_flags, flags, + compiler=compiler, when=when, check=check) # Add the given flag to the list of flags for the build. diff --git a/build/moz.configure/compilers-util.configure b/build/moz.configure/compilers-util.configure index 1d8930347f58..501855c5c841 100644 --- a/build/moz.configure/compilers-util.configure +++ b/build/moz.configure/compilers-util.configure @@ -6,8 +6,8 @@ @template -@imports("textwrap") -@imports(_from="mozbuild.configure", _import="SandboxDependsFunction") +@imports('textwrap') +@imports(_from='mozbuild.configure', _import='SandboxDependsFunction') def compiler_class(compiler, host_or_target): is_target = host_or_target is target @@ -24,34 +24,22 @@ def compiler_class(compiler, host_or_target): # `-c`. # - `check_msg` is the message to be printed to accompany compiling the # test program. - def try_compile( - self, - includes=None, - body="", - flags=None, - check_msg=None, - when=None, - onerror=lambda: None, - ): + def try_compile(self, includes=None, body='', flags=None, + check_msg=None, when=None, onerror=lambda: None): @depends(dependable(flags)) def flags(flags): flags = list(flags or []) - flags.append("-c") + flags.append('-c') return flags @depends(dependable(includes)) def header(includes): includes = includes or [] - return ["#include <%s>" % f for f in includes] + return ['#include <%s>' % f for f in includes] return self.try_run( - header=header, - body=body, - flags=flags, - check_msg=check_msg, - when=when, - onerror=onerror, - ) + header=header, body=body, flags=flags, check_msg=check_msg, + when=when, onerror=onerror) # Generates a test program and run the compiler against it. In case of # failure, the resulting check will return None. @@ -64,17 +52,9 @@ def compiler_class(compiler, host_or_target): # - `check_msg` is the message to be printed to accompany compiling the # test program. # - `onerror` is a function called when the check fails. - def try_run( - self, - header=None, - body="", - flags=None, - check_msg=None, - when=None, - onerror=lambda: None, - ): - source = textwrap.dedent( - """\ + def try_run(self, header=None, body='', flags=None, + check_msg=None, when=None, onerror=lambda: None): + source = textwrap.dedent('''\ int main(void) { @@ -82,51 +62,35 @@ def compiler_class(compiler, host_or_target): ; return 0; } - """ - % body - ) + ''' % body) if check_msg: - def checking_fn(fn): return checking(check_msg)(fn) - else: - def checking_fn(fn): return fn - @depends( - self, - dependable(flags), - extra_toolchain_flags, - stlport_cppflags, - dependable(header), - when=when, - ) + @depends(self, dependable(flags), extra_toolchain_flags, + stlport_cppflags, dependable(header), when=when) @checking_fn def func(compiler, flags, extra_flags, stlport_flags, header): flags = list(flags or []) if is_target: flags += extra_flags or [] - if compiler.language == "C++": + if compiler.language == 'C++': flags += stlport_flags or [] - header = header or "" + header = header or '' if isinstance(header, (list, tuple)): - header = "\n".join(header) + header = '\n'.join(header) if header: - header += "\n" + header += '\n' - if ( - try_invoke_compiler( - compiler.wrapper + [compiler.compiler] + compiler.flags, - compiler.language, - header + source, - flags, - onerror=onerror, - ) - is not None - ): + if try_invoke_compiler( + compiler.wrapper + + [compiler.compiler] + compiler.flags, + compiler.language, header + source, flags, + onerror=onerror) is not None: return True return func diff --git a/build/moz.configure/flags.configure b/build/moz.configure/flags.configure index e8bf6157b743..a499470e5542 100644 --- a/build/moz.configure/flags.configure +++ b/build/moz.configure/flags.configure @@ -6,73 +6,60 @@ # We support C++14, but we don't want to enable the sized deallocation # facilities in C++14 yet. -check_and_add_gcc_flag("-fno-sized-deallocation", compiler=cxx_compiler) +check_and_add_gcc_flag('-fno-sized-deallocation', compiler=cxx_compiler) # Likewise for C++17 and aligned allocation. It's not immediately obvious # from the clang and GCC documentation, but they both support this. -check_and_add_gcc_flag("-fno-aligned-new", compiler=cxx_compiler) +check_and_add_gcc_flag('-fno-aligned-new', compiler=cxx_compiler) # Please keep these last in this file. -add_old_configure_assignment("_COMPILATION_CFLAGS", compilation_flags.cflags) -add_old_configure_assignment("_COMPILATION_CXXFLAGS", compilation_flags.cxxflags) -add_old_configure_assignment("_COMPILATION_HOST_CFLAGS", compilation_flags.host_cflags) +add_old_configure_assignment('_COMPILATION_CFLAGS', compilation_flags.cflags) add_old_configure_assignment( - "_COMPILATION_HOST_CXXFLAGS", compilation_flags.host_cxxflags -) + '_COMPILATION_CXXFLAGS', compilation_flags.cxxflags) +add_old_configure_assignment( + '_COMPILATION_HOST_CFLAGS', compilation_flags.host_cflags) +add_old_configure_assignment( + '_COMPILATION_HOST_CXXFLAGS', compilation_flags.host_cxxflags) @depends(rust_compile_flags, rust_warning_flags) def rust_flags(compile_flags, warning_flags): return compile_flags + warning_flags - -set_config("MOZ_RUST_DEFAULT_FLAGS", rust_flags) +set_config('MOZ_RUST_DEFAULT_FLAGS', rust_flags) -option( - "--disable-new-pass-manager", - help="Use the legacy LLVM pass manager in clang builds", -) +option('--disable-new-pass-manager', + help='Use the legacy LLVM pass manager in clang builds') - -@depends( - "--enable-new-pass-manager", - c_compiler, - host, - target, - "MOZ_PGO", - lto.enabled, - enable_fuzzing, - ubsan, -) -def new_pass_manager_flags( - enabled, compiler, host, target, pgo, lto, enable_fuzzing, ubsan -): - if host.os == "OSX": +@depends('--enable-new-pass-manager', c_compiler, host, target, 'MOZ_PGO', + lto.enabled, enable_fuzzing, ubsan) +def new_pass_manager_flags(enabled, compiler, host, target, pgo, lto, + enable_fuzzing, ubsan): + if host.os == 'OSX': # Some native Mac builds hang with the new pass manager. Given the # inability to test in CI, don't take the risk of further breakage. return None - if target.os == "OSX" and not pgo: + if target.os == 'OSX' and not pgo: # Also disable when cross-compiling to Mac, because plain-ish opt # builds hang. Variants like asan and ccov work fine, but it would be # too tedious to test them all here. PGO is the only thing that matters # enough to make an exception for. return None - if target.os == "WINNT" and target.cpu == "aarch64" and not lto: + if target.os == 'WINNT' and target.cpu == 'aarch64' and not lto: # Building without LTO on aarch64-windows fails on some large functions # because clang doesn't know how to split SEH unwind info. return None - if enable_fuzzing and compiler.version < "10.0.0": + if enable_fuzzing and compiler.version < '10.0.0': # Clang 9 does not seem to play well with libFuzzer return None - if ubsan and compiler.version >= "10.0.0": + if ubsan and compiler.version >= '10.0.0': # Temporary until https://bugs.llvm.org/show_bug.cgi?id=45835 gets a # real fix: clang 10 hangs with some ubsan-inserted code constructs. return None - if enabled and compiler.version >= "9.0.0": - if compiler.type == "clang": - return ["-fexperimental-new-pass-manager"] - elif compiler.type == "clang-cl": - return ["-Xclang", "-fexperimental-new-pass-manager"] - + if enabled and compiler.version >= '9.0.0': + if compiler.type == 'clang': + return ['-fexperimental-new-pass-manager'] + elif compiler.type == 'clang-cl': + return ['-Xclang', '-fexperimental-new-pass-manager'] -set_config("MOZ_NEW_PASS_MANAGER_FLAGS", new_pass_manager_flags) +set_config('MOZ_NEW_PASS_MANAGER_FLAGS', new_pass_manager_flags) diff --git a/build/moz.configure/headers.configure b/build/moz.configure/headers.configure index 843f5ad1052d..9445f10a4d53 100644 --- a/build/moz.configure/headers.configure +++ b/build/moz.configure/headers.configure @@ -5,97 +5,89 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. # Check for headers defining standard int types. -check_header("stdint.h") -have_inttypes = check_header("inttypes.h") +check_header('stdint.h') +have_inttypes = check_header('inttypes.h') # Assume we have ansi C header files available. -set_define("STDC_HEADERS", True) +set_define('STDC_HEADERS', True) -set_config("HAVE_INTTYPES_H", have_inttypes) +set_config('HAVE_INTTYPES_H', have_inttypes) -building_linux = depends(target)(lambda target: target.kernel == "Linux") +building_linux = depends(target)(lambda target: target.kernel == 'Linux') -have_malloc = check_header("malloc.h") +have_malloc = check_header('malloc.h') -check_header("alloca.h") +check_header('alloca.h') -add_old_configure_assignment("HAVE_MALLOC_H", have_malloc) +add_old_configure_assignment('HAVE_MALLOC_H', have_malloc) check_headers( - "sys/byteorder.h", - "getopt.h", - "unistd.h", - "nl_types.h", - "cpuid.h", - "fts.h", + 'sys/byteorder.h', + 'getopt.h', + 'unistd.h', + 'nl_types.h', + 'cpuid.h', + 'fts.h', ) # These are all the places some variant of statfs can be hiding. check_headers( - "sys/statvfs.h", - "sys/statfs.h", - "sys/vfs.h", - "sys/mount.h", + 'sys/statvfs.h', + 'sys/statfs.h', + 'sys/vfs.h', + 'sys/mount.h', ) # Quota support # Check for both the header and quotactl() because Android headers can have the # header but not quotactl(). -set_define( - "HAVE_SYS_QUOTA_H", - try_compile( - includes=["sys/quota.h"], - body="quotactl(0, nullptr, 0, (caddr_t)nullptr);", - check_msg="for sys/quota.h", - ), -) -check_header("linux/quota.h", includes=["sys/socket.h"], when=building_linux) +set_define('HAVE_SYS_QUOTA_H', + try_compile(includes=['sys/quota.h'], + body='quotactl(0, nullptr, 0, (caddr_t)nullptr);', + check_msg='for sys/quota.h')) +check_header('linux/quota.h', + includes=['sys/socket.h'], + when=building_linux) # SCTP support - needs various network include headers check_headers( - "linux/if_addr.h", - "linux/rtnetlink.h", - includes=["sys/socket.h"], + 'linux/if_addr.h', + 'linux/rtnetlink.h', + includes=['sys/socket.h'], when=building_linux, ) -check_header("sys/queue.h") +check_header('sys/queue.h') check_headers( - "sys/types.h", - "netinet/in.h", - "byteswap.h", + 'sys/types.h', + 'netinet/in.h', + 'byteswap.h', ) # TODO: Move these checks to file specific to --enable-project=js. -have_perf_event_h = check_header("linux/perf_event.h", when=building_linux) +have_perf_event_h = check_header('linux/perf_event.h', + when=building_linux) -option( - "--with-linux-headers", - help="location where the Linux kernel headers can be found", - nargs=1, -) +option('--with-linux-headers', + help='location where the Linux kernel headers can be found', + nargs=1) -passed_linux_header_flags = depends_if("--with-linux-headers")( - lambda v: ["-I%s" % v[0]] -) +passed_linux_header_flags = depends_if( + '--with-linux-headers')(lambda v: ['-I%s' % v[0]]) -@depends( - try_compile( - includes=["asm/unistd.h"], - body="return sizeof(__NR_perf_event_open);", - flags=passed_linux_header_flags, - check_msg="for perf_event_open system call", - ), - when=have_perf_event_h, -) +@depends(try_compile(includes=['asm/unistd.h'], + body='return sizeof(__NR_perf_event_open);', + flags=passed_linux_header_flags, + check_msg='for perf_event_open system call'), + when=have_perf_event_h) def have_perf_event_open(have_perf_event_open): if have_perf_event_open: return True -set_config("HAVE_LINUX_PERF_EVENT_H", have_perf_event_open) +set_config('HAVE_LINUX_PERF_EVENT_H', have_perf_event_open) @depends(passed_linux_header_flags, have_perf_event_open) @@ -104,4 +96,4 @@ def linux_headers_includes(passed_linux_header_flags, have_perf_event_open): return passed_linux_header_flags[0] -set_config("LINUX_HEADERS_INCLUDES", linux_headers_includes) +set_config('LINUX_HEADERS_INCLUDES', linux_headers_includes) diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure index 4c6d73ee92f6..e9c9d2f0d5c3 100644 --- a/build/moz.configure/init.configure +++ b/build/moz.configure/init.configure @@ -4,8 +4,8 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -include("util.configure") -include("checks.configure") +include('util.configure') +include('checks.configure') # Make `toolkit` available when toolkit/moz.configure is not included. toolkit = dependable(None) @@ -13,23 +13,24 @@ toolkit = dependable(None) # build/moz.configure/bindgen.configure is not included. bindgen_config_paths = dependable(None) -option(env="DIST", nargs=1, help="DIST directory") +option(env='DIST', nargs=1, help='DIST directory') # Do not allow objdir == srcdir builds. # ============================================================== -@depends("--help", "DIST") -@imports(_from="__builtin__", _import="open") -@imports(_from="os.path", _import="exists") -@imports(_from="six", _import="ensure_text") +@depends('--help', 'DIST') +@imports(_from='__builtin__', _import='open') +@imports(_from='os.path', _import='exists') +@imports(_from='six', _import='ensure_text') def check_build_environment(help, dist): - topobjdir = os.path.realpath(".") - topsrcdir = os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..")) + topobjdir = os.path.realpath('.') + topsrcdir = os.path.realpath( + os.path.join(os.path.dirname(__file__), '..', '..')) if dist: dist = normsep(dist[0]) else: - dist = os.path.join(topobjdir, "dist") + dist = os.path.join(topobjdir, 'dist') result = namespace( topsrcdir=topsrcdir, @@ -49,86 +50,87 @@ def check_build_environment(help, dist): # backend will make this limitation go away. But there is likely a long tail # of things that will need fixing due to e.g. lack of proper path quoting. if len(topsrcdir.split()) > 1: - die("Source directory cannot be located in a path with spaces: %s" % topsrcdir) + die('Source directory cannot be located in a path with spaces: %s' % + topsrcdir) if len(topobjdir.split()) > 1: - die("Object directory cannot be located in a path with spaces: %s" % topobjdir) + die('Object directory cannot be located in a path with spaces: %s' % + topobjdir) if topsrcdir == topobjdir: - die( - " ***\n" - " * Building directly in the main source directory is not allowed.\n" - " *\n" - " * To build, you must run configure from a separate directory\n" - " * (referred to as an object directory).\n" - " *\n" - " * If you are building with a mozconfig, you will need to change your\n" - " * mozconfig to point to a different object directory.\n" - " ***" - ) + die(' ***\n' + ' * Building directly in the main source directory is not allowed.\n' + ' *\n' + ' * To build, you must run configure from a separate directory\n' + ' * (referred to as an object directory).\n' + ' *\n' + ' * If you are building with a mozconfig, you will need to change your\n' + ' * mozconfig to point to a different object directory.\n' + ' ***' + ) # Check for CRLF line endings. - with open(os.path.join(topsrcdir, "configure.py"), "r") as fh: + with open(os.path.join(topsrcdir, 'configure.py'), 'r') as fh: data = ensure_text(fh.read()) - if "\r" in data: - die( - "\n ***\n" - " * The source tree appears to have Windows-style line endings.\n" - " *\n" - " * If using Git, Git is likely configured to use Windows-style\n" - " * line endings.\n" - " *\n" - " * To convert the working copy to UNIX-style line endings, run\n" - " * the following:\n" - " *\n" - " * $ git config core.autocrlf false\n" - " * $ git config core.eof lf\n" - " * $ git rm --cached -r .\n" - " * $ git reset --hard\n" - " *\n" - " * If not using Git, the tool you used to obtain the source\n" - " * code likely converted files to Windows line endings. See\n" - " * usage information for that tool for more.\n" - " ***" - ) + if '\r' in data: + die('\n ***\n' + ' * The source tree appears to have Windows-style line endings.\n' + ' *\n' + ' * If using Git, Git is likely configured to use Windows-style\n' + ' * line endings.\n' + ' *\n' + ' * To convert the working copy to UNIX-style line endings, run\n' + ' * the following:\n' + ' *\n' + ' * $ git config core.autocrlf false\n' + ' * $ git config core.eof lf\n' + ' * $ git rm --cached -r .\n' + ' * $ git reset --hard\n' + ' *\n' + ' * If not using Git, the tool you used to obtain the source\n' + ' * code likely converted files to Windows line endings. See\n' + ' * usage information for that tool for more.\n' + ' ***') # Check for a couple representative files in the source tree conflict_files = [ - "* %s" % f - for f in ("Makefile", "config/autoconf.mk") + '* %s' % f for f in ('Makefile', 'config/autoconf.mk') if exists(os.path.join(topsrcdir, f)) ] if conflict_files: - die( - " ***\n" - " * Your source tree contains these files:\n" - " %s\n" - " * This indicates that you previously built in the source tree.\n" - " * A source tree build can confuse the separate objdir build.\n" - " *\n" - " * To clean up the source tree:\n" - " * 1. cd %s\n" - " * 2. gmake distclean\n" - " ***" % ("\n ".join(conflict_files), topsrcdir) - ) + die(' ***\n' + ' * Your source tree contains these files:\n' + ' %s\n' + ' * This indicates that you previously built in the source tree.\n' + ' * A source tree build can confuse the separate objdir build.\n' + ' *\n' + ' * To clean up the source tree:\n' + ' * 1. cd %s\n' + ' * 2. gmake distclean\n' + ' ***' + % ('\n '.join(conflict_files), topsrcdir) + ) return result -set_config("TOPSRCDIR", check_build_environment.topsrcdir) -set_config("TOPOBJDIR", check_build_environment.topobjdir) -set_config("DIST", check_build_environment.dist) +set_config('TOPSRCDIR', check_build_environment.topsrcdir) +set_config('TOPOBJDIR', check_build_environment.topobjdir) +set_config('DIST', check_build_environment.dist) -add_old_configure_assignment("_topsrcdir", check_build_environment.topsrcdir) -add_old_configure_assignment("_objdir", check_build_environment.topobjdir) -add_old_configure_assignment("DIST", check_build_environment.dist) +add_old_configure_assignment( + '_topsrcdir', check_build_environment.topsrcdir) +add_old_configure_assignment( + '_objdir', check_build_environment.topobjdir) +add_old_configure_assignment( + 'DIST', check_build_environment.dist) -option(env="MOZ_AUTOMATION", help="Enable options for automated builds") -set_config("MOZ_AUTOMATION", depends_if("MOZ_AUTOMATION")(lambda x: True)) +option(env='MOZ_AUTOMATION', help='Enable options for automated builds') +set_config('MOZ_AUTOMATION', depends_if('MOZ_AUTOMATION')(lambda x: True)) -option(env="OLD_CONFIGURE", nargs=1, help="Path to the old configure script") +option(env='OLD_CONFIGURE', nargs=1, help='Path to the old configure script') -option(env="MOZCONFIG", nargs=1, help="Mozconfig location") +option(env='MOZCONFIG', nargs=1, help='Mozconfig location') # Read user mozconfig @@ -138,12 +140,13 @@ option(env="MOZCONFIG", nargs=1, help="Mozconfig location") # be called when --help is passed, and the mozconfig wouldn't be read. -@depends("MOZCONFIG", "OLD_CONFIGURE", check_build_environment, "--help") -@imports(_from="mozbuild.mozconfig", _import="MozconfigLoader") -@imports(_from="mozboot.mozconfig", _import="find_mozconfig") +@depends('MOZCONFIG', 'OLD_CONFIGURE', check_build_environment, + '--help') +@imports(_from='mozbuild.mozconfig', _import='MozconfigLoader') +@imports(_from='mozboot.mozconfig', _import='find_mozconfig') def mozconfig(mozconfig, old_configure, build_env, help): if not old_configure and not help: - die("The OLD_CONFIGURE environment variable must be set") + die('The OLD_CONFIGURE environment variable must be set') # Don't read the mozconfig for the js configure (yay backwards # compatibility) @@ -161,53 +164,52 @@ def mozconfig(mozconfig, old_configure, build_env, help): # OLD_CONFIGURE path, which points to js/src/old-configure. # I expect we'll have figured things out for mozconfigs well before # old-configure dies. - if old_configure and os.path.dirname(os.path.abspath(old_configure[0])).endswith( - "/js/src" - ): - return {"path": None} + if old_configure and os.path.dirname(os.path.abspath(old_configure[0])).endswith('/js/src'): + return {'path': None} topsrcdir = build_env.topsrcdir loader = MozconfigLoader(topsrcdir) mozconfig = mozconfig[0] if mozconfig else None - mozconfig = find_mozconfig(topsrcdir, env={"MOZCONFIG": mozconfig}) + mozconfig = find_mozconfig(topsrcdir, env={'MOZCONFIG': mozconfig}) mozconfig = loader.read_mozconfig(mozconfig) return mozconfig -set_config("MOZCONFIG", depends(mozconfig)(lambda m: m["path"])) +set_config('MOZCONFIG', depends(mozconfig)(lambda m: m['path'])) # Mozilla-Build # ============================================================== -option(env="MOZILLABUILD", nargs=1, help="Path to Mozilla Build (Windows-only)") +option(env='MOZILLABUILD', nargs=1, + help='Path to Mozilla Build (Windows-only)') -option(env="CONFIG_SHELL", nargs=1, help="Path to a POSIX shell") +option(env='CONFIG_SHELL', nargs=1, help='Path to a POSIX shell') # It feels dirty replicating this from python/mozbuild/mozbuild/mozconfig.py, # but the end goal being that the configure script would go away... -@depends("CONFIG_SHELL", "MOZILLABUILD") -@checking("for a shell") -@imports("sys") +@depends('CONFIG_SHELL', 'MOZILLABUILD') +@checking('for a shell') +@imports('sys') def shell(value, mozillabuild): if value: return find_program(value[0]) - shell = "sh" + shell = 'sh' if mozillabuild: - shell = mozillabuild[0] + "/msys/bin/sh" - if sys.platform == "win32": - shell = shell + ".exe" + shell = mozillabuild[0] + '/msys/bin/sh' + if sys.platform == 'win32': + shell = shell + '.exe' return find_program(shell) # This defines a reasonable shell for when running with --help. # If one was passed in the environment, though, fall back to that. -@depends("--help", "CONFIG_SHELL") +@depends('--help', 'CONFIG_SHELL') def help_shell(help, shell): if help and not shell: - return "sh" + return 'sh' shell = help_shell | shell @@ -216,28 +218,25 @@ shell = help_shell | shell # Python 3 # ======== -option(env="PYTHON3", nargs=1, help="Python 3 interpreter (3.6 or later)") - -option( - env="VIRTUALENV_NAME", - nargs=1, - default="init_py3", - help="Name of the in-objdir virtualenv", -) - - -@depends("PYTHON3", "VIRTUALENV_NAME", check_build_environment, mozconfig, "--help") -@imports(_from="__builtin__", _import="Exception") -@imports("os") -@imports("sys") -@imports("subprocess") -@imports("distutils.sysconfig") -@imports(_from="mozbuild.configure.util", _import="LineIO") -@imports(_from="mozbuild.virtualenv", _import="VirtualenvManager") -@imports(_from="mozbuild.virtualenv", _import="verify_python_version") -@imports(_from="mozbuild.pythonutil", _import="find_python3_executable") -@imports(_from="mozbuild.pythonutil", _import="python_executable_version") -@imports(_from="six", _import="ensure_text") +option(env='PYTHON3', nargs=1, help='Python 3 interpreter (3.6 or later)') + +option(env='VIRTUALENV_NAME', nargs=1, default='init_py3', + help='Name of the in-objdir virtualenv') + + +@depends('PYTHON3', 'VIRTUALENV_NAME', check_build_environment, mozconfig, + '--help') +@imports(_from='__builtin__', _import='Exception') +@imports('os') +@imports('sys') +@imports('subprocess') +@imports('distutils.sysconfig') +@imports(_from='mozbuild.configure.util', _import='LineIO') +@imports(_from='mozbuild.virtualenv', _import='VirtualenvManager') +@imports(_from='mozbuild.virtualenv', _import='verify_python_version') +@imports(_from='mozbuild.pythonutil', _import='find_python3_executable') +@imports(_from='mozbuild.pythonutil', _import='python_executable_version') +@imports(_from='six', _import='ensure_text') def virtualenv_python3(env_python, virtualenv_name, build_env, mozconfig, help): # Avoid re-executing python when running configure --help. if help: @@ -262,15 +261,15 @@ def virtualenv_python3(env_python, virtualenv_name, build_env, mozconfig, help): # Ideally we'd rely on the mozconfig injection from mozconfig_options, # but we'd rather avoid the verbosity when we need to reexecute with # a different python. - if mozconfig["path"]: - if "PYTHON3" in mozconfig["env"]["added"]: - python = mozconfig["env"]["added"]["PYTHON3"] - elif "PYTHON3" in mozconfig["env"]["modified"]: - python = mozconfig["env"]["modified"]["PYTHON3"][1] - elif "PYTHON3" in mozconfig["vars"]["added"]: - python = mozconfig["vars"]["added"]["PYTHON3"] - elif "PYTHON3" in mozconfig["vars"]["modified"]: - python = mozconfig["vars"]["modified"]["PYTHON3"][1] + if mozconfig['path']: + if 'PYTHON3' in mozconfig['env']['added']: + python = mozconfig['env']['added']['PYTHON3'] + elif 'PYTHON3' in mozconfig['env']['modified']: + python = mozconfig['env']['modified']['PYTHON3'][1] + elif 'PYTHON3' in mozconfig['vars']['added']: + python = mozconfig['vars']['added']['PYTHON3'] + elif 'PYTHON3' in mozconfig['vars']['modified']: + python = mozconfig['vars']['modified']['PYTHON3'][1] log.debug("python3: executable from configuration: %r" % python) @@ -285,27 +284,25 @@ def virtualenv_python3(env_python, virtualenv_name, build_env, mozconfig, help): # See mozilla-central changeset d2cce982a7c809815d86d5daecefe2e7a563ecca # Bug 784841 topsrcdir, topobjdir = build_env.topsrcdir, build_env.topobjdir - if topobjdir.endswith("/js/src"): + if topobjdir.endswith('/js/src'): topobjdir = topobjdir[:-7] - virtualenvs_root = os.path.join(topobjdir, "_virtualenvs") - with LineIO(lambda l: log.info(l), "replace") as out: + virtualenvs_root = os.path.join(topobjdir, '_virtualenvs') + with LineIO(lambda l: log.info(l), 'replace') as out: manager = VirtualenvManager( topsrcdir, - os.path.join(virtualenvs_root, virtualenv_name), - out, - os.path.join(topsrcdir, "build", "build_virtualenv_packages.txt"), - ) + os.path.join(virtualenvs_root, virtualenv_name), out, + os.path.join(topsrcdir, 'build', 'build_virtualenv_packages.txt')) # If we're not in the virtualenv, we need to update the path to include some # necessary modules for find_program. - if "MOZBUILD_VIRTUALENV" in os.environ: + if 'MOZBUILD_VIRTUALENV' in os.environ: python = sys.executable else: - sys.path.insert(0, os.path.join(topsrcdir, "testing", "mozbase", "mozfile")) sys.path.insert( - 0, os.path.join(topsrcdir, "third_party", "python", "backports") - ) + 0, os.path.join(topsrcdir, 'testing', 'mozbase', 'mozfile')) + sys.path.insert( + 0, os.path.join(topsrcdir, 'third_party', 'python', 'backports')) # If we know the Python executable the caller is asking for then verify its # version. If the caller did not ask for a specific executable then find @@ -313,44 +310,37 @@ def virtualenv_python3(env_python, virtualenv_name, build_env, mozconfig, help): if python: found_python = find_program(python) if not found_python: - die( - "The PYTHON3 environment variable does not contain " - "a valid path. Cannot find %s", - python, - ) + die('The PYTHON3 environment variable does not contain ' + 'a valid path. Cannot find %s', python) python = found_python try: version = python_executable_version(python).version except Exception as e: - raise FatalCheckError( - "could not determine version of PYTHON3 " "(%s): %s" % (python, e) - ) + raise FatalCheckError('could not determine version of PYTHON3 ' + '(%s): %s' % (python, e)) else: # Fall back to the search routine. - python, version = find_python3_executable(min_version="3.6.0") + python, version = find_python3_executable(min_version='3.6.0') # The API returns a bytes whereas everything in configure is unicode. if python: python = ensure_text(python) if not python: - raise FatalCheckError( - "Python 3.6 or newer is required to build. " - "Ensure a `python3.x` executable is in your " - "PATH or define PYTHON3 to point to a Python " - "3.6 executable." - ) + raise FatalCheckError('Python 3.6 or newer is required to build. ' + 'Ensure a `python3.x` executable is in your ' + 'PATH or define PYTHON3 to point to a Python ' + '3.6 executable.') if version < (3, 6, 0): - raise FatalCheckError( - "Python 3.6 or newer is required to build; " - "%s is Python %d.%d" % (python, version[0], version[1]) - ) + raise FatalCheckError('Python 3.6 or newer is required to build; ' + '%s is Python %d.%d' % (python, version[0], + version[1])) log.debug("python3: found executable: %r" % python) if not manager.up_to_date(python): - log.info("Creating Python 3 environment") + log.info('Creating Python 3 environment') manager.build(python) else: log.debug("python3: venv is up to date") @@ -358,35 +348,33 @@ def virtualenv_python3(env_python, virtualenv_name, build_env, mozconfig, help): python = normsep(manager.python_path) if not normsep(sys.executable).startswith(normsep(virtualenvs_root)): - log.debug( - "python3: executing as %s, should be running as %s" - % (sys.executable, manager.python_path) - ) - log.info("Re-executing in the virtualenv") + log.debug("python3: executing as %s, should be running as %s" % ( + sys.executable, manager.python_path)) + log.info('Re-executing in the virtualenv') if env_python: - del os.environ["PYTHON3"] + del os.environ['PYTHON3'] # Homebrew on macOS will change Python's sys.executable to a custom # value which messes with mach's virtualenv handling code. Override # Homebrew's changes with the correct sys.executable value. - os.environ["PYTHONEXECUTABLE"] = python + os.environ['PYTHONEXECUTABLE'] = python # Another quirk on macOS, with the system python, the virtualenv is # not fully operational (missing entries in sys.path) if # __PYVENV_LAUNCHER__ is set. - os.environ.pop("__PYVENV_LAUNCHER__", None) + os.environ.pop('__PYVENV_LAUNCHER__', None) # One would prefer to use os.execl, but that's completely borked on # Windows. sys.exit(subprocess.call([python] + sys.argv)) # We are now in the virtualenv if not distutils.sysconfig.get_python_lib(): - die("Could not determine python site packages directory") + die('Could not determine python site packages directory') # We may have set PYTHONEXECUTABLE above, and that affects python # subprocesses we may invoke as part of configure (e.g. hg), so # unset it. - os.environ.pop("PYTHONEXECUTABLE", None) + os.environ.pop('PYTHONEXECUTABLE', None) - str_version = ".".join(str(v) for v in version) + str_version = '.'.join(str(v) for v in version) return namespace( path=python, @@ -396,14 +384,14 @@ def virtualenv_python3(env_python, virtualenv_name, build_env, mozconfig, help): @depends(virtualenv_python3) -@checking("for Python 3", callback=lambda x: "%s (%s)" % (x.path, x.str_version)) +@checking('for Python 3', callback=lambda x: '%s (%s)' % (x.path, x.str_version)) def virtualenv_python3(venv): return venv -set_config("PYTHON3", virtualenv_python3.path) -set_config("PYTHON3_VERSION", virtualenv_python3.str_version) -add_old_configure_assignment("PYTHON3", virtualenv_python3.path) +set_config('PYTHON3', virtualenv_python3.path) +set_config('PYTHON3_VERSION', virtualenv_python3.str_version) +add_old_configure_assignment('PYTHON3', virtualenv_python3.path) # Inject mozconfig options @@ -414,64 +402,61 @@ add_old_configure_assignment("PYTHON3", virtualenv_python3.path) @template def early_options(): - @depends("--help") - @imports("__sandbox__") - @imports(_from="six", _import="itervalues") + @depends('--help') + @imports('__sandbox__') + @imports(_from='six', _import='itervalues') def early_options(_): return set( - option.env for option in itervalues(__sandbox__._options) if option.env + option.env + for option in itervalues(__sandbox__._options) + if option.env ) - return early_options early_options = early_options() -@depends(mozconfig, early_options, "MOZ_AUTOMATION", "--help") +@depends(mozconfig, early_options, 'MOZ_AUTOMATION', '--help') # This gives access to the sandbox. Don't copy this blindly. -@imports("__sandbox__") -@imports("os") -@imports("six") +@imports('__sandbox__') +@imports('os') +@imports('six') def mozconfig_options(mozconfig, early_options, automation, help): - if mozconfig["path"]: - if "MOZ_AUTOMATION_MOZCONFIG" in mozconfig["env"]["added"]: + if mozconfig['path']: + if 'MOZ_AUTOMATION_MOZCONFIG' in mozconfig['env']['added']: if not automation: - log.error( - "%s directly or indirectly includes an in-tree " "mozconfig.", - mozconfig["path"], - ) - log.error( - "In-tree mozconfigs make strong assumptions about " - "and are only meant to be used by Mozilla " - "automation." - ) + log.error('%s directly or indirectly includes an in-tree ' + 'mozconfig.', mozconfig['path']) + log.error('In-tree mozconfigs make strong assumptions about ' + 'and are only meant to be used by Mozilla ' + 'automation.') die("Please don't use them.") helper = __sandbox__._helper - log.info("Adding configure options from %s" % mozconfig["path"]) - for arg in mozconfig["configure_args"]: - log.info(" %s" % arg) + log.info('Adding configure options from %s' % mozconfig['path']) + for arg in mozconfig['configure_args']: + log.info(' %s' % arg) # We could be using imply_option() here, but it has other # contraints that don't really apply to the command-line # emulation that mozconfig provides. - helper.add(arg, origin="mozconfig", args=helper._args) + helper.add(arg, origin='mozconfig', args=helper._args) def add(key, value): if key.isupper(): - arg = "%s=%s" % (key, value) - log.info(" %s" % arg) + arg = '%s=%s' % (key, value) + log.info(' %s' % arg) if key not in early_options: - helper.add(arg, origin="mozconfig", args=helper._args) + helper.add(arg, origin='mozconfig', args=helper._args) - for key, value in six.iteritems(mozconfig["env"]["added"]): + for key, value in six.iteritems(mozconfig['env']['added']): add(key, value) os.environ[key] = value - for key, (_, value) in six.iteritems(mozconfig["env"]["modified"]): + for key, (_, value) in six.iteritems(mozconfig['env']['modified']): add(key, value) os.environ[key] = value - for key, value in six.iteritems(mozconfig["vars"]["added"]): + for key, value in six.iteritems(mozconfig['vars']['added']): add(key, value) - for key, (_, value) in six.iteritems(mozconfig["vars"]["modified"]): + for key, (_, value) in six.iteritems(mozconfig['vars']['modified']): add(key, value) @@ -479,199 +464,179 @@ def mozconfig_options(mozconfig, early_options, automation, help): # ================================================ -@depends(check_build_environment, "MOZ_AUTOMATION", "--help") -@checking("for vcs source checkout") -@imports("os") +@depends(check_build_environment, 'MOZ_AUTOMATION', '--help') +@checking('for vcs source checkout') +@imports('os') def vcs_checkout_type(build_env, automation, help): - if os.path.exists(os.path.join(build_env.topsrcdir, ".hg")): - return "hg" - elif os.path.exists(os.path.join(build_env.topsrcdir, ".git")): - return "git" + if os.path.exists(os.path.join(build_env.topsrcdir, '.hg')): + return 'hg' + elif os.path.exists(os.path.join(build_env.topsrcdir, '.git')): + return 'git' elif automation and not help: - raise FatalCheckError( - "unable to resolve VCS type; must run " - "from a source checkout when MOZ_AUTOMATION " - "is set" - ) - + raise FatalCheckError('unable to resolve VCS type; must run ' + 'from a source checkout when MOZ_AUTOMATION ' + 'is set') # Resolve VCS binary for detected repository type. # TODO remove hg.exe once bug 1382940 addresses ambiguous executables case. -hg = check_prog( - "HG", - ( - "hg.exe", - "hg", - ), - allow_missing=True, - when=depends(vcs_checkout_type)(lambda x: x == "hg"), -) -git = check_prog( - "GIT", - ("git",), - allow_missing=True, - when=depends(vcs_checkout_type)(lambda x: x == "git"), -) +hg = check_prog('HG', ('hg.exe', 'hg',), allow_missing=True, + when=depends(vcs_checkout_type)(lambda x: x == 'hg')) +git = check_prog('GIT', ('git',), allow_missing=True, + when=depends(vcs_checkout_type)(lambda x: x == 'git')) @depends_if(hg) -@checking("for Mercurial version") -@imports("os") -@imports("re") +@checking('for Mercurial version') +@imports('os') +@imports('re') def hg_version(hg): # HGPLAIN in Mercurial 1.5+ forces stable output, regardless of set # locale or encoding. env = dict(os.environ) - env["HGPLAIN"] = "1" + env['HGPLAIN'] = '1' - out = check_cmd_output(hg, "--version", env=env) + out = check_cmd_output(hg, '--version', env=env) - match = re.search(r"Mercurial Distributed SCM \(version ([^\)]+)", out) + match = re.search(r'Mercurial Distributed SCM \(version ([^\)]+)', out) if not match: - raise FatalCheckError("unable to determine Mercurial version: %s" % out) + raise FatalCheckError( + 'unable to determine Mercurial version: %s' % out) # The version string may be "unknown" for Mercurial run out of its own # source checkout or for bad builds. But LooseVersion handles it. return Version(match.group(1)) - # Resolve Mercurial config items so other checks have easy access. # Do NOT set this in the config because it may contain sensitive data # like API keys. @depends_all(check_build_environment, hg, hg_version) -@imports("os") +@imports('os') def hg_config(build_env, hg, version): env = dict(os.environ) - env["HGPLAIN"] = "1" + env['HGPLAIN'] = '1' # Warnings may get sent to stderr. But check_cmd_output() ignores # stderr if exit code is 0. And the command should always succeed if # `hg version` worked. - out = check_cmd_output(hg, "config", env=env, cwd=build_env.topsrcdir) + out = check_cmd_output(hg, 'config', env=env, cwd=build_env.topsrcdir) config = {} for line in out.strip().splitlines(): - key, value = [s.strip() for s in line.split("=", 1)] + key, value = [s.strip() for s in line.split('=', 1)] config[key] = value return config @depends_if(git) -@checking("for Git version") -@imports("re") +@checking('for Git version') +@imports('re') def git_version(git): - out = check_cmd_output(git, "--version").rstrip() + out = check_cmd_output(git, '--version').rstrip() - match = re.search("git version (.*)$", out) + match = re.search('git version (.*)$', out) if not match: - raise FatalCheckError("unable to determine Git version: %s" % out) + raise FatalCheckError('unable to determine Git version: %s' % out) return Version(match.group(1)) - # Only set VCS_CHECKOUT_TYPE if we resolved the VCS binary. # Require resolved VCS info when running in automation so automation's # environment is more well-defined. -@depends(vcs_checkout_type, hg_version, git_version, "MOZ_AUTOMATION") +@depends(vcs_checkout_type, hg_version, git_version, 'MOZ_AUTOMATION') def exposed_vcs_checkout_type(vcs_checkout_type, hg, git, automation): - if vcs_checkout_type == "hg": + if vcs_checkout_type == 'hg': if hg: - return "hg" + return 'hg' if automation: - raise FatalCheckError("could not resolve Mercurial binary info") + raise FatalCheckError('could not resolve Mercurial binary info') - elif vcs_checkout_type == "git": + elif vcs_checkout_type == 'git': if git: - return "git" + return 'git' if automation: - raise FatalCheckError("could not resolve Git binary info") + raise FatalCheckError('could not resolve Git binary info') elif vcs_checkout_type: - raise FatalCheckError("unhandled VCS type: %s" % vcs_checkout_type) + raise FatalCheckError('unhandled VCS type: %s' % vcs_checkout_type) -set_config("VCS_CHECKOUT_TYPE", exposed_vcs_checkout_type) +set_config('VCS_CHECKOUT_TYPE', exposed_vcs_checkout_type) # Obtain a Repository interface for the current VCS repository. @depends(check_build_environment, exposed_vcs_checkout_type, hg, git) -@imports(_from="mozversioncontrol", _import="get_repository_object") +@imports(_from='mozversioncontrol', _import='get_repository_object') def vcs_repository(build_env, vcs_checkout_type, hg, git): - if vcs_checkout_type == "hg": + if vcs_checkout_type == 'hg': return get_repository_object(build_env.topsrcdir, hg=hg) - elif vcs_checkout_type == "git": + elif vcs_checkout_type == 'git': return get_repository_object(build_env.topsrcdir, git=git) elif vcs_checkout_type: - raise FatalCheckError("unhandled VCS type: %s" % vcs_checkout_type) + raise FatalCheckError('unhandled VCS type: %s' % vcs_checkout_type) @depends_if(vcs_repository) -@checking("for sparse checkout") +@checking('for sparse checkout') def vcs_sparse_checkout(repo): return repo.sparse_checkout_present() -set_config("VCS_SPARSE_CHECKOUT", vcs_sparse_checkout) +set_config('VCS_SPARSE_CHECKOUT', vcs_sparse_checkout) # The application/project to build # ============================================================== -option( - "--enable-application", - nargs=1, - env="MOZ_BUILD_APP", - help="Application to build. Same as --enable-project.", -) +option('--enable-application', nargs=1, env='MOZ_BUILD_APP', + help='Application to build. Same as --enable-project.') -@depends("--enable-application") +@depends('--enable-application') def application(app): if app: return app -imply_option("--enable-project", application) +imply_option('--enable-project', application) @depends(check_build_environment) def default_project(build_env): - if build_env.topobjdir.endswith("/js/src"): - return "js" - return "browser" + if build_env.topobjdir.endswith('/js/src'): + return 'js' + return 'browser' -option("--enable-project", nargs=1, default=default_project, help="Project to build") +option('--enable-project', nargs=1, default=default_project, + help='Project to build') # Host and target systems # ============================================================== -option("--host", nargs=1, help="Define the system type performing the build") +option('--host', nargs=1, help='Define the system type performing the build') -option( - "--target", - nargs=1, - help="Define the system type where the resulting executables will be " "used", -) +option('--target', nargs=1, + help='Define the system type where the resulting executables will be ' + 'used') -@imports(_from="mozbuild.configure.constants", _import="CPU") -@imports(_from="mozbuild.configure.constants", _import="CPU_bitness") -@imports(_from="mozbuild.configure.constants", _import="Endianness") -@imports(_from="mozbuild.configure.constants", _import="Kernel") -@imports(_from="mozbuild.configure.constants", _import="OS") -@imports(_from="__builtin__", _import="ValueError") +@imports(_from='mozbuild.configure.constants', _import='CPU') +@imports(_from='mozbuild.configure.constants', _import='CPU_bitness') +@imports(_from='mozbuild.configure.constants', _import='Endianness') +@imports(_from='mozbuild.configure.constants', _import='Kernel') +@imports(_from='mozbuild.configure.constants', _import='OS') +@imports(_from='__builtin__', _import='ValueError') def split_triplet(triplet, allow_msvc=False): # The standard triplet is defined as # CPU_TYPE-VENDOR-OPERATING_SYSTEM @@ -681,8 +646,8 @@ def split_triplet(triplet, allow_msvc=False): # Additionally, some may omit "unknown" when the vendor # is not specified and emit # CPU_TYPE-OPERATING_SYSTEM - vendor = "unknown" - parts = triplet.split("-", 2) + vendor = 'unknown' + parts = triplet.split('-', 2) if len(parts) == 3: cpu, vendor, os = parts elif len(parts) == 2: @@ -699,101 +664,101 @@ def split_triplet(triplet, allow_msvc=False): # which can probably be improved/cleaned up because they are based on a # mix of uname and config.guess output, while we now only use the latter, # which presumably has a cleaner and leaner output. Let's refine later. - os = os.replace("/", "_") - if "android" in os: - canonical_os = "Android" - canonical_kernel = "Linux" - elif os.startswith("linux"): - canonical_os = "GNU" - canonical_kernel = "Linux" - elif os.startswith("kfreebsd") and os.endswith("-gnu"): - canonical_os = "GNU" - canonical_kernel = "kFreeBSD" - elif os.startswith("gnu"): - canonical_os = canonical_kernel = "GNU" - elif os.startswith("mingw") or (allow_msvc and os == "windows-msvc"): + os = os.replace('/', '_') + if 'android' in os: + canonical_os = 'Android' + canonical_kernel = 'Linux' + elif os.startswith('linux'): + canonical_os = 'GNU' + canonical_kernel = 'Linux' + elif os.startswith('kfreebsd') and os.endswith('-gnu'): + canonical_os = 'GNU' + canonical_kernel = 'kFreeBSD' + elif os.startswith('gnu'): + canonical_os = canonical_kernel = 'GNU' + elif os.startswith('mingw') or (allow_msvc and os == 'windows-msvc'): # windows-msvc is only opt-in for the caller of this function until # full support in bug 1617793. - canonical_os = canonical_kernel = "WINNT" - elif os.startswith("darwin"): - canonical_kernel = "Darwin" - canonical_os = "OSX" - elif os.startswith("dragonfly"): - canonical_os = canonical_kernel = "DragonFly" - elif os.startswith("freebsd"): - canonical_os = canonical_kernel = "FreeBSD" - elif os.startswith("netbsd"): - canonical_os = canonical_kernel = "NetBSD" - elif os.startswith("openbsd"): - canonical_os = canonical_kernel = "OpenBSD" - elif os.startswith("solaris"): - canonical_os = canonical_kernel = "SunOS" + canonical_os = canonical_kernel = 'WINNT' + elif os.startswith('darwin'): + canonical_kernel = 'Darwin' + canonical_os = 'OSX' + elif os.startswith('dragonfly'): + canonical_os = canonical_kernel = 'DragonFly' + elif os.startswith('freebsd'): + canonical_os = canonical_kernel = 'FreeBSD' + elif os.startswith('netbsd'): + canonical_os = canonical_kernel = 'NetBSD' + elif os.startswith('openbsd'): + canonical_os = canonical_kernel = 'OpenBSD' + elif os.startswith('solaris'): + canonical_os = canonical_kernel = 'SunOS' else: - raise ValueError("Unknown OS: %s" % os) + raise ValueError('Unknown OS: %s' % os) # The CPU granularity is probably not enough. Moving more things from # old-configure will tell us if we need more - if cpu.endswith("86") or (cpu.startswith("i") and "86" in cpu): - canonical_cpu = "x86" - endianness = "little" - elif cpu in ("x86_64", "ia64"): + if cpu.endswith('86') or (cpu.startswith('i') and '86' in cpu): + canonical_cpu = 'x86' + endianness = 'little' + elif cpu in ('x86_64', 'ia64'): canonical_cpu = cpu - endianness = "little" - elif cpu in ("s390", "s390x"): + endianness = 'little' + elif cpu in ('s390', 's390x'): canonical_cpu = cpu - endianness = "big" - elif cpu in ("powerpc64", "ppc64", "powerpc64le", "ppc64le"): - canonical_cpu = "ppc64" - endianness = "little" if "le" in cpu else "big" - elif cpu in ("powerpc", "ppc", "rs6000") or cpu.startswith("powerpc"): - canonical_cpu = "ppc" - endianness = "big" - elif cpu in ("Alpha", "alpha", "ALPHA"): - canonical_cpu = "Alpha" - endianness = "little" - elif cpu.startswith("hppa") or cpu == "parisc": - canonical_cpu = "hppa" - endianness = "big" - elif cpu.startswith("sparc64") or cpu.startswith("sparcv9"): - canonical_cpu = "sparc64" - endianness = "big" - elif cpu.startswith("sparc") or cpu == "sun4u": - canonical_cpu = "sparc" - endianness = "big" - elif cpu.startswith("arm"): - canonical_cpu = "arm" - endianness = "big" if cpu.startswith(("armeb", "armbe")) else "little" - elif cpu in ("m68k"): - canonical_cpu = "m68k" - endianness = "big" - elif cpu in ("mips", "mipsel"): - canonical_cpu = "mips32" - endianness = "little" if "el" in cpu else "big" - elif cpu in ("mips64", "mips64el"): - canonical_cpu = "mips64" - endianness = "little" if "el" in cpu else "big" - elif cpu.startswith("aarch64"): - canonical_cpu = "aarch64" - endianness = "little" - elif cpu in ("riscv64", "riscv64gc"): - canonical_cpu = "riscv64" - endianness = "little" - elif cpu == "sh4": - canonical_cpu = "sh4" - endianness = "little" + endianness = 'big' + elif cpu in ('powerpc64', 'ppc64', 'powerpc64le', 'ppc64le'): + canonical_cpu = 'ppc64' + endianness = 'little' if 'le' in cpu else 'big' + elif cpu in ('powerpc', 'ppc', 'rs6000') or cpu.startswith('powerpc'): + canonical_cpu = 'ppc' + endianness = 'big' + elif cpu in ('Alpha', 'alpha', 'ALPHA'): + canonical_cpu = 'Alpha' + endianness = 'little' + elif cpu.startswith('hppa') or cpu == 'parisc': + canonical_cpu = 'hppa' + endianness = 'big' + elif cpu.startswith('sparc64') or cpu.startswith('sparcv9'): + canonical_cpu = 'sparc64' + endianness = 'big' + elif cpu.startswith('sparc') or cpu == 'sun4u': + canonical_cpu = 'sparc' + endianness = 'big' + elif cpu.startswith('arm'): + canonical_cpu = 'arm' + endianness = 'big' if cpu.startswith(('armeb', 'armbe')) else 'little' + elif cpu in ('m68k'): + canonical_cpu = 'm68k' + endianness = 'big' + elif cpu in ('mips', 'mipsel'): + canonical_cpu = 'mips32' + endianness = 'little' if 'el' in cpu else 'big' + elif cpu in ('mips64', 'mips64el'): + canonical_cpu = 'mips64' + endianness = 'little' if 'el' in cpu else 'big' + elif cpu.startswith('aarch64'): + canonical_cpu = 'aarch64' + endianness = 'little' + elif cpu in ('riscv64', 'riscv64gc'): + canonical_cpu = 'riscv64' + endianness = 'little' + elif cpu == 'sh4': + canonical_cpu = 'sh4' + endianness = 'little' else: - raise ValueError("Unknown CPU type: %s" % cpu) + raise ValueError('Unknown CPU type: %s' % cpu) # Toolchains, most notably for cross compilation may use cpu-os # prefixes. We need to be more specific about the LLVM target on Mac # so cross-language LTO will work correctly. - if os.startswith("darwin"): - toolchain = "%s-apple-%s" % (cpu, os) - elif canonical_cpu == "aarch64" and canonical_os == "WINNT": - toolchain = "aarch64-windows-msvc" + if os.startswith('darwin'): + toolchain = '%s-apple-%s' % (cpu, os) + elif canonical_cpu == 'aarch64' and canonical_os == 'WINNT': + toolchain = 'aarch64-windows-msvc' else: - toolchain = "%s-%s" % (cpu, os) + toolchain = '%s-%s' % (cpu, os) return namespace( alias=triplet, @@ -812,53 +777,52 @@ def split_triplet(triplet, allow_msvc=False): # This defines a fake target/host namespace for when running with --help # If either --host or --target is passed on the command line, then fall # back to the real deal. -@depends("--help", "--host", "--target") +@depends('--help', '--host', '--target') def help_host_target(help, host, target): if help and not host and not target: return namespace( - alias="unknown-unknown-unknown", - cpu="unknown", - bitness="unknown", - kernel="unknown", - os="unknown", - endianness="unknown", - raw_cpu="unknown", - raw_os="unknown", - toolchain="unknown-unknown", + alias='unknown-unknown-unknown', + cpu='unknown', + bitness='unknown', + kernel='unknown', + os='unknown', + endianness='unknown', + raw_cpu='unknown', + raw_os='unknown', + toolchain='unknown-unknown', ) def config_sub(shell, triplet): - config_sub = os.path.join(os.path.dirname(__file__), "..", "autoconf", "config.sub") + config_sub = os.path.join(os.path.dirname(__file__), '..', + 'autoconf', 'config.sub') return check_cmd_output(shell, config_sub, triplet).strip() -@depends("--host", shell) -@checking("for host system type", lambda h: h.alias) -@imports("os") -@imports("sys") -@imports(_from="__builtin__", _import="ValueError") +@depends('--host', shell) +@checking('for host system type', lambda h: h.alias) +@imports('os') +@imports('sys') +@imports(_from='__builtin__', _import='ValueError') def real_host(value, shell): - if not value and sys.platform == "win32": - arch = os.environ.get("PROCESSOR_ARCHITEW6432") or os.environ.get( - "PROCESSOR_ARCHITECTURE" - ) - if arch == "AMD64": - return split_triplet("x86_64-pc-mingw32") - elif arch == "x86": - return split_triplet("i686-pc-mingw32") + if not value and sys.platform == 'win32': + arch = (os.environ.get('PROCESSOR_ARCHITEW6432') or + os.environ.get('PROCESSOR_ARCHITECTURE')) + if arch == 'AMD64': + return split_triplet('x86_64-pc-mingw32') + elif arch == 'x86': + return split_triplet('i686-pc-mingw32') if not value: - config_guess = os.path.join( - os.path.dirname(__file__), "..", "autoconf", "config.guess" - ) + config_guess = os.path.join(os.path.dirname(__file__), '..', + 'autoconf', 'config.guess') # Ensure that config.guess is determining the host triplet, not the target # triplet env = os.environ.copy() - env.pop("CC_FOR_BUILD", None) - env.pop("HOST_CC", None) - env.pop("CC", None) + env.pop('CC_FOR_BUILD', None) + env.pop('HOST_CC', None) + env.pop('CC', None) host = check_cmd_output(shell, config_guess, env=env).strip() try: @@ -879,9 +843,9 @@ def real_host(value, shell): host = help_host_target | real_host -@depends("--target", real_host, shell, "--enable-project", "--enable-application") -@checking("for target system type", lambda t: t.alias) -@imports(_from="__builtin__", _import="ValueError") +@depends('--target', real_host, shell, '--enable-project', '--enable-application') +@checking('for target system type', lambda t: t.alias) +@imports(_from='__builtin__', _import='ValueError') def real_target(value, host, shell, project, application): # Because --enable-project is implied by --enable-application, and # implied options are not currently handled during --help, which is @@ -894,27 +858,26 @@ def real_target(value, host, shell, project, application): elif project: project = project[0] if not value: - if project == "mobile/android": - if host.raw_os == "mingw32": + if project == 'mobile/android': + if host.raw_os == 'mingw32': log.warning( - "Building Firefox for Android on Windows is not fully " - "supported. See https://bugzilla.mozilla.org/show_bug.cgi?" - "id=1169873 for details." - ) - return split_triplet("arm-unknown-linux-androideabi") + 'Building Firefox for Android on Windows is not fully ' + 'supported. See https://bugzilla.mozilla.org/show_bug.cgi?' + 'id=1169873 for details.') + return split_triplet('arm-unknown-linux-androideabi') return host # If --target was only given a cpu arch, expand it with the # non-cpu part of the host. For mobile/android, expand it with # unknown-linux-android. target = value[0] - if "-" not in target: - if project == "mobile/android": - rest = "unknown-linux-android" - if target.startswith("arm"): - rest += "eabi" + if '-' not in target: + if project == 'mobile/android': + rest = 'unknown-linux-android' + if target.startswith('arm'): + rest += 'eabi' else: - cpu, rest = host.alias.split("-", 1) - target = "-".join((target, rest)) + cpu, rest = host.alias.split('-', 1) + target = '-'.join((target, rest)) try: return split_triplet(target) except ValueError: @@ -930,14 +893,14 @@ target = help_host_target | real_target @depends(host, target) -@checking("whether cross compiling") +@checking('whether cross compiling') def cross_compiling(host, target): return host != target -set_config("CROSS_COMPILE", cross_compiling) -set_define("CROSS_COMPILE", cross_compiling) -add_old_configure_assignment("CROSS_COMPILE", cross_compiling) +set_config('CROSS_COMPILE', cross_compiling) +set_define('CROSS_COMPILE', cross_compiling) +add_old_configure_assignment('CROSS_COMPILE', cross_compiling) @depends(target) @@ -946,42 +909,43 @@ def have_64_bit(target): return True -set_config("HAVE_64BIT_BUILD", have_64_bit) -set_define("HAVE_64BIT_BUILD", have_64_bit) -add_old_configure_assignment("HAVE_64BIT_BUILD", have_64_bit) +set_config('HAVE_64BIT_BUILD', have_64_bit) +set_define('HAVE_64BIT_BUILD', have_64_bit) +add_old_configure_assignment('HAVE_64BIT_BUILD', have_64_bit) @depends(host) def host_os_kernel_major_version(host): - versions = host.raw_os.split(".") - version = "".join(x for x in versions[0] if x.isdigit()) + versions = host.raw_os.split('.') + version = ''.join(x for x in versions[0] if x.isdigit()) return version -set_config("HOST_MAJOR_VERSION", host_os_kernel_major_version) +set_config('HOST_MAJOR_VERSION', host_os_kernel_major_version) # Autoconf needs these set @depends(host) def host_for_sub_configure(host): - return "--host=%s" % host.alias + return '--host=%s' % host.alias @depends(target) def target_for_sub_configure(target): target_alias = target.alias - return "--target=%s" % target_alias + return '--target=%s' % target_alias # These variables are for compatibility with the current moz.builds and # old-configure. Eventually, we'll want to canonicalize better. @depends(target) def target_variables(target): - if target.kernel == "kFreeBSD": - os_target = "GNU/kFreeBSD" - os_arch = "GNU_kFreeBSD" - elif target.kernel == "Darwin" or (target.kernel == "Linux" and target.os == "GNU"): + if target.kernel == 'kFreeBSD': + os_target = 'GNU/kFreeBSD' + os_arch = 'GNU_kFreeBSD' + elif target.kernel == 'Darwin' or (target.kernel == 'Linux' and + target.os == 'GNU'): os_target = target.kernel os_arch = target.kernel else: @@ -991,26 +955,28 @@ def target_variables(target): return namespace( OS_TARGET=os_target, OS_ARCH=os_arch, - INTEL_ARCHITECTURE=target.cpu in ("x86", "x86_64") or None, + INTEL_ARCHITECTURE=target.cpu in ('x86', 'x86_64') or None, ) -set_config("OS_TARGET", target_variables.OS_TARGET) -add_old_configure_assignment("OS_TARGET", target_variables.OS_TARGET) -set_config("OS_ARCH", target_variables.OS_ARCH) -add_old_configure_assignment("OS_ARCH", target_variables.OS_ARCH) -set_config("CPU_ARCH", target.cpu) -add_old_configure_assignment("CPU_ARCH", target.cpu) -set_config("INTEL_ARCHITECTURE", target_variables.INTEL_ARCHITECTURE) -set_config("TARGET_CPU", target.raw_cpu) -set_config("TARGET_OS", target.raw_os) -set_config("TARGET_ENDIANNESS", target.endianness) +set_config('OS_TARGET', target_variables.OS_TARGET) +add_old_configure_assignment('OS_TARGET', + target_variables.OS_TARGET) +set_config('OS_ARCH', target_variables.OS_ARCH) +add_old_configure_assignment('OS_ARCH', + target_variables.OS_ARCH) +set_config('CPU_ARCH', target.cpu) +add_old_configure_assignment('CPU_ARCH', target.cpu) +set_config('INTEL_ARCHITECTURE', target_variables.INTEL_ARCHITECTURE) +set_config('TARGET_CPU', target.raw_cpu) +set_config('TARGET_OS', target.raw_os) +set_config('TARGET_ENDIANNESS', target.endianness) @depends(host) def host_variables(host): - if host.kernel == "kFreeBSD": - os_arch = "GNU_kFreeBSD" + if host.kernel == 'kFreeBSD': + os_arch = 'GNU_kFreeBSD' else: os_arch = host.kernel return namespace( @@ -1018,200 +984,193 @@ def host_variables(host): ) -set_config("HOST_CPU_ARCH", host.cpu) -set_config("HOST_OS_ARCH", host_variables.HOST_OS_ARCH) -add_old_configure_assignment("HOST_OS_ARCH", host_variables.HOST_OS_ARCH) +set_config('HOST_CPU_ARCH', host.cpu) +set_config('HOST_OS_ARCH', host_variables.HOST_OS_ARCH) +add_old_configure_assignment('HOST_OS_ARCH', + host_variables.HOST_OS_ARCH) @depends(target) def target_is_windows(target): - if target.kernel == "WINNT": + if target.kernel == 'WINNT': return True -set_define("_WINDOWS", target_is_windows) -set_define("WIN32", target_is_windows) -set_define("XP_WIN", target_is_windows) +set_define('_WINDOWS', target_is_windows) +set_define('WIN32', target_is_windows) +set_define('XP_WIN', target_is_windows) @depends(target) def target_is_unix(target): - if target.kernel != "WINNT": + if target.kernel != 'WINNT': return True -set_define("XP_UNIX", target_is_unix) +set_define('XP_UNIX', target_is_unix) @depends(target) def target_is_darwin(target): - if target.kernel == "Darwin": + if target.kernel == 'Darwin': return True -set_define("XP_DARWIN", target_is_darwin) +set_define('XP_DARWIN', target_is_darwin) @depends(target) def target_is_osx(target): - if target.kernel == "Darwin" and target.os == "OSX": + if target.kernel == 'Darwin' and target.os == 'OSX': return True -set_define("XP_MACOSX", target_is_osx) +set_define('XP_MACOSX', target_is_osx) @depends(target) def target_is_linux(target): - if target.kernel == "Linux": + if target.kernel == 'Linux': return True -set_define("XP_LINUX", target_is_linux) +set_define('XP_LINUX', target_is_linux) @depends(target) def target_is_android(target): - if target.os == "Android": + if target.os == 'Android': return True -set_define("ANDROID", target_is_android) +set_define('ANDROID', target_is_android) @depends(target) def target_is_openbsd(target): - if target.kernel == "OpenBSD": + if target.kernel == 'OpenBSD': return True -set_define("XP_OPENBSD", target_is_openbsd) - +set_define('XP_OPENBSD', target_is_openbsd) @depends(target) def target_is_netbsd(target): - if target.kernel == "NetBSD": + if target.kernel == 'NetBSD': return True -set_define("XP_NETBSD", target_is_netbsd) - +set_define('XP_NETBSD', target_is_netbsd) @depends(target) def target_is_freebsd(target): - if target.kernel == "FreeBSD": + if target.kernel == 'FreeBSD': return True -set_define("XP_FREEBSD", target_is_freebsd) - +set_define('XP_FREEBSD', target_is_freebsd) @depends(target) def target_is_solaris(target): - if target.kernel == "SunOS": + if target.kernel == 'SunOS': return True -set_define("XP_SOLARIS", target_is_solaris) +set_define('XP_SOLARIS', target_is_solaris) @depends(target) def target_is_sparc(target): - if target.cpu == "sparc64": + if target.cpu == 'sparc64': return True - -set_define("SPARC64", target_is_sparc) +set_define('SPARC64', target_is_sparc) -@depends("--enable-project", check_build_environment, "--help") -@imports(_from="os.path", _import="exists") +@depends('--enable-project', check_build_environment, '--help') +@imports(_from='os.path', _import='exists') def include_project_configure(project, build_env, help): if not project: - die("--enable-project is required.") + die('--enable-project is required.') base_dir = build_env.topsrcdir - path = os.path.join(base_dir, project[0], "moz.configure") + path = os.path.join(base_dir, project[0], 'moz.configure') if not exists(path): - die("Cannot find project %s", project[0]) + die('Cannot find project %s', project[0]) return path @depends(include_project_configure, check_build_environment) def build_project(include_project_configure, build_env): - ret = os.path.dirname( - os.path.relpath(include_project_configure, build_env.topsrcdir) - ) + ret = os.path.dirname(os.path.relpath(include_project_configure, + build_env.topsrcdir)) return ret -set_config("MOZ_BUILD_APP", build_project) -set_define("MOZ_BUILD_APP", build_project) -add_old_configure_assignment("MOZ_BUILD_APP", build_project) +set_config('MOZ_BUILD_APP', build_project) +set_define('MOZ_BUILD_APP', build_project) +add_old_configure_assignment('MOZ_BUILD_APP', build_project) -option(env="MOZILLA_OFFICIAL", help="Build an official release") +option(env='MOZILLA_OFFICIAL', + help='Build an official release') -@depends("MOZILLA_OFFICIAL") +@depends('MOZILLA_OFFICIAL') def mozilla_official(official): if official: return True -set_config("MOZILLA_OFFICIAL", mozilla_official) -set_define("MOZILLA_OFFICIAL", mozilla_official) -add_old_configure_assignment("MOZILLA_OFFICIAL", mozilla_official) +set_config('MOZILLA_OFFICIAL', mozilla_official) +set_define('MOZILLA_OFFICIAL', mozilla_official) +add_old_configure_assignment('MOZILLA_OFFICIAL', mozilla_official) # Allow specifying custom paths to the version files used by the milestone() function below. -option( - "--with-version-file-path", - nargs=1, - help="Specify a custom path to app version files instead of auto-detecting", - default=None, -) - +option('--with-version-file-path', + nargs=1, + help='Specify a custom path to app version files instead of auto-detecting', + default=None) -@depends("--with-version-file-path") +@depends('--with-version-file-path') def version_path(path): return path - # set RELEASE_OR_BETA and NIGHTLY_BUILD variables depending on the cycle we're in # The logic works like this: # - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD) # - otherwise, if we have "a" in GRE_MILESTONE, we're building Nightly or Aurora # - otherwise, we're building Release/Beta (define RELEASE_OR_BETA) -@depends(check_build_environment, build_project, version_path, "--help") -@imports(_from="__builtin__", _import="open") -@imports("os") -@imports("re") +@depends(check_build_environment, build_project, version_path, '--help') +@imports(_from='__builtin__', _import='open') +@imports('os') +@imports('re') def milestone(build_env, build_project, version_path, _): versions = [] - paths = ["config/milestone.txt"] - if build_project == "js": + paths = ['config/milestone.txt'] + if build_project == 'js': paths = paths * 3 else: paths += [ - "browser/config/version.txt", - "browser/config/version_display.txt", + 'browser/config/version.txt', + 'browser/config/version_display.txt', ] if version_path: version_path = version_path[0] else: - version_path = os.path.join(build_project, "config") - for f in ("version.txt", "version_display.txt"): + version_path = os.path.join(build_project, 'config') + for f in ('version.txt', 'version_display.txt'): f = os.path.join(version_path, f) if not os.path.exists(os.path.join(build_env.topsrcdir, f)): break paths.append(f) for p in paths: - with open(os.path.join(build_env.topsrcdir, p), "r") as fh: + with open(os.path.join(build_env.topsrcdir, p), 'r') as fh: content = fh.read().splitlines() if not content: - die("Could not find a version number in {}".format(p)) + die('Could not find a version number in {}'.format(p)) versions.append(content[-1]) milestone, firefox_version, firefox_version_display = versions[:3] @@ -1226,28 +1185,26 @@ def milestone(build_env, build_project, version_path, _): is_nightly = is_release_or_beta = is_early_beta_or_earlier = None - if "a1" in milestone: + if 'a1' in milestone: is_nightly = True - elif "a" not in milestone: + elif 'a' not in milestone: is_release_or_beta = True - major_version = milestone.split(".")[0] + major_version = milestone.split('.')[0] m = re.search(r"([ab]\d+)", milestone) - ab_patch = m.group(1) if m else "" + ab_patch = m.group(1) if m else '' - defines = os.path.join(build_env.topsrcdir, "build", "defines.sh") - with open(defines, "r") as fh: + defines = os.path.join(build_env.topsrcdir, 'build', 'defines.sh') + with open(defines, 'r') as fh: for line in fh.read().splitlines(): line = line.strip() - if not line or line.startswith("#"): + if not line or line.startswith('#'): continue - name, _, value = line.partition("=") + name, _, value = line.partition('=') name = name.strip() value = value.strip() - if name != "EARLY_BETA_OR_EARLIER": - die( - "Only the EARLY_BETA_OR_EARLIER variable can be set in build/defines.sh" - ) + if name != 'EARLY_BETA_OR_EARLIER': + die('Only the EARLY_BETA_OR_EARLIER variable can be set in build/defines.sh') if value: is_early_beta_or_earlier = True @@ -1256,41 +1213,39 @@ def milestone(build_env, build_project, version_path, _): # # Only expose major milestone and alpha version in the symbolversion # string; as the name suggests, we use it for symbol versioning on Linux. - return namespace( - version=milestone, - uaversion="%s.0" % major_version, - symbolversion="%s%s" % (major_version, ab_patch), - is_nightly=is_nightly, - is_release_or_beta=is_release_or_beta, - is_early_beta_or_earlier=is_early_beta_or_earlier, - app_version=app_version, - app_version_display=app_version_display, - ) - - -set_config("GRE_MILESTONE", milestone.version) -set_config("NIGHTLY_BUILD", milestone.is_nightly) -set_define("NIGHTLY_BUILD", milestone.is_nightly) -set_config("RELEASE_OR_BETA", milestone.is_release_or_beta) -set_define("RELEASE_OR_BETA", milestone.is_release_or_beta) -add_old_configure_assignment("RELEASE_OR_BETA", milestone.is_release_or_beta) -set_config("EARLY_BETA_OR_EARLIER", milestone.is_early_beta_or_earlier) -set_define("EARLY_BETA_OR_EARLIER", milestone.is_early_beta_or_earlier) -add_old_configure_assignment( - "EARLY_BETA_OR_EARLIER", milestone.is_early_beta_or_earlier -) -set_define("MOZILLA_VERSION", depends(milestone)(lambda m: '"%s"' % m.version)) -set_config("MOZILLA_VERSION", milestone.version) -set_define("MOZILLA_VERSION_U", milestone.version) -set_define("MOZILLA_UAVERSION", depends(milestone)(lambda m: '"%s"' % m.uaversion)) -set_config("MOZILLA_SYMBOLVERSION", milestone.symbolversion) + return namespace(version=milestone, + uaversion='%s.0' % major_version, + symbolversion='%s%s' % (major_version, ab_patch), + is_nightly=is_nightly, + is_release_or_beta=is_release_or_beta, + is_early_beta_or_earlier=is_early_beta_or_earlier, + app_version=app_version, + app_version_display=app_version_display) + + +set_config('GRE_MILESTONE', milestone.version) +set_config('NIGHTLY_BUILD', milestone.is_nightly) +set_define('NIGHTLY_BUILD', milestone.is_nightly) +set_config('RELEASE_OR_BETA', milestone.is_release_or_beta) +set_define('RELEASE_OR_BETA', milestone.is_release_or_beta) +add_old_configure_assignment('RELEASE_OR_BETA', + milestone.is_release_or_beta) +set_config('EARLY_BETA_OR_EARLIER', milestone.is_early_beta_or_earlier) +set_define('EARLY_BETA_OR_EARLIER', milestone.is_early_beta_or_earlier) +add_old_configure_assignment('EARLY_BETA_OR_EARLIER', + milestone.is_early_beta_or_earlier) +set_define('MOZILLA_VERSION', depends(milestone)(lambda m: '"%s"' % m.version)) +set_config('MOZILLA_VERSION', milestone.version) +set_define('MOZILLA_VERSION_U', milestone.version) +set_define('MOZILLA_UAVERSION', depends(milestone)(lambda m: '"%s"' % m.uaversion)) +set_config('MOZILLA_SYMBOLVERSION', milestone.symbolversion) # JS configure still wants to look at these. -add_old_configure_assignment("MOZILLA_VERSION", milestone.version) -add_old_configure_assignment("MOZILLA_SYMBOLVERSION", milestone.symbolversion) +add_old_configure_assignment('MOZILLA_VERSION', milestone.version) +add_old_configure_assignment('MOZILLA_SYMBOLVERSION', milestone.symbolversion) -set_config("MOZ_APP_VERSION", milestone.app_version) -set_config("MOZ_APP_VERSION_DISPLAY", milestone.app_version_display) -add_old_configure_assignment("MOZ_APP_VERSION", milestone.app_version) +set_config('MOZ_APP_VERSION', milestone.app_version) +set_config('MOZ_APP_VERSION_DISPLAY', milestone.app_version_display) +add_old_configure_assignment('MOZ_APP_VERSION', milestone.app_version) # Dummy function for availability in toolkit/moz.configure. Overridden in @@ -1303,40 +1258,35 @@ def fennec_nightly(is_nightly): # The app update channel is 'default' when not supplied. The value is used in # the application's confvars.sh (and is made available to a project specific # moz.configure). -option( - "--enable-update-channel", - nargs=1, - help="Select application update channel", - default="default", -) +option('--enable-update-channel', + nargs=1, + help='Select application update channel', + default='default') -@depends("--enable-update-channel") +@depends('--enable-update-channel') def update_channel(channel): - if not channel or channel[0] == "": - return "default" + if not channel or channel[0] == '': + return 'default' return channel[0].lower() -set_config("MOZ_UPDATE_CHANNEL", update_channel) -set_define("MOZ_UPDATE_CHANNEL", update_channel) -add_old_configure_assignment("MOZ_UPDATE_CHANNEL", update_channel) +set_config('MOZ_UPDATE_CHANNEL', update_channel) +set_define('MOZ_UPDATE_CHANNEL', update_channel) +add_old_configure_assignment('MOZ_UPDATE_CHANNEL', update_channel) -option( - env="MOZBUILD_STATE_PATH", - nargs=1, - help="Path to a persistent state directory for the build system " - "and related tools", -) +option(env='MOZBUILD_STATE_PATH', nargs=1, + help='Path to a persistent state directory for the build system ' + 'and related tools') -@depends("MOZBUILD_STATE_PATH", "--help") -@imports("os") +@depends('MOZBUILD_STATE_PATH', '--help') +@imports('os') def mozbuild_state_path(path, _): if path: return path[0] - return os.path.expanduser(os.path.join("~", ".mozbuild")) + return os.path.expanduser(os.path.join('~', '.mozbuild')) # A template providing a shorthand for setting a variable. The created @@ -1348,12 +1298,14 @@ def mozbuild_state_path(path, _): # add_old_configure_assignment. util.configure would be an appropriate place for # this, but it uses add_old_configure_assignment, which is defined in this file. @template -def project_flag(env=None, set_for_old_configure=False, set_as_define=False, **kwargs): +def project_flag(env=None, set_for_old_configure=False, + set_as_define=False, **kwargs): if not env: - configure_error("A project_flag must be passed a variable name to set.") + configure_error( + "A project_flag must be passed a variable name to set.") - opt = option(env=env, possible_origins=("implied",), **kwargs) + opt = option(env=env, possible_origins=('implied',), **kwargs) @depends(opt.option) def option_implementation(value): @@ -1368,41 +1320,29 @@ def project_flag(env=None, set_for_old_configure=False, set_as_define=False, **k if set_for_old_configure: add_old_configure_assignment(env, option_implementation) - # milestone.is_nightly corresponds to cases NIGHTLY_BUILD is set. - @depends(milestone) def enabled_in_nightly(milestone): return milestone.is_nightly - # Branding # ============================================================== -option( - "--with-app-basename", - env="MOZ_APP_BASENAME", - nargs=1, - help="Typically stays consistent for multiple branded versions of a " - 'given application (e.g. Aurora and Firefox both use "Firefox"), but ' - "may vary for full rebrandings (e.g. Iceweasel). Used for " - 'application.ini\'s "Name" field, which controls profile location in ' - 'the absence of a "Profile" field (see below), and various system ' - "integration hooks (Unix remoting, Windows MessageWindow name, etc.", -) - - -@depends("--with-app-basename", target_is_android) +option('--with-app-basename', env='MOZ_APP_BASENAME', nargs=1, + help='Typically stays consistent for multiple branded versions of a ' + 'given application (e.g. Aurora and Firefox both use "Firefox"), but ' + 'may vary for full rebrandings (e.g. Iceweasel). Used for ' + 'application.ini\'s "Name" field, which controls profile location in ' + 'the absence of a "Profile" field (see below), and various system ' + 'integration hooks (Unix remoting, Windows MessageWindow name, etc.') + +@depends('--with-app-basename', target_is_android) def moz_app_basename(value, target_is_android): if value: return value[0] if target_is_android: - return "Fennec" - return "Firefox" - + return 'Fennec' + return 'Firefox' -set_config( - "MOZ_APP_BASENAME", - moz_app_basename, - when=depends(build_project)(lambda p: p != "js"), -) +set_config('MOZ_APP_BASENAME', moz_app_basename, + when=depends(build_project)(lambda p: p != 'js')) diff --git a/build/moz.configure/java.configure b/build/moz.configure/java.configure index f45f3b77fb4a..b58e9817b3aa 100644 --- a/build/moz.configure/java.configure +++ b/build/moz.configure/java.configure @@ -7,37 +7,28 @@ # Java detection # ======================================================== -option( - "--with-java-bin-path", - nargs=1, - help="Location of Java binaries (java, jarsigner, keytool)", -) +option('--with-java-bin-path', nargs=1, + help='Location of Java binaries (java, jarsigner, keytool)') -@depends(host, "--with-java-bin-path") -@imports(_from="os", _import="environ") +@depends(host, '--with-java-bin-path') +@imports(_from='os', _import='environ') def java_search_paths(host, path): if path: # Look for javac and jar in the specified path. return path # With no path specified, look for javac and jar in $JAVA_HOME (if set), # JDK registery on Windows, and $PATH. - if "JAVA_HOME" in environ: - return [os.path.join(environ["JAVA_HOME"], "bin")] - if host.os == "WINNT": - for x in get_registry_values( - r"HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\1.8\JavaHome", - get_32_and_64_bit=True, - ): - return [os.path.join(x[0], "bin")] - if host.os == "OSX": - home = check_cmd_output( - "/usr/libexec/java_home", "-v", "1.8", onerror=lambda: "" - ).rstrip() + if 'JAVA_HOME' in environ: + return [os.path.join(environ['JAVA_HOME'], 'bin')] + if host.os == 'WINNT': + for x in get_registry_values(r'HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\1.8\JavaHome', get_32_and_64_bit=True): + return [os.path.join(x[0], 'bin')] + if host.os == 'OSX': + home = check_cmd_output('/usr/libexec/java_home', '-v', '1.8', onerror=lambda: '').rstrip() if home: - return [os.path.join(home, "bin")] - return [environ.get("PATH")] - + return [os.path.join(home, 'bin')] + return [environ.get('PATH')] # Finds the given java tool, failing with a custom error message if we can't # find it. @@ -45,35 +36,27 @@ def java_search_paths(host, path): @template def check_java_tool(tool): - check = check_prog( - tool.upper(), (tool,), paths=java_search_paths, allow_missing=True - ) + check = check_prog(tool.upper(), (tool,), paths=java_search_paths, + allow_missing=True) @depends(check) def require_tool(result): if result is None: - die( - "The program %s was not found. Set $JAVA_HOME to your Java " - "SDK directory or use '--with-java-bin-path={java-bin-dir}'" % tool - ) + die("The program %s was not found. Set $JAVA_HOME to your Java " + "SDK directory or use '--with-java-bin-path={java-bin-dir}'" + % tool) return result return require_tool -check_java_tool("java") -check_java_tool("jarsigner") -check_java_tool("keytool") +check_java_tool('java') +check_java_tool('jarsigner') +check_java_tool('keytool') # Java Code Coverage # ======================================================== -option( - "--enable-java-coverage", - env="MOZ_JAVA_CODE_COVERAGE", - help="Enable Java code coverage", -) +option('--enable-java-coverage', env='MOZ_JAVA_CODE_COVERAGE', help='Enable Java code coverage') -set_config( - "MOZ_JAVA_CODE_COVERAGE", depends("--enable-java-coverage")(lambda v: bool(v)) -) +set_config('MOZ_JAVA_CODE_COVERAGE', depends('--enable-java-coverage')(lambda v: bool(v))) diff --git a/build/moz.configure/keyfiles.configure b/build/moz.configure/keyfiles.configure index 242a773aac21..5d51cccea280 100644 --- a/build/moz.configure/keyfiles.configure +++ b/build/moz.configure/keyfiles.configure @@ -7,18 +7,17 @@ @template def keyfile(desc, default=None, help=None, callback=lambda x: x): - help = help or ( - "Use the secret key contained in the given keyfile " "for %s requests" % desc - ) - name = desc.lower().replace(" ", "-") - no_key = callback("no-%s-key" % name) + help = help or ('Use the secret key contained in the given keyfile ' + 'for %s requests' % desc) + name = desc.lower().replace(' ', '-') + no_key = callback('no-%s-key' % name) - option("--with-%s-keyfile" % name, nargs=1, default=default, help=help) + option('--with-%s-keyfile' % name, nargs=1, default=default, help=help) - @depends("--with-%s-keyfile" % name) - @checking("for the %s key" % desc, lambda x: x and x is not no_key) - @imports(_from="__builtin__", _import="open") - @imports(_from="__builtin__", _import="IOError") + @depends('--with-%s-keyfile' % name) + @checking('for the %s key' % desc, lambda x: x and x is not no_key) + @imports(_from='__builtin__', _import='open') + @imports(_from='__builtin__', _import='IOError') def keyfile(value): if value: try: @@ -37,32 +36,29 @@ def keyfile(desc, default=None, help=None, callback=lambda x: x): @template def simple_keyfile(desc, default=None): value = keyfile(desc, default=default) - set_config("MOZ_%s_KEY" % desc.upper().replace(" ", "_"), value) + set_config('MOZ_%s_KEY' % desc.upper().replace(' ', '_'), value) @template def id_and_secret_keyfile(desc, default=None): def id_and_secret(value): - if value.startswith("no-") and value.endswith("-key"): - id = value[:-3] + "clientid" + if value.startswith('no-') and value.endswith('-key'): + id = value[:-3] + 'clientid' secret = value - elif " " in value: - id, secret = value.split(" ", 1) + elif ' ' in value: + id, secret = value.split(' ', 1) else: - raise FatalCheckError("%s key file has an invalid format." % desc) + raise FatalCheckError('%s key file has an invalid format.' % desc) return namespace( id=id, secret=secret, ) - content = keyfile( - desc, - help="Use the client id and secret key contained " - "in the given keyfile for %s requests" % desc, - default=default, - callback=id_and_secret, - ) + content = keyfile(desc, help='Use the client id and secret key contained ' + 'in the given keyfile for %s requests' % desc, + default=default, + callback=id_and_secret) - name = desc.upper().replace(" ", "_") - set_config("MOZ_%s_CLIENTID" % name, content.id) - set_config("MOZ_%s_KEY" % name, content.secret) + name = desc.upper().replace(' ', '_') + set_config('MOZ_%s_CLIENTID' % name, content.id) + set_config('MOZ_%s_KEY' % name, content.secret) diff --git a/build/moz.configure/lto-pgo.configure b/build/moz.configure/lto-pgo.configure index 2f32b1158807..c4436d24db36 100644 --- a/build/moz.configure/lto-pgo.configure +++ b/build/moz.configure/lto-pgo.configure @@ -6,134 +6,121 @@ # PGO # ============================================================== -llvm_profdata = check_prog( - "LLVM_PROFDATA", ["llvm-profdata"], allow_missing=True, paths=toolchain_search_path -) - -option( - "--enable-profile-generate", - env="MOZ_PROFILE_GENERATE", - nargs="?", - choices=("cross",), - help="Build a PGO instrumented binary", -) - -imply_option("MOZ_PGO", depends_if("--enable-profile-generate")(lambda _: True)) - -set_config( - "MOZ_PROFILE_GENERATE", depends_if("--enable-profile-generate")(lambda _: True) -) - -set_define( - "MOZ_PROFILE_GENERATE", depends_if("--enable-profile-generate")(lambda _: True) -) - -add_old_configure_assignment( - "MOZ_PROFILE_GENERATE", 1, when="--enable-profile-generate" -) - -option( - "--enable-profile-use", - env="MOZ_PROFILE_USE", - nargs="?", - choices=("cross",), - help="Use a generated profile during the build", -) - -option( - "--with-pgo-profile-path", - help="Path to the directory with unmerged profile data to use during the build", - nargs=1, -) - -imply_option("MOZ_PGO", depends_if("--enable-profile-use")(lambda _: True)) - -set_config("MOZ_PROFILE_USE", depends_if("--enable-profile-use")(lambda _: True)) - - -@depends( - "--with-pgo-profile-path", - "--enable-profile-use", - llvm_profdata, - check_build_environment, -) -@imports("os") +llvm_profdata = check_prog('LLVM_PROFDATA', ['llvm-profdata'], + allow_missing=True, + paths=toolchain_search_path) + +option('--enable-profile-generate', + env='MOZ_PROFILE_GENERATE', + nargs='?', + choices=('cross',), + help='Build a PGO instrumented binary') + +imply_option('MOZ_PGO', + depends_if('--enable-profile-generate')(lambda _: True)) + +set_config('MOZ_PROFILE_GENERATE', + depends_if('--enable-profile-generate')(lambda _: True)) + +set_define('MOZ_PROFILE_GENERATE', + depends_if('--enable-profile-generate')(lambda _: True)) + +add_old_configure_assignment('MOZ_PROFILE_GENERATE', 1, + when='--enable-profile-generate') + +option('--enable-profile-use', + env='MOZ_PROFILE_USE', + nargs='?', + choices=('cross',), + help='Use a generated profile during the build') + +option('--with-pgo-profile-path', + help='Path to the directory with unmerged profile data to use during the build', + nargs=1) + +imply_option('MOZ_PGO', + depends_if('--enable-profile-use')(lambda _: True)) + +set_config('MOZ_PROFILE_USE', + depends_if('--enable-profile-use')(lambda _: True)) + + +@depends('--with-pgo-profile-path', '--enable-profile-use', llvm_profdata, check_build_environment) +@imports('os') def pgo_profile_path(path, pgo_use, profdata, build_env): topobjdir = build_env.topobjdir - if topobjdir.endswith("/js/src"): + if topobjdir.endswith('/js/src'): topobjdir = topobjdir[:-7] if not path: - return os.path.join(topobjdir, "instrumented", "merged.profdata") + return os.path.join(topobjdir, 'instrumented', 'merged.profdata') if path and not pgo_use: - die("Pass --enable-profile-use to use --with-pgo-profile-path.") + die('Pass --enable-profile-use to use --with-pgo-profile-path.') if path and not profdata: - die("LLVM_PROFDATA must be set to process the pgo profile.") + die('LLVM_PROFDATA must be set to process the pgo profile.') if not os.path.isfile(path[0]): - die("Argument to --with-pgo-profile-path must be a file.") + die('Argument to --with-pgo-profile-path must be a file.') if not os.path.isabs(path[0]): - die("Argument to --with-pgo-profile-path must be an absolute path.") + die('Argument to --with-pgo-profile-path must be an absolute path.') return path[0] -set_config("PGO_PROFILE_PATH", pgo_profile_path) - +set_config('PGO_PROFILE_PATH', pgo_profile_path) @depends(c_compiler, pgo_profile_path, target_is_windows) -@imports("multiprocessing") -@imports(_from="__builtin__", _import="min") +@imports('multiprocessing') +@imports(_from='__builtin__', _import='min') def pgo_flags(compiler, profdata, target_is_windows): - if compiler.type == "gcc": + if compiler.type == 'gcc': return namespace( - gen_cflags=["-fprofile-generate"], - gen_ldflags=["-fprofile-generate"], - use_cflags=["-fprofile-use", "-fprofile-correction", "-Wcoverage-mismatch"], - use_ldflags=["-fprofile-use"], + gen_cflags=['-fprofile-generate'], + gen_ldflags=['-fprofile-generate'], + use_cflags=['-fprofile-use', '-fprofile-correction', + '-Wcoverage-mismatch'], + use_ldflags=['-fprofile-use'], ) - if compiler.type in ("clang-cl", "clang"): - prefix = "" - if compiler.type == "clang-cl": - prefix = "/clang:" + if compiler.type in ('clang-cl', 'clang'): + prefix = '' + if compiler.type == 'clang-cl': + prefix = '/clang:' gen_ldflags = None else: - gen_ldflags = ["-fprofile-generate"] + gen_ldflags = ['-fprofile-generate'] - gen_cflags = [prefix + "-fprofile-generate"] + gen_cflags = [prefix + '-fprofile-generate'] if target_is_windows: # native llvm-profdata.exe on Windows can't read profile data # if name compression is enabled (which cross-compiling enables # by default) - gen_cflags += ["-mllvm", "-enable-name-compression=false"] + gen_cflags += ['-mllvm', '-enable-name-compression=false'] return namespace( gen_cflags=gen_cflags, gen_ldflags=gen_ldflags, - use_cflags=[ - prefix + "-fprofile-use=%s" % profdata, - # Some error messages about mismatched profile data - # come in via -Wbackend-plugin, so disable those too. - "-Wno-error=backend-plugin", - ], + use_cflags=[prefix + '-fprofile-use=%s' % profdata, + # Some error messages about mismatched profile data + # come in via -Wbackend-plugin, so disable those too. + '-Wno-error=backend-plugin'], use_ldflags=[], ) -set_config("PROFILE_GEN_CFLAGS", pgo_flags.gen_cflags) -set_config("PROFILE_GEN_LDFLAGS", pgo_flags.gen_ldflags) -set_config("PROFILE_USE_CFLAGS", pgo_flags.use_cflags) -set_config("PROFILE_USE_LDFLAGS", pgo_flags.use_ldflags) +set_config('PROFILE_GEN_CFLAGS', pgo_flags.gen_cflags) +set_config('PROFILE_GEN_LDFLAGS', pgo_flags.gen_ldflags) +set_config('PROFILE_USE_CFLAGS', pgo_flags.use_cflags) +set_config('PROFILE_USE_LDFLAGS', pgo_flags.use_ldflags) -option( - "--with-pgo-jarlog", - help="Use the provided jarlog file when packaging during a profile-use " "build", - nargs=1, -) +option('--with-pgo-jarlog', + help='Use the provided jarlog file when packaging during a profile-use ' + 'build', + nargs=1) -set_config("PGO_JARLOG_PATH", depends_if("--with-pgo-jarlog")(lambda p: p)) +set_config('PGO_JARLOG_PATH', depends_if('--with-pgo-jarlog')(lambda p: p)) -@depends("MOZ_PGO", "--enable-profile-use", "--enable-profile-generate", c_compiler) +@depends('MOZ_PGO', '--enable-profile-use', '--enable-profile-generate', + c_compiler) def moz_pgo_rust(pgo, profile_use, profile_generate, c_compiler): if not pgo: return @@ -143,51 +130,38 @@ def moz_pgo_rust(pgo, profile_use, profile_generate, c_compiler): return if profile_use and profile_generate: - die("Cannot build with --enable-profile-use and --enable-profile-generate.") + die('Cannot build with --enable-profile-use and --enable-profile-generate.') - want_cross = (len(profile_use) and profile_use[0] == "cross") or ( - len(profile_generate) and profile_generate[0] == "cross" - ) + want_cross = (len(profile_use) and profile_use[0] == 'cross') \ + or (len(profile_generate) and profile_generate[0] == 'cross') if not want_cross: return - if c_compiler.type == "gcc": - die("Cannot use cross-language PGO with GCC.") + if c_compiler.type == 'gcc': + die('Cannot use cross-language PGO with GCC.') return True - -set_config("MOZ_PGO_RUST", moz_pgo_rust) +set_config('MOZ_PGO_RUST', moz_pgo_rust) # LTO # ============================================================== -option( - "--enable-lto", - env="MOZ_LTO", - nargs="?", - choices=("full", "thin", "cross"), - help="Enable LTO", -) - -option( - env="MOZ_LD64_KNOWN_GOOD", - nargs=1, - help="Indicate that ld64 is free of symbol aliasing bugs.", -) - -imply_option("MOZ_LD64_KNOWN_GOOD", depends_if("MOZ_AUTOMATION")(lambda _: True)) - - -@depends( - "--enable-lto", - c_compiler, - "MOZ_LD64_KNOWN_GOOD", - target, - "--enable-profile-generate", -) -@imports("multiprocessing") +option('--enable-lto', + env='MOZ_LTO', + nargs='?', + choices=('full', 'thin', 'cross'), + help='Enable LTO') + +option(env='MOZ_LD64_KNOWN_GOOD', + nargs=1, + help='Indicate that ld64 is free of symbol aliasing bugs.') + +imply_option('MOZ_LD64_KNOWN_GOOD', depends_if('MOZ_AUTOMATION')(lambda _: True)) + +@depends('--enable-lto', c_compiler, 'MOZ_LD64_KNOWN_GOOD', target, '--enable-profile-generate') +@imports('multiprocessing') def lto(value, c_compiler, ld64_known_good, target, instrumented_build): cflags = [] ldflags = [] @@ -196,48 +170,41 @@ def lto(value, c_compiler, ld64_known_good, target, instrumented_build): if value: if instrumented_build: - log.warning("Disabling LTO because --enable-profile-generate is specified") + log.warning('Disabling LTO because --enable-profile-generate is specified') return enabled = True # `cross` implies `thin`, but with Rust code participating in LTO # as well. Make that a little more explicit. - if len(value) and value[0].lower() == "cross": - if c_compiler.type == "gcc": - die("Cross-language LTO is not supported with GCC.") + if len(value) and value[0].lower() == 'cross': + if c_compiler.type == 'gcc': + die('Cross-language LTO is not supported with GCC.') rust_lto = True - value = ["thin"] - - if ( - target.kernel == "Darwin" - and target.os == "OSX" - and len(value) - and value[0].lower() == "cross" - and not ld64_known_good - ): - die( - "The Mac linker is known to have a bug that affects cross-language " - "LTO. If you know that your linker is free from this bug, please " - "set the environment variable `MOZ_LD64_KNOWN_GOOD=1` and re-run " - "configure." - ) - - if c_compiler.type == "clang": - if len(value) and value[0].lower() == "full": + value = ['thin'] + + if target.kernel == 'Darwin' and target.os == 'OSX' \ + and len(value) and value[0].lower() == 'cross' and not ld64_known_good: + die('The Mac linker is known to have a bug that affects cross-language ' + 'LTO. If you know that your linker is free from this bug, please ' + 'set the environment variable `MOZ_LD64_KNOWN_GOOD=1` and re-run ' + 'configure.') + + if c_compiler.type == 'clang': + if len(value) and value[0].lower() == 'full': cflags.append("-flto") ldflags.append("-flto") else: cflags.append("-flto=thin") ldflags.append("-flto=thin") - elif c_compiler.type == "clang-cl": - if len(value) and value[0].lower() == "full": + elif c_compiler.type == 'clang-cl': + if len(value) and value[0].lower() == 'full': cflags.append("-flto") else: cflags.append("-flto=thin") # With clang-cl, -flto can only be used with -c or -fuse-ld=lld. # AC_TRY_LINKs during configure don't have -c, so pass -fuse-ld=lld. - cflags.append("-fuse-ld=lld") + cflags.append("-fuse-ld=lld"); # Explicitly set the CPU to optimize for so the linker doesn't # choose a poor default. Rust compilation by default uses the @@ -253,19 +220,19 @@ def lto(value, c_compiler, ld64_known_good, target, instrumented_build): # specifically schedule code for the pentium4's deep pipeline, so # that probably contributes to it being an OK default for our # purposes. - if target.cpu == "x86": - ldflags.append("-mllvm:-mcpu=pentium4") + if target.cpu == 'x86': + ldflags.append('-mllvm:-mcpu=pentium4') # This is also the CPU that Rust uses. The LLVM source code # recommends this as the "generic 64-bit specific x86 processor model": # # https://github.com/llvm/llvm-project/blob/e7694f34ab6a12b8bb480cbfcb396d0a64fe965f/llvm/lib/Target/X86/X86.td#L1165-L1187 - if target.cpu == "x86_64": - ldflags.append("-mllvm:-mcpu=x86-64") + if target.cpu == 'x86_64': + ldflags.append('-mllvm:-mcpu=x86-64') # We do not need special flags for arm64. Hooray for fixed-length # instruction sets. else: num_cores = multiprocessing.cpu_count() - if len(value) and value[0].lower() == "full": + if len(value) and value[0].lower() == 'full': cflags.append("-flto") else: cflags.append("-flto=thin") @@ -277,12 +244,12 @@ def lto(value, c_compiler, ld64_known_good, target, instrumented_build): # Tell LTO not to inline functions above a certain size, to mitigate # binary size growth while still getting good performance. # (For hot functions, PGO will put a multiplier on this limit.) - if target.os == "WINNT": - ldflags.append("-mllvm:-import-instr-limit=10") - elif target.os == "OSX": - ldflags.append("-Wl,-mllvm,-import-instr-limit=10") - elif c_compiler.type == "clang": - ldflags.append("-Wl,-plugin-opt=-import-instr-limit=10") + if target.os == 'WINNT': + ldflags.append('-mllvm:-import-instr-limit=10'); + elif target.os == 'OSX': + ldflags.append('-Wl,-mllvm,-import-instr-limit=10'); + elif c_compiler.type == 'clang': + ldflags.append('-Wl,-plugin-opt=-import-instr-limit=10'); return namespace( enabled=enabled, @@ -292,11 +259,11 @@ def lto(value, c_compiler, ld64_known_good, target, instrumented_build): ) -add_old_configure_assignment("MOZ_LTO", lto.enabled) -set_config("MOZ_LTO", lto.enabled) -set_define("MOZ_LTO", lto.enabled) -set_config("MOZ_LTO_CFLAGS", lto.cflags) -set_config("MOZ_LTO_LDFLAGS", lto.ldflags) -set_config("MOZ_LTO_RUST_CROSS", lto.rust_lto) -add_old_configure_assignment("MOZ_LTO_CFLAGS", lto.cflags) -add_old_configure_assignment("MOZ_LTO_LDFLAGS", lto.ldflags) +add_old_configure_assignment('MOZ_LTO', lto.enabled) +set_config('MOZ_LTO', lto.enabled) +set_define('MOZ_LTO', lto.enabled) +set_config('MOZ_LTO_CFLAGS', lto.cflags) +set_config('MOZ_LTO_LDFLAGS', lto.ldflags) +set_config('MOZ_LTO_RUST_CROSS', lto.rust_lto) +add_old_configure_assignment('MOZ_LTO_CFLAGS', lto.cflags) +add_old_configure_assignment('MOZ_LTO_LDFLAGS', lto.ldflags) diff --git a/build/moz.configure/memory.configure b/build/moz.configure/memory.configure index 855706b457da..b0f8548fb78b 100644 --- a/build/moz.configure/memory.configure +++ b/build/moz.configure/memory.configure @@ -7,68 +7,55 @@ @depends(target) def jemalloc_default(target): - return target.kernel in ("Darwin", "Linux", "WINNT") + return target.kernel in ('Darwin', 'Linux', 'WINNT') -option( - "--enable-jemalloc", - env="MOZ_MEMORY", - default=jemalloc_default, - help="{Replace|Do not replace} memory allocator with jemalloc", -) +option('--enable-jemalloc', env='MOZ_MEMORY', default=jemalloc_default, + help='{Replace|Do not replace} memory allocator with jemalloc') -set_config("MOZ_MEMORY", True, when="--enable-jemalloc") -set_define("MOZ_MEMORY", True, when="--enable-jemalloc") -add_old_configure_assignment("MOZ_MEMORY", True, when="--enable-jemalloc") +set_config('MOZ_MEMORY', True, when='--enable-jemalloc') +set_define('MOZ_MEMORY', True, when='--enable-jemalloc') +add_old_configure_assignment('MOZ_MEMORY', True, when='--enable-jemalloc') @depends(milestone, build_project) def replace_malloc_default(milestone, build_project): - if build_project == "memory": + if build_project == 'memory': return True - if milestone.is_early_beta_or_earlier and build_project != "js": + if milestone.is_early_beta_or_earlier and build_project != 'js': return True -option( - "--enable-replace-malloc", - default=replace_malloc_default, - when="--enable-jemalloc", - help="{Enable|Disable} ability to dynamically replace the malloc implementation", -) +option('--enable-replace-malloc', default=replace_malloc_default, + when='--enable-jemalloc', + help='{Enable|Disable} ability to dynamically replace the malloc implementation') -set_config("MOZ_REPLACE_MALLOC", True, when="--enable-replace-malloc") -set_define("MOZ_REPLACE_MALLOC", True, when="--enable-replace-malloc") +set_config('MOZ_REPLACE_MALLOC', True, when='--enable-replace-malloc') +set_define('MOZ_REPLACE_MALLOC', True, when='--enable-replace-malloc') -@depends(build_project, when="--enable-replace-malloc") +@depends(build_project, when='--enable-replace-malloc') def replace_malloc_static(build_project): # Default to statically linking replace-malloc libraries that can be # statically linked, except when building with --enable-project=memory. - if build_project != "memory": + if build_project != 'memory': return True -set_config("MOZ_REPLACE_MALLOC_STATIC", replace_malloc_static) +set_config('MOZ_REPLACE_MALLOC_STATIC', replace_malloc_static) # PHC (Probabilistic Heap Checker) # ============================================================== # In general, it only makes sense for PHC to run on the platforms that have a # crash reporter. -@depends( - milestone, - target, - replace_malloc_default, - "--enable-replace-malloc", - when="--enable-jemalloc", -) +@depends(milestone, target, replace_malloc_default, '--enable-replace-malloc', + when='--enable-jemalloc') def phc_default(milestone, target, replace_malloc_default, replace_malloc): - if not replace_malloc_default or ( - replace_malloc.origin != "default" and not replace_malloc - ): + if not replace_malloc_default or \ + (replace_malloc.origin != 'default' and not replace_malloc): return False # Nightly or early beta only because PHC has a non-negligible performance cost. if not milestone.is_early_beta_or_earlier: @@ -78,21 +65,18 @@ def phc_default(milestone, target, replace_malloc_default, replace_malloc): # # XXX: PHC is implemented but not yet enabled on Mac. Bug 1576515 is about # enabling it on Mac, but it is blocked by bug 1035892. - return ( - target.os == "GNU" and target.kernel == "Linux" and target.bitness == 64 - ) or (target.kernel == "WINNT" and target.bitness == 64) + return (target.os == 'GNU' and target.kernel == 'Linux' and + target.bitness == 64) or \ + (target.kernel == 'WINNT' and target.bitness == 64) -option( - "--enable-phc", - env="MOZ_PHC", - default=phc_default, - when="--enable-jemalloc", - help="{Enable|Disable} PHC (Probabilistic Memory Checker). " - "Also enables replace-malloc and frame pointers", -) -imply_option("--enable-replace-malloc", True, when="--enable-phc") -imply_option("--enable-frame-pointers", True, when="--enable-phc") +option('--enable-phc', env='MOZ_PHC', default=phc_default, + when='--enable-jemalloc', + help='{Enable|Disable} PHC (Probabilistic Memory Checker). ' + 'Also enables replace-malloc and frame pointers') +imply_option('--enable-replace-malloc', True, when='--enable-phc') +imply_option('--enable-frame-pointers', True, when='--enable-phc') -set_config("MOZ_PHC", True, when="--enable-phc") +set_config('MOZ_PHC', True, when='--enable-phc') + diff --git a/build/moz.configure/node.configure b/build/moz.configure/node.configure index 1c8d55fa070f..7e87a24424d3 100644 --- a/build/moz.configure/node.configure +++ b/build/moz.configure/node.configure @@ -4,49 +4,45 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -option("--disable-nodejs", help="Require Node.js to build") -option(env="NODEJS", nargs=1, help="Path to nodejs") +option('--disable-nodejs', + help='Require Node.js to build') +option(env='NODEJS', nargs=1, help='Path to nodejs') -@depends("--enable-nodejs", "NODEJS") -@checking( - "for nodejs", callback=lambda x: "%s (%s)" % (x.path, x.str_version) if x else "no" -) -@imports(_from="mozbuild.nodeutil", _import="find_node_executable") -@imports(_from="mozbuild.nodeutil", _import="NODE_MIN_VERSION") +@depends('--enable-nodejs', 'NODEJS') +@checking('for nodejs', + callback=lambda x: '%s (%s)' % (x.path, x.str_version) if x else 'no') +@imports(_from='mozbuild.nodeutil', _import='find_node_executable') +@imports(_from='mozbuild.nodeutil', _import='NODE_MIN_VERSION') def nodejs(require, env_node): node_exe = env_node[0] if env_node else None nodejs, version = find_node_executable(node_exe) - MAYBE_FILE_A_BUG = """ + MAYBE_FILE_A_BUG = ''' Executing `mach bootstrap --no-system-changes` should install a compatible version in ~/.mozbuild on most platforms. If you believe this is a bug, is a good way to file. More details: - """ + ''' if not nodejs: - msg = ( - "could not find Node.js executable later than %s; ensure " - "`node` or `nodejs` is in PATH or set NODEJS in environment " - "to point to an executable.%s" % (NODE_MIN_VERSION, MAYBE_FILE_A_BUG) - ) + msg = ('could not find Node.js executable later than %s; ensure ' + '`node` or `nodejs` is in PATH or set NODEJS in environment ' + 'to point to an executable.%s' % (NODE_MIN_VERSION, MAYBE_FILE_A_BUG) + ) if require: raise FatalCheckError(msg) else: log.warning(msg) - log.warning("(This will become an error in the near future.)") + log.warning('(This will become an error in the near future.)') return if not version: - msg = "NODEJS must point to node %s or newer; found node location: %s. %s" % ( - NODE_MIN_VERSION, - nodejs, - MAYBE_FILE_A_BUG, - ) + msg = 'NODEJS must point to node %s or newer; found node location: %s. %s' % ( + NODE_MIN_VERSION, nodejs, MAYBE_FILE_A_BUG) if require: raise FatalCheckError(msg) @@ -57,8 +53,8 @@ def nodejs(require, env_node): return namespace( path=nodejs, version=version, - str_version=".".join(str(v) for v in version), + str_version='.'.join(str(v) for v in version), ) -set_config("NODEJS", depends_if(nodejs)(lambda p: p.path)) +set_config('NODEJS', depends_if(nodejs)(lambda p: p.path)) diff --git a/build/moz.configure/nspr.configure b/build/moz.configure/nspr.configure index 2b21a66f03b2..0d6f73fff89d 100644 --- a/build/moz.configure/nspr.configure +++ b/build/moz.configure/nspr.configure @@ -6,66 +6,54 @@ # Top-level configure defaults to building NSPR from source. Standalone JS # doesn't. -option( - "--enable-nspr-build", - when=js_standalone, - help="{Build|Do not build} NSPR from source tree", -) +option('--enable-nspr-build', when=js_standalone, + help='{Build|Do not build} NSPR from source tree') - -@depends("--enable-nspr-build", when=js_standalone) +@depends('--enable-nspr-build', when=js_standalone) def enable_nspr_build(enable): if enable: return enable +option('--with-system-nspr', help='Use system NSPR') -option("--with-system-nspr", help="Use system NSPR") - - -@depends(enable_nspr_build, "--with-system-nspr", js_standalone) +@depends(enable_nspr_build, '--with-system-nspr', js_standalone) def build_nspr(nspr_build, system_nspr, js_standalone): - if nspr_build is not None and nspr_build.origin != "default": + if nspr_build is not None and nspr_build.origin != 'default': if nspr_build and system_nspr: - die("Cannot use both --enable-nspr-build and --with-system-nspr") + die('Cannot use both --enable-nspr-build and --with-system-nspr') if js_standalone: return nspr_build return not system_nspr +set_config('MOZ_BUILD_NSPR', True, when=build_nspr) +set_config('MOZ_SYSTEM_NSPR', True, when='--with-system-nspr') -set_config("MOZ_BUILD_NSPR", True, when=build_nspr) -set_config("MOZ_SYSTEM_NSPR", True, when="--with-system-nspr") - - -@depends(build_nspr, "--with-system-nspr", js_standalone) +@depends(build_nspr, '--with-system-nspr', js_standalone) def js_without_nspr(build_nspr, system_nspr, js_standalone): if js_standalone: return not build_nspr and not system_nspr - -set_config("JS_WITHOUT_NSPR", True, when=js_without_nspr) -set_define("JS_WITHOUT_NSPR", True, when=js_without_nspr) - +set_config('JS_WITHOUT_NSPR', True, when=js_without_nspr) +set_define('JS_WITHOUT_NSPR', True, when=js_without_nspr) @depends(js_standalone) def nspr_minver(js_standalone): if js_standalone: - return "nspr >= 4.10" - return "nspr >= 4.26" - - -nspr_pkg = pkg_check_modules("NSPR", nspr_minver, when="--with-system-nspr") + return 'nspr >= 4.10' + return 'nspr >= 4.26' +nspr_pkg = pkg_check_modules('NSPR', nspr_minver, when='--with-system-nspr') @depends_if(nspr_pkg) def nspr_pkg(nspr_pkg): def extract(prefix, list): for item in list: if item.startswith(prefix): - return item[len(prefix) :] - return "" + return item[len(prefix):] + return '' - include_dir = extract("-I", nspr_pkg.cflags) - lib_dir = extract("-L", nspr_pkg.libs) + include_dir = extract('-I', nspr_pkg.cflags) + lib_dir = extract('-L', nspr_pkg.libs) return namespace( cflags=nspr_pkg.cflags, include_dir=include_dir, @@ -73,45 +61,42 @@ def nspr_pkg(nspr_pkg): lib_dir=lib_dir, ) - -@depends("--with-system-nspr", nspr_minver) +@depends('--with-system-nspr', nspr_minver) def pkgconf_requires_private(system_nspr, nspr_minver): if not system_nspr: - return "" - return "Requires.private: %s" % nspr_minver - + return '' + return 'Requires.private: %s' % nspr_minver -set_config("PKGCONF_REQUIRES_PRIVATE", pkgconf_requires_private) +set_config('PKGCONF_REQUIRES_PRIVATE', pkgconf_requires_private) # pkg_check_modules takes care of NSPR_CFLAGS and NSPR_LIBS when using --with-system-nspr. @depends(check_build_environment, c_compiler, fold_libs, when=build_nspr) def nspr_config(build_env, c_compiler, fold_libs): - libs = ["nspr4", "plc4", "plds4"] - if c_compiler.type == "clang-cl": - lib_dir = os.path.join(build_env.dist, "lib") - libs = [os.path.join(lib_dir, "%s.lib" % lib) for lib in libs] + libs = ['nspr4', 'plc4', 'plds4'] + if c_compiler.type == 'clang-cl': + lib_dir = os.path.join(build_env.dist, 'lib') + libs = [os.path.join(lib_dir, '%s.lib' % lib) for lib in libs] else: - lib_dir = os.path.join(build_env.dist, "lib" if fold_libs else "bin") - libs = ["-L%s" % lib_dir] + ["-l%s" % lib for lib in libs] + lib_dir = os.path.join(build_env.dist, 'lib' if fold_libs else 'bin') + libs = ['-L%s' % lib_dir] + ['-l%s' % lib for lib in libs] - include_dir = os.path.join(build_env.dist, "include", "nspr") + include_dir = os.path.join(build_env.dist, 'include', 'nspr') return namespace( - cflags=["-I%s" % include_dir], + cflags=['-I%s' % include_dir], include_dir=include_dir, libs=libs, lib_dir=lib_dir, ) +set_config('NSPR_CFLAGS', nspr_config.cflags, when=nspr_config) +set_config('NSPR_LIBS', nspr_config.libs, when=nspr_config) -set_config("NSPR_CFLAGS", nspr_config.cflags, when=nspr_config) -set_config("NSPR_LIBS", nspr_config.libs, when=nspr_config) - -set_config("NSPR_INCLUDE_DIR", nspr_config.include_dir, when=nspr_config) -set_config("NSPR_LIB_DIR", nspr_config.lib_dir, when=nspr_config) -set_config("NSPR_INCLUDE_DIR", nspr_pkg.include_dir, when=nspr_pkg) -set_config("NSPR_LIB_DIR", nspr_pkg.lib_dir, when=nspr_pkg) +set_config('NSPR_INCLUDE_DIR', nspr_config.include_dir, when=nspr_config) +set_config('NSPR_LIB_DIR', nspr_config.lib_dir, when=nspr_config) +set_config('NSPR_INCLUDE_DIR', nspr_pkg.include_dir, when=nspr_pkg) +set_config('NSPR_LIB_DIR', nspr_pkg.lib_dir, when=nspr_pkg) -add_old_configure_assignment("NSPR_CFLAGS", nspr_config.cflags, when=nspr_config) -add_old_configure_assignment("NSPR_LIBS", nspr_config.libs, when=nspr_config) -add_old_configure_assignment("NSPR_CFLAGS", nspr_pkg.cflags, when=nspr_pkg) -add_old_configure_assignment("NSPR_LIBS", nspr_pkg.libs, when=nspr_pkg) +add_old_configure_assignment('NSPR_CFLAGS', nspr_config.cflags, when=nspr_config) +add_old_configure_assignment('NSPR_LIBS', nspr_config.libs, when=nspr_config) +add_old_configure_assignment('NSPR_CFLAGS', nspr_pkg.cflags, when=nspr_pkg) +add_old_configure_assignment('NSPR_LIBS', nspr_pkg.libs, when=nspr_pkg) diff --git a/build/moz.configure/nss.configure b/build/moz.configure/nss.configure index f3ac215885d4..b239f0532d3e 100644 --- a/build/moz.configure/nss.configure +++ b/build/moz.configure/nss.configure @@ -4,20 +4,18 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -option("--with-system-nss", help="Use system NSS") +option('--with-system-nss', help='Use system NSS') -imply_option("--with-system-nspr", True, when="--with-system-nss") +imply_option('--with-system-nspr', True, when='--with-system-nss') -nss_pkg = pkg_check_modules( - "NSS", "nss >= 3.59", when="--with-system-nss", config=False -) +nss_pkg = pkg_check_modules('NSS', 'nss >= 3.59', when='--with-system-nss', config=False) -set_config("MOZ_SYSTEM_NSS", True, when="--with-system-nss") +set_config('MOZ_SYSTEM_NSS', True, when='--with-system-nss') @depends(nss_pkg, check_build_environment) def nss_config(nss_pkg, build_env): - cflags = ["-I%s" % os.path.join(build_env.dist, "include", "nss")] + cflags = ['-I%s' % os.path.join(build_env.dist, 'include', 'nss')] libs = None if nss_pkg: cflags = list(nss_pkg.cflags) + cflags @@ -25,6 +23,6 @@ def nss_config(nss_pkg, build_env): return namespace(cflags=cflags, libs=libs) -set_config("NSS_CFLAGS", nss_config.cflags) -set_config("NSS_LIBS", nss_config.libs) -add_old_configure_assignment("NSS_CFLAGS", nss_config.cflags) +set_config('NSS_CFLAGS', nss_config.cflags) +set_config('NSS_LIBS', nss_config.libs) +add_old_configure_assignment('NSS_CFLAGS', nss_config.cflags) diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configure index 4c4987e1d4e9..8c807c0794fa 100644 --- a/build/moz.configure/old.configure +++ b/build/moz.configure/old.configure @@ -5,115 +5,113 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. -m4 = check_prog("M4", ("m4",)) +m4 = check_prog('M4', ('m4',)) @depends(mozconfig) def prepare_mozconfig(mozconfig): - if mozconfig["path"]: + if mozconfig['path']: items = {} - for key, value in mozconfig["vars"]["added"].items(): - items[key] = (value, "added") - for key, (old, value) in mozconfig["vars"]["modified"].items(): - items[key] = (value, "modified") - for t in ("env", "vars"): - for key in mozconfig[t]["removed"].keys(): - items[key] = (None, "removed " + t) + for key, value in mozconfig['vars']['added'].items(): + items[key] = (value, 'added') + for key, (old, value) in mozconfig['vars']['modified'].items(): + items[key] = (value, 'modified') + for t in ('env', 'vars'): + for key in mozconfig[t]['removed'].keys(): + items[key] = (None, 'removed ' + t) return items -@depends("OLD_CONFIGURE", build_project) +@depends('OLD_CONFIGURE', build_project) def old_configure(old_configure, build_project): # os.path.abspath in the sandbox will ensure forward slashes on Windows, # which is actually necessary because this path actually ends up literally # as $0, and backslashes there breaks autoconf's detection of the source # directory. old_configure = os.path.abspath(old_configure[0]) - if build_project == "js": + if build_project == 'js': old_configure_dir = os.path.dirname(old_configure) - if not old_configure_dir.endswith("/js/src"): - old_configure = os.path.join( - old_configure_dir, "js", "src", os.path.basename(old_configure) - ) + if not old_configure_dir.endswith('/js/src'): + old_configure = os.path.join(old_configure_dir, 'js', 'src', + os.path.basename(old_configure)) return old_configure @depends(prepare_mozconfig, old_configure_assignments) -@imports(_from="__builtin__", _import="open") -@imports(_from="__builtin__", _import="print") -@imports(_from="__builtin__", _import="sorted") -@imports(_from="mozbuild.shellutil", _import="quote") +@imports(_from='__builtin__', _import='open') +@imports(_from='__builtin__', _import='print') +@imports(_from='__builtin__', _import='sorted') +@imports(_from='mozbuild.shellutil', _import='quote') def prepare_configure(mozconfig, old_configure_assignments): - with open("old-configure.vars", "w") as out: - log.debug("Injecting the following to old-configure:") + with open('old-configure.vars', 'w') as out: + log.debug('Injecting the following to old-configure:') def inject(command): - print(command, file=out) # noqa Python 2vs3 - log.debug("| %s", command) + print(command, file=out) # noqa Python 2vs3 + log.debug('| %s', command) if mozconfig: - inject("# start of mozconfig values") + inject('# start of mozconfig values') for key, (value, action) in sorted(mozconfig.items()): - if action.startswith("removed "): - inject("unset %s # from %s" % (key, action[len("removed ") :])) + if action.startswith('removed '): + inject("unset %s # from %s" % ( + key, action[len('removed '):])) else: inject("%s=%s # %s" % (key, quote(value), action)) - inject("# end of mozconfig values") + inject('# end of mozconfig values') for k, v in old_configure_assignments: - inject("%s=%s" % (k, quote(v))) + inject('%s=%s' % (k, quote(v))) @template def old_configure_options(*options): for opt in options: - option(opt, nargs="*", help="Help missing for old configure options") + option(opt, nargs='*', help='Help missing for old configure options') @dependable def all_options(): return list(options) - return depends( - host_for_sub_configure, target_for_sub_configure, all_options, *options - ) + return depends(host_for_sub_configure, target_for_sub_configure, all_options, *options) @old_configure_options( - "--cache-file", - "--datadir", - "--enable-crashreporter", - "--enable-dbus", - "--enable-debug-js-modules", - "--enable-dump-painting", - "--enable-extensions", - "--enable-libproxy", - "--enable-logrefcnt", - "--enable-necko-wifi", - "--enable-negotiateauth", - "--enable-official-branding", - "--enable-parental-controls", - "--enable-sandbox", - "--enable-system-cairo", - "--enable-system-extension-dirs", - "--enable-system-pixman", - "--enable-universalchardet", - "--enable-updater", - "--enable-xul", - "--enable-zipwriter", - "--includedir", - "--libdir", - "--prefix", - "--with-android-max-sdk", - "--with-android-min-sdk", - "--with-branding", - "--with-distribution-id", - "--with-macbundlename-prefix", - "--with-system-libevent", - "--with-system-png", - "--with-user-appdir", - "--x-includes", - "--x-libraries", + '--cache-file', + '--datadir', + '--enable-crashreporter', + '--enable-dbus', + '--enable-debug-js-modules', + '--enable-dump-painting', + '--enable-extensions', + '--enable-libproxy', + '--enable-logrefcnt', + '--enable-necko-wifi', + '--enable-negotiateauth', + '--enable-official-branding', + '--enable-parental-controls', + '--enable-sandbox', + '--enable-system-cairo', + '--enable-system-extension-dirs', + '--enable-system-pixman', + '--enable-universalchardet', + '--enable-updater', + '--enable-xul', + '--enable-zipwriter', + '--includedir', + '--libdir', + '--prefix', + '--with-android-max-sdk', + '--with-android-min-sdk', + '--with-branding', + '--with-distribution-id', + '--with-macbundlename-prefix', + '--with-system-libevent', + '--with-system-png', + '--with-user-appdir', + '--x-includes', + '--x-libraries', ) def prepare_configure_options(host, target, all_options, *options): # old-configure only supports the options listed in @old_configure_options @@ -122,7 +120,7 @@ def prepare_configure_options(host, target, all_options, *options): options = [ value.format(name) for name, value in zip(all_options, options) - if value.origin != "default" + if value.origin != 'default' ] + [host, target] return namespace(options=options, all_options=all_options) @@ -133,57 +131,36 @@ def old_configure_for(old_configure_path, extra_env=None): if extra_env is None: extra_env = dependable(None) - @depends( - prepare_configure, - prepare_configure_options, - altered_path, - extra_env, - check_build_environment, - old_configure_path, - "MOZILLABUILD", - awk, - m4, - shell, - ) - @imports(_from="__builtin__", _import="compile") - @imports(_from="__builtin__", _import="open") - @imports(_from="__builtin__", _import="OSError") - @imports("glob") - @imports("itertools") - @imports("logging") - @imports("os") - @imports("subprocess") - @imports("sys") - @imports(_from="mozbuild.shellutil", _import="quote") - @imports(_from="mozbuild.shellutil", _import="split") - @imports(_from="tempfile", _import="NamedTemporaryFile") - @imports(_from="subprocess", _import="CalledProcessError") - @imports(_from="six", _import="exec_") - @imports(_from="six", _import="iteritems") - @imports(_from="six", _import="string_types") - def old_configure( - prepare_configure, - prepare_configure_options, - altered_path, - extra_env, - build_env, - old_configure, - mozillabuild, - awk, - m4, - shell, - ): + @depends(prepare_configure, prepare_configure_options, altered_path, extra_env, + check_build_environment, old_configure_path, 'MOZILLABUILD', awk, m4, shell) + @imports(_from='__builtin__', _import='compile') + @imports(_from='__builtin__', _import='open') + @imports(_from='__builtin__', _import='OSError') + @imports('glob') + @imports('itertools') + @imports('logging') + @imports('os') + @imports('subprocess') + @imports('sys') + @imports(_from='mozbuild.shellutil', _import='quote') + @imports(_from='mozbuild.shellutil', _import='split') + @imports(_from='tempfile', _import='NamedTemporaryFile') + @imports(_from='subprocess', _import='CalledProcessError') + @imports(_from='six', _import='exec_') + @imports(_from='six', _import='iteritems') + @imports(_from='six', _import='string_types') + def old_configure(prepare_configure, prepare_configure_options, altered_path, extra_env, + build_env, old_configure, mozillabuild, awk, m4, shell): # Use prepare_configure to make lint happy prepare_configure refresh = True if os.path.exists(old_configure): mtime = os.path.getmtime(old_configure) - aclocal = os.path.join(build_env.topsrcdir, "build", "autoconf", "*.m4") + aclocal = os.path.join(build_env.topsrcdir, 'build', 'autoconf', + '*.m4') for input in itertools.chain( - ( - old_configure + ".in", - os.path.join(os.path.dirname(old_configure), "aclocal.m4"), - ), + (old_configure + '.in', + os.path.join(os.path.dirname(old_configure), 'aclocal.m4')), glob.iglob(aclocal), ): if os.path.getmtime(input) > mtime: @@ -192,54 +169,40 @@ def old_configure_for(old_configure_path, extra_env=None): refresh = False if refresh: - autoconf = os.path.join( - build_env.topsrcdir, "build", "autoconf", "autoconf.sh" - ) - log.info("Refreshing %s with %s", old_configure, autoconf) + autoconf = os.path.join(build_env.topsrcdir, 'build', 'autoconf', 'autoconf.sh') + log.info('Refreshing %s with %s', old_configure, autoconf) env = dict(os.environ) - env["M4"] = m4 - env["AWK"] = awk - env["AC_MACRODIR"] = os.path.join(build_env.topsrcdir, "build", "autoconf") + env['M4'] = m4 + env['AWK'] = awk + env['AC_MACRODIR'] = os.path.join(build_env.topsrcdir, 'build', 'autoconf') try: - script = subprocess.check_output( - [ - shell, - autoconf, - "--localdir=%s" % os.path.dirname(old_configure), - old_configure + ".in", - ], - env=env, - ) + script = subprocess.check_output([ + shell, autoconf, + '--localdir=%s' % os.path.dirname(old_configure), + old_configure + '.in'], env=env) except CalledProcessError as exc: # Autoconf on win32 may break due to a bad $PATH. Let the user know # their $PATH is suspect. if mozillabuild: mozillabuild_path = normsep(mozillabuild[0]) - sh_path = normsep(find_program("sh")) + sh_path = normsep(find_program('sh')) if mozillabuild_path not in sh_path: - log.warning( - "The '{}msys/bin' directory is not first in $PATH. " - "This may cause autoconf to fail. ($PATH is currently " - "set to: {})".format(mozillabuild_path, os.environ["PATH"]) - ) - die("autoconf exited with return code {}".format(exc.returncode)) + log.warning("The '{}msys/bin' directory is not first in $PATH. " + "This may cause autoconf to fail. ($PATH is currently " + "set to: {})".format(mozillabuild_path, os.environ[ + 'PATH'])) + die('autoconf exited with return code {}'.format(exc.returncode)) if not script: - die( - "Generated old-configure is empty! Check that your autoconf 2.13 program works!" - ) + die('Generated old-configure is empty! Check that your autoconf 2.13 program works!') # Make old-configure append to config.log, where we put our own log. # This could be done with a m4 macro, but it's way easier this way - script = script.replace(b">./config.log", b">>${CONFIG_LOG=./config.log}") - - with NamedTemporaryFile( - mode="wb", - prefix=os.path.basename(old_configure), - dir=os.path.dirname(old_configure), - delete=False, - ) as fh: + script = script.replace(b'>./config.log', b'>>${CONFIG_LOG=./config.log}') + + with NamedTemporaryFile(mode='wb', prefix=os.path.basename(old_configure), + dir=os.path.dirname(old_configure), delete=False) as fh: fh.write(script) try: @@ -250,40 +213,37 @@ def old_configure_for(old_configure_path, extra_env=None): os.remove(old_configure) os.rename(fh.name, old_configure) except OSError as e: - die("Failed re-creating old-configure: %s" % e.message) + die('Failed re-creating old-configure: %s' % e.message) cmd = [shell, old_configure] + prepare_configure_options.options env = dict(os.environ) # For debugging purpose, in case it's not what we'd expect. - log.debug("Running %s", quote(*cmd)) + log.debug('Running %s', quote(*cmd)) # Our logging goes to config.log, the same file old.configure uses. # We can't share the handle on the file, so close it. - logger = logging.getLogger("moz.configure") + logger = logging.getLogger('moz.configure') config_log = None for handler in logger.handlers: if isinstance(handler, logging.FileHandler): config_log = handler config_log.close() logger.removeHandler(config_log) - env["CONFIG_LOG"] = config_log.baseFilename + env['CONFIG_LOG'] = config_log.baseFilename log_size = os.path.getsize(config_log.baseFilename) break if altered_path: - env["PATH"] = altered_path + env['PATH'] = altered_path if extra_env: env.update(extra_env) - env["OLD_CONFIGURE_VARS"] = os.path.join( - build_env.topobjdir, "old-configure.vars" - ) - proc = subprocess.Popen( - cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env - ) + env['OLD_CONFIGURE_VARS'] = os.path.join(build_env.topobjdir, 'old-configure.vars') + proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, + env=env) while True: line = proc.stdout.readline() if not line: @@ -294,58 +254,53 @@ def old_configure_for(old_configure_path, extra_env=None): if ret: with log.queue_debug(): if config_log: - with open(config_log.baseFilename, "r") as fh: + with open(config_log.baseFilename, 'r') as fh: fh.seek(log_size) for line in fh: log.debug(line.rstrip()) - log.error("old-configure failed") + log.error('old-configure failed') sys.exit(ret) if config_log: # Create a new handler in append mode - handler = logging.FileHandler(config_log.baseFilename, mode="a", delay=True) + handler = logging.FileHandler(config_log.baseFilename, mode='a', delay=True) handler.setFormatter(config_log.formatter) logger.addHandler(handler) raw_config = { - "split": split, - "unique_list": unique_list, + 'split': split, + 'unique_list': unique_list, } - with open("config.data", "r") as fh: - code = compile(fh.read(), "config.data", "exec") + with open('config.data', 'r') as fh: + code = compile(fh.read(), 'config.data', 'exec') exec_(code, raw_config) # Ensure all the flags known to old-configure appear in the # @old_configure_options above. all_options = set(prepare_configure_options.all_options) - for flag in raw_config["flags"]: + for flag in raw_config['flags']: if flag not in all_options: - die( - "Missing option in `@old_configure_options` in %s: %s", - __file__, - flag, - ) + die('Missing option in `@old_configure_options` in %s: %s', + __file__, flag) # If the code execution above fails, we want to keep the file around for # debugging. - os.remove("config.data") - - return namespace( - **{ - c: [ - (k[1:-1], v[1:-1] if isinstance(v, string_types) else v) - for k, v in raw_config[c] - ] - for c in ("substs", "defines") - } - ) + os.remove('config.data') + + return namespace(**{ + c: [ + (k[1:-1], v[1:-1] if isinstance(v, string_types) else v) + for k, v in raw_config[c] + ] + for c in ('substs', 'defines') + }) return old_configure old_configure = old_configure_for(old_configure) -set_config("OLD_CONFIGURE_SUBSTS", old_configure.substs) -set_config("OLD_CONFIGURE_DEFINES", old_configure.defines) +set_config('OLD_CONFIGURE_SUBSTS', old_configure.substs) +set_config('OLD_CONFIGURE_DEFINES', old_configure.defines) # Assuming no other option is declared after this function, handle the @@ -354,18 +309,17 @@ set_config("OLD_CONFIGURE_DEFINES", old_configure.defines) # them. We only do so for options that haven't been declared so far, # which should be a proxy for the options that old-configure handles # and that we don't know anything about. -@depends("--help") -@imports("__sandbox__") -@imports(_from="mozbuild.configure.options", _import="Option") +@depends('--help') +@imports('__sandbox__') +@imports(_from='mozbuild.configure.options', _import='Option') def remaining_mozconfig_options(_): helper = __sandbox__._helper for arg in list(helper): - if helper._origins[arg] != "mozconfig": + if helper._origins[arg] != 'mozconfig': continue - name = arg.split("=", 1)[0] + name = arg.split('=', 1)[0] if name.isupper() and name not in __sandbox__._options: - option = Option(env=name, nargs="*", help=name) + option = Option(env=name, nargs='*', help=name) helper.handle(option) - # Please do not add anything after remaining_mozconfig_options() diff --git a/build/moz.configure/pkg.configure b/build/moz.configure/pkg.configure index 20d90f17fdd7..cbc34409a629 100644 --- a/build/moz.configure/pkg.configure +++ b/build/moz.configure/pkg.configure @@ -7,17 +7,17 @@ @depends(toolchain_prefix, when=compile_environment) def pkg_config(prefixes): - return tuple("{}pkg-config".format(p) for p in (prefixes or ()) + ("",)) + return tuple('{}pkg-config'.format(p) + for p in (prefixes or ()) + ('',)) -pkg_config = check_prog("PKG_CONFIG", pkg_config, allow_missing=True) +pkg_config = check_prog('PKG_CONFIG', pkg_config, allow_missing=True) @depends_if(pkg_config) -@checking("for pkg-config version") +@checking('for pkg-config version') def pkg_config_version(pkg_config): - return Version(check_cmd_output(pkg_config, "--version").rstrip()) - + return Version(check_cmd_output(pkg_config, '--version').rstrip()) # Locates the given module using pkg-config. # - `var` determines the name of variables to set when the package is found. @@ -34,41 +34,38 @@ def pkg_config_version(pkg_config): @template -def pkg_check_modules(var, package_desc, when=always, allow_missing=False, config=True): +def pkg_check_modules(var, package_desc, when=always, + allow_missing=False, config=True): if isinstance(package_desc, (tuple, list)): - package_desc = " ".join(package_desc) + package_desc = ' '.join(package_desc) package_desc = dependable(package_desc) allow_missing = dependable(allow_missing) - @depends(when, "--enable-compile-environment") + @depends(when, '--enable-compile-environment') def when_and_compile_environment(when, compile_environment): return when and compile_environment - @depends(pkg_config, pkg_config_version, when=when_and_compile_environment) + @depends(pkg_config, pkg_config_version, + when=when_and_compile_environment) def check_pkg_config(pkg_config, version): - min_version = "0.9.0" + min_version = '0.9.0' if pkg_config is None: - die( - "*** The pkg-config script could not be found. Make sure it is\n" + die("*** The pkg-config script could not be found. Make sure it is\n" "*** in your path, or set the PKG_CONFIG environment variable\n" - "*** to the full path to pkg-config." - ) + "*** to the full path to pkg-config.") if version < min_version: - die( - "*** Your version of pkg-config is too old. You need version %s or newer.", - min_version, - ) + die("*** Your version of pkg-config is too old. You need version %s or newer.", + min_version) @depends(pkg_config, package_desc, allow_missing, when=when_and_compile_environment) - @imports("sys") - @imports(_from="mozbuild.configure.util", _import="LineIO") + @imports('sys') + @imports(_from='mozbuild.configure.util', _import='LineIO') def package(pkg_config, package_desc, allow_missing): # package_desc may start as a depends function, so we can't use # @checking here. log.info("checking for %s... " % package_desc) retcode, stdout, stderr = get_cmd_output( - pkg_config, "--errors-to-stdout", "--print-errors", package_desc - ) + pkg_config, '--errors-to-stdout', '--print-errors', package_desc) if retcode == 0: log.info("yes") return True @@ -80,24 +77,24 @@ def pkg_check_modules(var, package_desc, when=always, allow_missing=False, confi sys.exit(1) @depends(pkg_config, package_desc, when=package) - @checking("%s_CFLAGS" % var, callback=lambda t: " ".join(t)) + @checking('%s_CFLAGS' % var, callback=lambda t: ' '.join(t)) def pkg_cflags(pkg_config, package_desc): - flags = check_cmd_output(pkg_config, "--cflags", package_desc) + flags = check_cmd_output(pkg_config, '--cflags', package_desc) return tuple(flags.split()) @depends(pkg_config, package_desc, when=package) - @checking("%s_LIBS" % var, callback=lambda t: " ".join(t)) + @checking('%s_LIBS' % var, callback=lambda t: ' '.join(t)) def pkg_libs(pkg_config, package_desc): - libs = check_cmd_output(pkg_config, "--libs", package_desc) + libs = check_cmd_output(pkg_config, '--libs', package_desc) # Remove evil flags like -Wl,--export-dynamic - return tuple(libs.replace("-Wl,--export-dynamic", "").split()) + return tuple(libs.replace('-Wl,--export-dynamic', '').split()) @depends(pkg_cflags, pkg_libs, when=package) def pkg_info(cflags, libs): return namespace(cflags=cflags, libs=libs) if config: - set_config("%s_CFLAGS" % var, pkg_cflags) - set_config("%s_LIBS" % var, pkg_libs) + set_config('%s_CFLAGS' % var, pkg_cflags) + set_config('%s_LIBS' % var, pkg_libs) return pkg_info diff --git a/build/moz.configure/rust.configure b/build/moz.configure/rust.configure index f4fcdd60e932..0d6d2faf9377 100644 --- a/build/moz.configure/rust.configure +++ b/build/moz.configure/rust.configure @@ -7,25 +7,15 @@ # Rust is required by `rust_compiler` below. We allow_missing here # to propagate failures to the better error message there. -option(env="RUSTC", nargs=1, help="Path to the rust compiler") -option(env="CARGO", nargs=1, help="Path to the Cargo package manager") - -rustc = check_prog( - "_RUSTC", - ["rustc"], - what="rustc", - paths=toolchain_search_path, - input="RUSTC", - allow_missing=True, -) -cargo = check_prog( - "_CARGO", - ["cargo"], - what="cargo", - paths=toolchain_search_path, - input="CARGO", - allow_missing=True, -) +option(env='RUSTC', nargs=1, help='Path to the rust compiler') +option(env='CARGO', nargs=1, help='Path to the Cargo package manager') + +rustc = check_prog('_RUSTC', ['rustc'], what='rustc', + paths=toolchain_search_path, input='RUSTC', + allow_missing=True) +cargo = check_prog('_CARGO', ['cargo'], what='cargo', + paths=toolchain_search_path, input='CARGO', + allow_missing=True) @template @@ -51,28 +41,29 @@ def unwrap_rustup(prog, name): # "+stable" file. We'll examine the error output to try and distinguish # between failing rustup and failing rustc. @depends(prog, dependable(name)) - @imports(_from="__builtin__", _import="open") - @imports("os") + @imports(_from='__builtin__', _import='open') + @imports('os') def unwrap(prog, name): if not prog: return def from_rustup_which(): - out = check_cmd_output("rustup", "which", name, executable=prog).rstrip() + out = check_cmd_output('rustup', 'which', name, + executable=prog).rstrip() # If for some reason the above failed to return something, keep the # PROG we found originally. if out: - log.info("Actually using '%s'", out) + log.info('Actually using \'%s\'', out) return out - log.info("No `rustup which` output, using '%s'", prog) + log.info('No `rustup which` output, using \'%s\'', prog) return prog - (retcode, stdout, stderr) = get_cmd_output(prog, "+stable") + (retcode, stdout, stderr) = get_cmd_output(prog, '+stable') - if name == "cargo" and retcode != 101: + if name == 'cargo' and retcode != 101: prog = from_rustup_which() - elif name == "rustc": + elif name == 'rustc': if retcode == 0: prog = from_rustup_which() elif "+stable" in stderr: @@ -90,56 +81,51 @@ def unwrap_rustup(prog, name): return unwrap - -rustc = unwrap_rustup(rustc, "rustc") -cargo = unwrap_rustup(cargo, "cargo") +rustc = unwrap_rustup(rustc, 'rustc') +cargo = unwrap_rustup(cargo, 'cargo') -set_config("CARGO", cargo) -set_config("RUSTC", rustc) +set_config('CARGO', cargo) +set_config('RUSTC', rustc) @depends_if(rustc) -@checking("rustc version", lambda info: info.version) +@checking('rustc version', lambda info: info.version) def rustc_info(rustc): if not rustc: return - out = check_cmd_output(rustc, "--version", "--verbose").splitlines() - info = dict((s.strip() for s in line.split(":", 1)) for line in out[1:]) + out = check_cmd_output(rustc, '--version', '--verbose').splitlines() + info = dict((s.strip() for s in line.split(':', 1)) for line in out[1:]) return namespace( - version=Version(info.get("release", "0")), - commit=info.get("commit-hash", "unknown"), - host=info["host"], - llvm_version=Version(info.get("LLVM version", "0")), + version=Version(info.get('release', '0')), + commit=info.get('commit-hash', 'unknown'), + host=info['host'], + llvm_version=Version(info.get('LLVM version', '0')), ) - -set_config( - "RUSTC_VERSION", - depends(rustc_info)(lambda info: str(info.version) if info else None), -) - +set_config('RUSTC_VERSION', depends(rustc_info)( + lambda info: str(info.version) if info else None)) @depends_if(cargo) -@checking("cargo version", lambda info: info.version) -@imports("re") +@checking('cargo version', lambda info: info.version) +@imports('re') def cargo_info(cargo): if not cargo: return - out = check_cmd_output(cargo, "--version", "--verbose").splitlines() - info = dict((s.strip() for s in line.split(":", 1)) for line in out[1:]) - version = info.get("release") + out = check_cmd_output(cargo, '--version', '--verbose').splitlines() + info = dict((s.strip() for s in line.split(':', 1)) for line in out[1:]) + version = info.get('release') # Older versions of cargo didn't support --verbose, in which case, they # only output a not-really-pleasant-to-parse output. Fortunately, they # don't error out, so we can just try some regexp matching on the output # we already got. if version is None: - VERSION_FORMAT = r"^cargo (\d\.\d+\.\d+).*" + VERSION_FORMAT = r'^cargo (\d\.\d+\.\d+).*' m = re.search(VERSION_FORMAT, out[0]) # Fail fast if cargo changes its output on us. if not m: - die("Could not determine cargo version from output: %s", out) + die('Could not determine cargo version from output: %s', out) version = m.group(1) return namespace( @@ -148,42 +134,35 @@ def cargo_info(cargo): @depends(rustc_info, cargo_info, build_project, c_compiler, target) -@imports(_from="mozboot.util", _import="MINIMUM_RUST_VERSION") -@imports(_from="textwrap", _import="dedent") +@imports(_from='mozboot.util', _import='MINIMUM_RUST_VERSION') +@imports(_from='textwrap', _import='dedent') def rust_compiler(rustc_info, cargo_info, build_project, c_compiler, target): if not rustc_info: - die( - dedent( - """\ + die(dedent('''\ Rust compiler not found. To compile rust language sources, you must have 'rustc' in your path. See https://www.rust-lang.org/ for more information. You can install rust by running './mach bootstrap' or by directly running the installer from https://rustup.rs/ - """ - ) - ) - if build_project == "tools/crashreporter": - rustc_min_version = Version("1.38.0") - elif target.os == "WINNT" and c_compiler.type != "clang-cl": - rustc_min_version = Version("1.44.0") + ''')) + if build_project == 'tools/crashreporter': + rustc_min_version = Version('1.38.0') + elif target.os == 'WINNT' and c_compiler.type != 'clang-cl': + rustc_min_version = Version('1.44.0') else: rustc_min_version = Version(MINIMUM_RUST_VERSION) cargo_min_version = rustc_min_version version = rustc_info.version - is_nightly = "nightly" in version.version + is_nightly = 'nightly' in version.version is_version_number_match = ( - version.major == rustc_min_version.major - and version.minor == rustc_min_version.minor - and version.patch == rustc_min_version.patch - ) + version.major == rustc_min_version.major and + version.minor == rustc_min_version.minor and + version.patch == rustc_min_version.patch) if version < rustc_min_version or (is_version_number_match and is_nightly): - die( - dedent( - """\ + die(dedent('''\ Rust compiler {} is too old. To compile Rust language sources please install at least @@ -196,60 +175,48 @@ def rust_compiler(rustc_info, cargo_info, build_project, c_compiler, target): If you have the 'rustup' tool installed you can upgrade to the latest release by typing 'rustup update'. The installer is available from https://rustup.rs/ - """.format( - version, rustc_min_version, rustc_min_version - ) - ) - ) + '''.format(version, rustc_min_version, rustc_min_version))) if not cargo_info: - die( - dedent( - """\ + die(dedent('''\ Cargo package manager not found. To compile Rust language sources, you must have 'cargo' in your path. See https://www.rust-lang.org/ for more information. You can install cargo by running './mach bootstrap' or by directly running the installer from https://rustup.rs/ - """ - ) - ) + ''')) version = cargo_info.version if version < cargo_min_version: - die( - dedent( - """\ + die(dedent('''\ Cargo package manager {} is too old. To compile Rust language sources please install at least version {} of 'cargo' and make sure it is first in your path. You can verify this by typing 'cargo --version'. - """ - ).format(version, cargo_min_version) - ) + ''').format(version, cargo_min_version)) return True @depends(rustc, when=rust_compiler) -@imports(_from="__builtin__", _import="ValueError") +@imports(_from='__builtin__', _import='ValueError') def rust_supported_targets(rustc): - out = check_cmd_output(rustc, "--print", "target-list").splitlines() + out = check_cmd_output(rustc, '--print', 'target-list').splitlines() data = {} for t in out: try: info = split_triplet(t) except ValueError: - if t.startswith("thumb"): - cpu, rest = t.split("-", 1) - retry = "-".join(("arm", rest)) - elif t.endswith("-windows-msvc"): - retry = t[: -len("windows-msvc")] + "mingw32" - elif t.endswith("-windows-gnu"): - retry = t[: -len("windows-gnu")] + "mingw32" + if t.startswith('thumb'): + cpu, rest = t.split('-', 1) + retry = '-'.join(('arm', rest)) + elif t.endswith('-windows-msvc'): + retry = t[:-len('windows-msvc')] + 'mingw32' + elif t.endswith('-windows-gnu'): + retry = t[:-len('windows-gnu')] + 'mingw32' else: continue try: @@ -261,9 +228,7 @@ def rust_supported_targets(rustc): return data -def detect_rustc_target( - host_or_target, compiler_info, arm_target, rust_supported_targets -): +def detect_rustc_target(host_or_target, compiler_info, arm_target, rust_supported_targets): # Rust's --target options are similar to, but not exactly the same # as, the autoconf-derived targets we use. An example would be that # Rust uses distinct target triples for targetting the GNU C++ ABI @@ -274,8 +239,7 @@ def detect_rustc_target( # We correlate the autoconf-derived targets with the list of targets # rustc gives us with --print target-list. candidates = rust_supported_targets.get( - (host_or_target.cpu, host_or_target.endianness, host_or_target.os), [] - ) + (host_or_target.cpu, host_or_target.endianness, host_or_target.os), []) def find_candidate(candidates): if len(candidates) == 1: @@ -286,25 +250,20 @@ def detect_rustc_target( # We have multiple candidates. There are two cases where we can try to # narrow further down using extra information from the build system. # - For windows targets, correlate with the C compiler type - if host_or_target.kernel == "WINNT": - if compiler_info.type in ("gcc", "clang"): - suffix = "windows-gnu" + if host_or_target.kernel == 'WINNT': + if compiler_info.type in ('gcc', 'clang'): + suffix = 'windows-gnu' else: - suffix = "windows-msvc" - narrowed = [ - c for c in candidates if c.rust_target.endswith("-{}".format(suffix)) - ] + suffix = 'windows-msvc' + narrowed = [c for c in candidates if c.rust_target.endswith('-{}'.format(suffix))] if len(narrowed) == 1: return narrowed[0].rust_target elif narrowed: candidates = narrowed - vendor_aliases = {"pc": ("w64", "windows")} - narrowed = [ - c - for c in candidates - if host_or_target.vendor in vendor_aliases.get(c.target.vendor, ()) - ] + vendor_aliases = {'pc': ('w64', 'windows')} + narrowed = [c for c in candidates + if host_or_target.vendor in vendor_aliases.get(c.target.vendor, ())] if len(narrowed) == 1: return narrowed[0].rust_target @@ -315,40 +274,39 @@ def detect_rustc_target( # Also, sadly, the only interface to check the rust target cpu features # is --print target-spec-json, and it's unstable, so we have to rely on # our own knowledge of what each arm target means. - if host_or_target.cpu == "arm" and host_or_target.endianness == "little": + if host_or_target.cpu == 'arm' and host_or_target.endianness == 'little': prefixes = [] if arm_target.arm_arch >= 7: - if arm_target.thumb2 and arm_target.fpu == "neon": - prefixes.append("thumbv7neon") + if arm_target.thumb2 and arm_target.fpu == 'neon': + prefixes.append('thumbv7neon') if arm_target.thumb2: - prefixes.append("thumbv7a") - prefixes.append("armv7") + prefixes.append('thumbv7a') + prefixes.append('armv7') if arm_target.arm_arch >= 6: - prefixes.append("armv6") - if host_or_target.os != "Android": + prefixes.append('armv6') + if host_or_target.os != 'Android': # arm-* rust targets are armv6... except arm-linux-androideabi - prefixes.append("arm") + prefixes.append('arm') if arm_target.arm_arch >= 5: - prefixes.append("armv5te") - if host_or_target.os == "Android": + prefixes.append('armv5te') + if host_or_target.os == 'Android': # arm-* rust targets are armv6... except arm-linux-androideabi - prefixes.append("arm") + prefixes.append('arm') if arm_target.arm_arch >= 4: - prefixes.append("armv4t") + prefixes.append('armv4t') # rust freebsd targets are the only ones that don't have a 'hf' suffix # for hard-float. Technically, that means if the float abi ever is not # hard-float, this will pick a wrong target, but since rust only # supports hard-float, let's assume that means freebsd only support # hard-float. - if arm_target.float_abi == "hard" and host_or_target.os != "FreeBSD": - suffix = "hf" + if arm_target.float_abi == 'hard' and host_or_target.os != 'FreeBSD': + suffix = 'hf' else: - suffix = "" + suffix = '' for p in prefixes: for c in candidates: - if c.rust_target.startswith( - "{}-".format(p) - ) and c.rust_target.endswith(suffix): + if c.rust_target.startswith('{}-'.format(p)) and \ + c.rust_target.endswith(suffix): return c.rust_target # See if we can narrow down on the exact alias @@ -367,16 +325,18 @@ def detect_rustc_target( # See if we can narrow down with the raw OS and raw CPU narrowed = [ - c - for c in candidates - if c.target.raw_os == host_or_target.raw_os - and c.target.raw_cpu == host_or_target.raw_cpu + c for c in candidates + if c.target.raw_os == host_or_target.raw_os and + c.target.raw_cpu == host_or_target.raw_cpu ] if len(narrowed) == 1: return narrowed[0].rust_target # Finally, see if the vendor can be used to disambiguate. - narrowed = [c for c in candidates if c.target.vendor == host_or_target.vendor] + narrowed = [ + c for c in candidates + if c.target.vendor == host_or_target.vendor + ] if len(narrowed) == 1: return narrowed[0].rust_target @@ -385,27 +345,28 @@ def detect_rustc_target( rustc_target = find_candidate(candidates) if rustc_target is None: - die("Don't know how to translate {} for rustc".format(host_or_target.alias)) + die("Don't know how to translate {} for rustc".format( + host_or_target.alias)) return rustc_target -@imports("os") -@imports(_from="six", _import="ensure_binary") -@imports(_from="tempfile", _import="mkstemp") -@imports(_from="textwrap", _import="dedent") -@imports(_from="mozbuild.configure.util", _import="LineIO") +@imports('os') +@imports(_from='six', _import='ensure_binary') +@imports(_from='tempfile', _import='mkstemp') +@imports(_from='textwrap', _import='dedent') +@imports(_from='mozbuild.configure.util', _import='LineIO') def assert_rust_compile(host_or_target, rustc_target, rustc): # Check to see whether our rustc has a reasonably functional stdlib # for our chosen target. - target_arg = "--target=" + rustc_target - in_fd, in_path = mkstemp(prefix="conftest", suffix=".rs", text=True) - out_fd, out_path = mkstemp(prefix="conftest", suffix=".rlib") + target_arg = '--target=' + rustc_target + in_fd, in_path = mkstemp(prefix='conftest', suffix='.rs', text=True) + out_fd, out_path = mkstemp(prefix='conftest', suffix='.rlib') os.close(out_fd) try: source = 'pub extern fn hello() { println!("Hello world"); }' - log.debug("Creating `%s` with content:", in_path) - with LineIO(lambda l: log.debug("| %s", l)) as out: + log.debug('Creating `%s` with content:', in_path) + with LineIO(lambda l: log.debug('| %s', l)) as out: out.write(source) os.write(in_fd, ensure_binary(source)) @@ -413,29 +374,20 @@ def assert_rust_compile(host_or_target, rustc_target, rustc): cmd = [ rustc, - "--crate-type", - "staticlib", + '--crate-type', 'staticlib', target_arg, - "-o", - out_path, + '-o', out_path, in_path, ] def failed(): - die( - dedent( - """\ + die(dedent('''\ Cannot compile for {} with {} The target may be unsupported, or you may not have a rust std library for that target installed. Try: rustup target add {} - """.format( - host_or_target.alias, rustc, rustc_target - ) - ) - ) - + '''.format(host_or_target.alias, rustc, rustc_target))) check_cmd_output(*cmd, onerror=failed) if not os.path.exists(out_path) or os.path.getsize(out_path) == 0: failed() @@ -444,31 +396,20 @@ def assert_rust_compile(host_or_target, rustc_target, rustc): os.remove(out_path) -@depends( - rustc, - host, - host_c_compiler, - rustc_info.host, - rust_supported_targets, - arm_target, - when=rust_compiler, -) -@checking("for rust host triplet") -@imports(_from="textwrap", _import="dedent") -def rust_host_triple( - rustc, host, compiler_info, rustc_host, rust_supported_targets, arm_target -): - rustc_target = detect_rustc_target( - host, compiler_info, arm_target, rust_supported_targets - ) +@depends(rustc, host, host_c_compiler, rustc_info.host, rust_supported_targets, + arm_target, when=rust_compiler) +@checking('for rust host triplet') +@imports(_from='textwrap', _import='dedent') +def rust_host_triple(rustc, host, compiler_info, rustc_host, rust_supported_targets, + arm_target): + rustc_target = detect_rustc_target(host, compiler_info, arm_target, + rust_supported_targets) if rustc_target != rustc_host: if host.alias == rustc_target: configure_host = host.alias else: - configure_host = "{}/{}".format(host.alias, rustc_target) - die( - dedent( - """\ + configure_host = '{}/{}'.format(host.alias, rustc_target) + die(dedent('''\ The rust compiler host ({rustc}) is not suitable for the configure host ({configure}). You can solve this by: @@ -476,79 +417,59 @@ def rust_host_triple( mozconfig and adding "ac_add_options --host={rustc}". * Or, install the rust toolchain for {configure}, if supported, by running "rustup default stable-{rustc_target}" - """.format( - rustc=rustc_host, - configure=configure_host, - rustc_target=rustc_target, - ) - ) - ) + '''.format(rustc=rustc_host, configure=configure_host, rustc_target=rustc_target))) assert_rust_compile(host, rustc_target, rustc) return rustc_target - -@depends( - rustc, target, c_compiler, rust_supported_targets, arm_target, when=rust_compiler -) -@checking("for rust target triplet") -def rust_target_triple( - rustc, target, compiler_info, rust_supported_targets, arm_target -): - rustc_target = detect_rustc_target( - target, compiler_info, arm_target, rust_supported_targets - ) +@depends(rustc, target, c_compiler, rust_supported_targets, arm_target, when=rust_compiler) +@checking('for rust target triplet') +def rust_target_triple(rustc, target, compiler_info, rust_supported_targets, arm_target): + rustc_target = detect_rustc_target(target, compiler_info, arm_target, rust_supported_targets) assert_rust_compile(target, rustc_target, rustc) return rustc_target -set_config("RUST_TARGET", rust_target_triple) -set_config("RUST_HOST_TARGET", rust_host_triple) +set_config('RUST_TARGET', rust_target_triple) +set_config('RUST_HOST_TARGET', rust_host_triple) # This is used for putting source info into symbol files. -set_config("RUSTC_COMMIT", depends(rustc_info)(lambda i: i.commit)) +set_config('RUSTC_COMMIT', depends(rustc_info)(lambda i: i.commit)) # Rustdoc is required by Rust tests below. -option(env="RUSTDOC", nargs=1, help="Path to the rustdoc program") +option(env='RUSTDOC', nargs=1, help='Path to the rustdoc program') -rustdoc = check_prog( - "RUSTDOC", - ["rustdoc"], - paths=toolchain_search_path, - input="RUSTDOC", - allow_missing=True, -) +rustdoc = check_prog('RUSTDOC', ['rustdoc'], paths=toolchain_search_path, + input='RUSTDOC', allow_missing=True) # This option is separate from --enable-tests because Rust tests are particularly # expensive in terms of compile time (especially for code in libxul). -option( - "--enable-rust-tests", - help="Enable building and running of Rust tests during `make check`", -) +option('--enable-rust-tests', + help='Enable building and running of Rust tests during `make check`') -@depends("--enable-rust-tests", rustdoc) +@depends('--enable-rust-tests', rustdoc) def rust_tests(enable_rust_tests, rustdoc): if enable_rust_tests and not rustdoc: - die("--enable-rust-tests requires rustdoc") + die('--enable-rust-tests requires rustdoc') return bool(enable_rust_tests) -set_config("MOZ_RUST_TESTS", rust_tests) +set_config('MOZ_RUST_TESTS', rust_tests) @depends(target, c_compiler, rustc) -@imports("os") +@imports('os') def rustc_natvis_ldflags(target, compiler_info, rustc): - if target.kernel == "WINNT" and compiler_info.type == "clang-cl": - sysroot = check_cmd_output(rustc, "--print", "sysroot").strip() - etc = os.path.join(sysroot, "lib/rustlib/etc") + if target.kernel == 'WINNT' and compiler_info.type == 'clang-cl': + sysroot = check_cmd_output(rustc, '--print', 'sysroot').strip() + etc = os.path.join(sysroot, 'lib/rustlib/etc') ldflags = [] if os.path.isdir(etc): for f in os.listdir(etc): - if f.endswith(".natvis"): - ldflags.append("-NATVIS:" + normsep(os.path.join(etc, f))) + if f.endswith('.natvis'): + ldflags.append('-NATVIS:' + normsep(os.path.join(etc, f))) return ldflags -set_config("RUSTC_NATVIS_LDFLAGS", rustc_natvis_ldflags) +set_config('RUSTC_NATVIS_LDFLAGS', rustc_natvis_ldflags) diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure index a73b2a351e9c..e458fe47ea34 100755 --- a/build/moz.configure/toolchain.configure +++ b/build/moz.configure/toolchain.configure @@ -4,41 +4,41 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -imply_option("--enable-release", mozilla_official) -imply_option("--enable-release", depends_if("MOZ_AUTOMATION")(lambda x: True)) +imply_option('--enable-release', mozilla_official) +imply_option('--enable-release', depends_if('MOZ_AUTOMATION')(lambda x: True)) -option( - "--enable-release", - default=milestone.is_release_or_beta, - help="{Build|Do not build} with more conservative, release " - "engineering-oriented options.{ This may slow down builds.|}", -) +option('--enable-release', + default=milestone.is_release_or_beta, + help='{Build|Do not build} with more conservative, release ' + 'engineering-oriented options.{ This may slow down builds.|}') -@depends("--enable-release") +@depends('--enable-release') def developer_options(value): if not value: return True -add_old_configure_assignment("DEVELOPER_OPTIONS", developer_options) -set_config("DEVELOPER_OPTIONS", developer_options) +add_old_configure_assignment('DEVELOPER_OPTIONS', developer_options) +set_config('DEVELOPER_OPTIONS', developer_options) # Code optimization # ============================================================== -option("--disable-optimize", nargs="?", help="Disable optimizations via compiler flags") +option('--disable-optimize', + nargs='?', + help='Disable optimizations via compiler flags') -@depends("--enable-optimize", "--help") +@depends('--enable-optimize', '--help') def moz_optimize(option, _): flags = None if len(option): - val = "2" + val = '2' flags = option[0] elif option: - val = "1" + val = '1' else: val = None @@ -48,25 +48,22 @@ def moz_optimize(option, _): ) -set_config("MOZ_OPTIMIZE", moz_optimize.optimize) -add_old_configure_assignment("MOZ_OPTIMIZE", moz_optimize.optimize) -add_old_configure_assignment("MOZ_CONFIGURE_OPTIMIZE_FLAGS", moz_optimize.flags) +set_config('MOZ_OPTIMIZE', moz_optimize.optimize) +add_old_configure_assignment('MOZ_OPTIMIZE', moz_optimize.optimize) +add_old_configure_assignment('MOZ_CONFIGURE_OPTIMIZE_FLAGS', moz_optimize.flags) # yasm detection # ============================================================== -yasm = check_prog("YASM", ["yasm"], allow_missing=True) +yasm = check_prog('YASM', ['yasm'], allow_missing=True) @depends_if(yasm) -@checking("yasm version") +@checking('yasm version') def yasm_version(yasm): - version = ( - check_cmd_output( - yasm, "--version", onerror=lambda: die("Failed to get yasm version.") - ) - .splitlines()[0] - .split()[1] - ) + version = check_cmd_output( + yasm, '--version', + onerror=lambda: die('Failed to get yasm version.') + ).splitlines()[0].split()[1] return Version(version) @@ -74,199 +71,170 @@ def yasm_version(yasm): def yasm_asflags(yasm, target): if yasm: asflags = { - ("OSX", "x86"): ["-f", "macho32"], - ("OSX", "x86_64"): ["-f", "macho64"], - ("WINNT", "x86"): ["-f", "win32"], - ("WINNT", "x86_64"): ["-f", "x64"], + ('OSX', 'x86'): ['-f', 'macho32'], + ('OSX', 'x86_64'): ['-f', 'macho64'], + ('WINNT', 'x86'): ['-f', 'win32'], + ('WINNT', 'x86_64'): ['-f', 'x64'], }.get((target.os, target.cpu), None) if asflags is None: # We're assuming every x86 platform we support that's # not Windows or Mac is ELF. - if target.cpu == "x86": - asflags = ["-f", "elf32"] - elif target.cpu == "x86_64": - asflags = ["-f", "elf64"] + if target.cpu == 'x86': + asflags = ['-f', 'elf32'] + elif target.cpu == 'x86_64': + asflags = ['-f', 'elf64'] if asflags: - asflags += ["-rnasm", "-pnasm"] + asflags += ['-rnasm', '-pnasm'] return asflags -set_config("YASM_ASFLAGS", yasm_asflags) +set_config('YASM_ASFLAGS', yasm_asflags) # Android NDK # ============================================================== -@depends("--disable-compile-environment", target) +@depends('--disable-compile-environment', target) def compiling_android(compile_env, target): - return compile_env and target.os == "Android" + return compile_env and target.os == 'Android' -include("android-ndk.configure", when=compiling_android) +include('android-ndk.configure', when=compiling_android) with only_when(target_is_osx): # MacOS deployment target version # ============================================================== # This needs to happen before any compilation test is done. - option( - "--enable-macos-target", - env="MACOSX_DEPLOYMENT_TARGET", - nargs=1, - default="10.9", - help="Set the minimum MacOS version needed at runtime", - ) + option('--enable-macos-target', env='MACOSX_DEPLOYMENT_TARGET', nargs=1, + default='10.9', help='Set the minimum MacOS version needed at runtime') + - @depends("--enable-macos-target") - @imports(_from="os", _import="environ") + @depends('--enable-macos-target') + @imports(_from='os', _import='environ') def macos_target(value): if value: # Ensure every compiler process we spawn uses this value. - environ["MACOSX_DEPLOYMENT_TARGET"] = value[0] + environ['MACOSX_DEPLOYMENT_TARGET'] = value[0] return value[0] - set_config("MACOSX_DEPLOYMENT_TARGET", macos_target) - add_old_configure_assignment("MACOSX_DEPLOYMENT_TARGET", macos_target) + + set_config('MACOSX_DEPLOYMENT_TARGET', macos_target) + add_old_configure_assignment('MACOSX_DEPLOYMENT_TARGET', macos_target) @depends(host) def host_is_osx(host): - if host.os == "OSX": + if host.os == 'OSX': return True with only_when(host_is_osx | target_is_osx): # MacOS SDK # ========= - option( - "--with-macos-sdk", - env="MACOS_SDK_DIR", - nargs=1, - help="Location of platform SDK to use", - ) + option('--with-macos-sdk', env='MACOS_SDK_DIR', nargs=1, + help='Location of platform SDK to use') - @depends("--with-macos-sdk", host) - @imports(_from="os.path", _import="isdir") - @imports(_from="biplist", _import="readPlist") + @depends('--with-macos-sdk', host) + @imports(_from='os.path', _import='isdir') + @imports(_from='biplist', _import='readPlist') def macos_sdk(sdk, host): - sdk_min_version = Version("10.11") - sdk_max_version = Version("11.0") + sdk_min_version = Version('10.11') + sdk_max_version = Version('11.0') if sdk: sdk = sdk[0] - elif host.os == "OSX": - sdk = check_cmd_output( - "xcrun", "--show-sdk-path", onerror=lambda: "" - ).rstrip() + elif host.os == 'OSX': + sdk = check_cmd_output('xcrun', '--show-sdk-path', onerror=lambda: '').rstrip() if not sdk: - die( - "Could not find the macOS SDK. Please use --with-macos-sdk to give " - "the path to a macOS SDK." - ) + die('Could not find the macOS SDK. Please use --with-macos-sdk to give ' + 'the path to a macOS SDK.') else: - die( - "Need a macOS SDK when targeting macOS. Please use --with-macos-sdk " - "to give the path to a macOS SDK." - ) + die('Need a macOS SDK when targeting macOS. Please use --with-macos-sdk ' + 'to give the path to a macOS SDK.') if not isdir(sdk): - die( - "SDK not found in %s. When using --with-macos-sdk, you must specify a " - "valid SDK. SDKs are installed when the optional cross-development " - "tools are selected during the Xcode/Developer Tools installation." - % sdk - ) - obj = readPlist(os.path.join(sdk, "SDKSettings.plist")) + die('SDK not found in %s. When using --with-macos-sdk, you must specify a ' + 'valid SDK. SDKs are installed when the optional cross-development ' + 'tools are selected during the Xcode/Developer Tools installation.' + % sdk) + obj = readPlist(os.path.join(sdk, 'SDKSettings.plist')) if not obj: - die("Error parsing SDKSettings.plist in the SDK directory: %s" % sdk) - if "Version" not in obj: - die( - "Error finding Version information in SDKSettings.plist from the SDK: %s" - % sdk - ) - version = Version(obj["Version"]) + die('Error parsing SDKSettings.plist in the SDK directory: %s' % sdk) + if 'Version' not in obj: + die('Error finding Version information in SDKSettings.plist from the SDK: %s' % sdk) + version = Version(obj['Version']) if version < sdk_min_version: - die( - 'SDK version "%s" is too old. Please upgrade to at least %s. ' - "You may need to point to it using --with-macos-sdk= in your " - "mozconfig." % (version, sdk_min_version) - ) + die('SDK version "%s" is too old. Please upgrade to at least %s. ' + 'You may need to point to it using --with-macos-sdk= in your ' + 'mozconfig.' % (version, sdk_min_version)) if version > sdk_max_version: - die( - 'SDK version "%s" is unsupported. Please downgrade to version ' - "%s. You may need to point to it using --with-macos-sdk= in " - "your mozconfig." % (version, sdk_max_version) - ) + die('SDK version "%s" is unsupported. Please downgrade to version ' + '%s. You may need to point to it using --with-macos-sdk= in ' + 'your mozconfig.' % (version, sdk_max_version)) return sdk - set_config("MACOS_SDK_DIR", macos_sdk) + set_config('MACOS_SDK_DIR', macos_sdk) with only_when(target_is_osx): with only_when(cross_compiling): - option( - "--with-macos-private-frameworks", - env="MACOS_PRIVATE_FRAMEWORKS_DIR", - nargs=1, - help="Location of private frameworks to use", - ) + option('--with-macos-private-frameworks', + env="MACOS_PRIVATE_FRAMEWORKS_DIR", nargs=1, + help='Location of private frameworks to use') - @depends_if("--with-macos-private-frameworks") - @imports(_from="os.path", _import="isdir") + @depends_if('--with-macos-private-frameworks') + @imports(_from='os.path', _import='isdir') def macos_private_frameworks(value): if value and not isdir(value[0]): - die( - "PrivateFrameworks not found not found in %s. When using " - "--with-macos-private-frameworks, you must specify a valid " - "directory", - value[0], - ) + die('PrivateFrameworks not found not found in %s. When using ' + '--with-macos-private-frameworks, you must specify a valid ' + 'directory', value[0]) return value[0] @depends(macos_private_frameworks) def macos_private_frameworks(value): if value: return value - return "/System/Library/PrivateFrameworks" + return '/System/Library/PrivateFrameworks' - set_config("MACOS_PRIVATE_FRAMEWORKS_DIR", macos_private_frameworks) + set_config('MACOS_PRIVATE_FRAMEWORKS_DIR', macos_private_frameworks) # Compiler wrappers # ============================================================== -option( - "--with-compiler-wrapper", - env="COMPILER_WRAPPER", - nargs=1, - help="Enable compiling with wrappers such as distcc and ccache", -) +option('--with-compiler-wrapper', env='COMPILER_WRAPPER', nargs=1, + help='Enable compiling with wrappers such as distcc and ccache') -option("--with-ccache", env="CCACHE", nargs="?", help="Enable compiling with ccache") +option('--with-ccache', env='CCACHE', nargs='?', + help='Enable compiling with ccache') -@depends_if("--with-ccache") +@depends_if('--with-ccache') def ccache(value): if len(value): return value # If --with-ccache was given without an explicit value, we default to # 'ccache'. - return "ccache" + return 'ccache' -ccache = check_prog("CCACHE", progs=(), input=ccache) +ccache = check_prog('CCACHE', progs=(), input=ccache) -option(env="CCACHE_PREFIX", nargs=1, help="Compiler prefix to use when using ccache") +option(env='CCACHE_PREFIX', + nargs=1, + help='Compiler prefix to use when using ccache') -ccache_prefix = depends_if("CCACHE_PREFIX")(lambda prefix: prefix[0]) -set_config("CCACHE_PREFIX", ccache_prefix) +ccache_prefix = depends_if('CCACHE_PREFIX')(lambda prefix: prefix[0]) +set_config('CCACHE_PREFIX', ccache_prefix) # Distinguish ccache from sccache. @depends_if(ccache) def ccache_is_sccache(ccache): - return check_cmd_output(ccache, "--version").startswith("sccache") + return check_cmd_output(ccache, '--version').startswith('sccache') @depends(ccache, ccache_is_sccache) @@ -278,70 +246,59 @@ def using_ccache(ccache, ccache_is_sccache): def using_sccache(ccache, ccache_is_sccache): return ccache and ccache_is_sccache +option(env='RUSTC_WRAPPER', nargs=1, + help='Wrap rust compilation with given tool') -option(env="RUSTC_WRAPPER", nargs=1, help="Wrap rust compilation with given tool") - - -@depends(ccache, ccache_is_sccache, "RUSTC_WRAPPER") -@imports(_from="textwrap", _import="dedent") -@imports("os") +@depends(ccache, ccache_is_sccache, 'RUSTC_WRAPPER') +@imports(_from='textwrap', _import='dedent') +@imports('os') def check_sccache_version(ccache, ccache_is_sccache, rustc_wrapper): - sccache_min_version = Version("0.2.13") + sccache_min_version = Version('0.2.13') def check_version(path): - out = check_cmd_output(path, "--version") + out = check_cmd_output(path, '--version') version = Version(out.rstrip().split()[-1]) if version < sccache_min_version: - die( - dedent( - """\ + die(dedent('''\ sccache %s or later is required. sccache in use at %s has version %s. Please upgrade or acquire a new version with |./mach bootstrap|. - """ - ), - sccache_min_version, - path, - version, - ) + '''), sccache_min_version, path, version) if ccache and ccache_is_sccache: check_version(ccache) - if rustc_wrapper and ( - os.path.splitext(os.path.basename(rustc_wrapper[0]))[0].lower() == "sccache" - ): + if (rustc_wrapper and + (os.path.splitext(os.path.basename(rustc_wrapper[0]))[0].lower() == + 'sccache')): check_version(rustc_wrapper[0]) +set_config('MOZ_USING_CCACHE', using_ccache) +set_config('MOZ_USING_SCCACHE', using_sccache) -set_config("MOZ_USING_CCACHE", using_ccache) -set_config("MOZ_USING_SCCACHE", using_sccache) +option(env='SCCACHE_VERBOSE_STATS', + help='Print verbose sccache stats after build') -option(env="SCCACHE_VERBOSE_STATS", help="Print verbose sccache stats after build") - -@depends(using_sccache, "SCCACHE_VERBOSE_STATS") +@depends(using_sccache, 'SCCACHE_VERBOSE_STATS') def sccache_verbose_stats(using_sccache, verbose_stats): return using_sccache and bool(verbose_stats) -set_config("SCCACHE_VERBOSE_STATS", sccache_verbose_stats) +set_config('SCCACHE_VERBOSE_STATS', sccache_verbose_stats) -@depends("--with-compiler-wrapper", ccache) -@imports(_from="mozbuild.shellutil", _import="split", _as="shell_split") +@depends('--with-compiler-wrapper', ccache) +@imports(_from='mozbuild.shellutil', _import='split', _as='shell_split') def compiler_wrapper(wrapper, ccache): if wrapper: raw_wrapper = wrapper[0] wrapper = shell_split(raw_wrapper) wrapper_program = find_program(wrapper[0]) if not wrapper_program: - die( - "Cannot find `%s` from the given compiler wrapper `%s`", - wrapper[0], - raw_wrapper, - ) + die('Cannot find `%s` from the given compiler wrapper `%s`', + wrapper[0], raw_wrapper) wrapper[0] = wrapper_program if ccache: @@ -358,39 +315,35 @@ def using_compiler_wrapper(compiler_wrapper): return True -set_config("MOZ_USING_COMPILER_WRAPPER", using_compiler_wrapper) +set_config('MOZ_USING_COMPILER_WRAPPER', using_compiler_wrapper) # GC rooting and hazard analysis. # ============================================================== -option(env="MOZ_HAZARD", help="Build for the GC rooting hazard analysis") +option(env='MOZ_HAZARD', help='Build for the GC rooting hazard analysis') -@depends("MOZ_HAZARD") +@depends('MOZ_HAZARD') def hazard_analysis(value): if value: return True -set_config("MOZ_HAZARD", hazard_analysis) +set_config('MOZ_HAZARD', hazard_analysis) # Cross-compilation related things. # ============================================================== -option( - "--with-toolchain-prefix", - env="TOOLCHAIN_PREFIX", - nargs=1, - help="Prefix for the target toolchain", -) +option('--with-toolchain-prefix', env='TOOLCHAIN_PREFIX', nargs=1, + help='Prefix for the target toolchain') -@depends("--with-toolchain-prefix", target, cross_compiling) +@depends('--with-toolchain-prefix', target, cross_compiling) def toolchain_prefix(value, target, cross_compiling): if value: return tuple(value) if cross_compiling: - return ("%s-" % target.toolchain, "%s-" % target.alias) + return ('%s-' % target.toolchain, '%s-' % target.alias) @depends(toolchain_prefix, target) @@ -398,34 +351,35 @@ def first_toolchain_prefix(toolchain_prefix, target): # Pass TOOLCHAIN_PREFIX down to the build system if it was given from the # command line/environment (in which case there's only one value in the tuple), # or when cross-compiling for Android or OSX. - if toolchain_prefix and ( - target.os in ("Android", "OSX") or len(toolchain_prefix) == 1 - ): + if toolchain_prefix and (target.os in ('Android', 'OSX') or len(toolchain_prefix) == 1): return toolchain_prefix[0] -set_config("TOOLCHAIN_PREFIX", first_toolchain_prefix) -add_old_configure_assignment("TOOLCHAIN_PREFIX", first_toolchain_prefix) +set_config('TOOLCHAIN_PREFIX', first_toolchain_prefix) +add_old_configure_assignment('TOOLCHAIN_PREFIX', first_toolchain_prefix) # Compilers # ============================================================== -include("compilers-util.configure") +include('compilers-util.configure') def try_preprocess(compiler, language, source, onerror=None): - return try_invoke_compiler(compiler, language, source, ["-E"], onerror) - - -@imports(_from="mozbuild.configure.constants", _import="CompilerType") -@imports(_from="mozbuild.configure.constants", _import="CPU_preprocessor_checks") -@imports(_from="mozbuild.configure.constants", _import="kernel_preprocessor_checks") -@imports(_from="mozbuild.configure.constants", _import="OS_preprocessor_checks") -@imports(_from="six", _import="iteritems") -@imports(_from="textwrap", _import="dedent") -@imports(_from="__builtin__", _import="Exception") + return try_invoke_compiler(compiler, language, source, ['-E'], onerror) + + +@imports(_from='mozbuild.configure.constants', _import='CompilerType') +@imports(_from='mozbuild.configure.constants', + _import='CPU_preprocessor_checks') +@imports(_from='mozbuild.configure.constants', + _import='kernel_preprocessor_checks') +@imports(_from='mozbuild.configure.constants', + _import='OS_preprocessor_checks') +@imports(_from='six', _import='iteritems') +@imports(_from='textwrap', _import='dedent') +@imports(_from='__builtin__', _import='Exception') def get_compiler_info(compiler, language): - """Returns information about the given `compiler` (command line in the + '''Returns information about the given `compiler` (command line in the form of a list or tuple), in the given `language`. The returned information includes: @@ -433,7 +387,7 @@ def get_compiler_info(compiler, language): - the compiler version - the compiler supported language - the compiler supported language version - """ + ''' # Note: We'd normally do a version check for clang, but versions of clang # in Xcode have a completely different versioning scheme despite exposing # the version with the same defines. @@ -442,8 +396,7 @@ def get_compiler_info(compiler, language): # We then only include the version information when the compiler matches # the feature check, so that an unsupported version of clang would have # no version number. - check = dedent( - """\ + check = dedent('''\ #if defined(_MSC_VER) && defined(__clang__) && defined(_MT) %COMPILER "clang-cl" %VERSION __clang_major__.__clang_minor__.__clang_patchlevel__ @@ -462,94 +415,91 @@ def get_compiler_info(compiler, language): #elif __STDC_VERSION__ %STDC_VERSION __STDC_VERSION__ #endif - """ - ) + ''') # While we're doing some preprocessing, we might as well do some more # preprocessor-based tests at the same time, to check the toolchain # matches what we want. for name, preprocessor_checks in ( - ("CPU", CPU_preprocessor_checks), - ("KERNEL", kernel_preprocessor_checks), - ("OS", OS_preprocessor_checks), + ('CPU', CPU_preprocessor_checks), + ('KERNEL', kernel_preprocessor_checks), + ('OS', OS_preprocessor_checks), ): for n, (value, condition) in enumerate(iteritems(preprocessor_checks)): - check += dedent( - """\ + check += dedent('''\ #%(if)s %(condition)s %%%(name)s "%(value)s" - """ - % { - "if": "elif" if n else "if", - "condition": condition, - "name": name, - "value": value, - } - ) - check += "#endif\n" + ''' % { + 'if': 'elif' if n else 'if', + 'condition': condition, + 'name': name, + 'value': value, + }) + check += '#endif\n' # Also check for endianness. The advantage of living in modern times is # that all the modern compilers we support now have __BYTE_ORDER__ defined # by the preprocessor. - check += dedent( - """\ + check += dedent('''\ #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ %ENDIANNESS "little" #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ %ENDIANNESS "big" #endif - """ - ) + ''') result = try_preprocess(compiler, language, check) if not result: - raise FatalCheckError("Unknown compiler or compiler not supported.") + raise FatalCheckError( + 'Unknown compiler or compiler not supported.') # Metadata emitted by preprocessors such as GCC with LANG=ja_JP.utf-8 may # have non-ASCII characters. Treat the output as bytearray. data = {} for line in result.splitlines(): - if line.startswith("%"): - k, _, v = line.partition(" ") - k = k.lstrip("%") - data[k] = v.replace(" ", "").lstrip('"').rstrip('"') - log.debug("%s = %s", k, data[k]) + if line.startswith('%'): + k, _, v = line.partition(' ') + k = k.lstrip('%') + data[k] = v.replace(' ', '').lstrip('"').rstrip('"') + log.debug('%s = %s', k, data[k]) try: - type = CompilerType(data["COMPILER"]) + type = CompilerType(data['COMPILER']) except Exception: - raise FatalCheckError("Unknown compiler or compiler not supported.") + raise FatalCheckError( + 'Unknown compiler or compiler not supported.') - cplusplus = int(data.get("cplusplus", "0L").rstrip("L")) - stdc_version = int(data.get("STDC_VERSION", "0L").rstrip("L")) + cplusplus = int(data.get('cplusplus', '0L').rstrip('L')) + stdc_version = int(data.get('STDC_VERSION', '0L').rstrip('L')) - version = data.get("VERSION") + version = data.get('VERSION') if version: version = Version(version) return namespace( type=type, version=version, - cpu=data.get("CPU"), - kernel=data.get("KERNEL"), - endianness=data.get("ENDIANNESS"), - os=data.get("OS"), - language="C++" if cplusplus else "C", + cpu=data.get('CPU'), + kernel=data.get('KERNEL'), + endianness=data.get('ENDIANNESS'), + os=data.get('OS'), + language='C++' if cplusplus else 'C', language_version=cplusplus if cplusplus else stdc_version, ) def same_arch_different_bits(): return ( - ("x86", "x86_64"), - ("ppc", "ppc64"), - ("sparc", "sparc64"), + ('x86', 'x86_64'), + ('ppc', 'ppc64'), + ('sparc', 'sparc64'), ) -@imports(_from="mozbuild.shellutil", _import="quote") -@imports(_from="mozbuild.configure.constants", _import="OS_preprocessor_checks") +@imports(_from='mozbuild.shellutil', _import='quote') +@imports(_from='mozbuild.configure.constants', + _import='OS_preprocessor_checks') def check_compiler(compiler, language, target): info = get_compiler_info(compiler, language) @@ -559,72 +509,66 @@ def check_compiler(compiler, language, target): # -------------------------------------------------------------------- if language != info.language: raise FatalCheckError( - "`%s` is not a %s compiler." % (quote(*compiler), language) - ) + '`%s` is not a %s compiler.' % (quote(*compiler), language)) # Note: We do a strict version check because there sometimes are backwards # incompatible changes in the standard, and not all code that compiles as # C99 compiles as e.g. C11 (as of writing, this is true of libnestegg, for # example) - if info.language == "C" and info.language_version != 199901: - if info.type == "clang-cl": - flags.append("-Xclang") - flags.append("-std=gnu99") + if info.language == 'C' and info.language_version != 199901: + if info.type == 'clang-cl': + flags.append('-Xclang') + flags.append('-std=gnu99') cxx17_version = 201703 - if info.language == "C++": + if info.language == 'C++': if info.language_version != cxx17_version: # MSVC headers include C++17 features, but don't guard them # with appropriate checks. - if info.type == "clang-cl": - flags.append("-Xclang") - flags.append("-std=c++17") + if info.type == 'clang-cl': + flags.append('-Xclang') + flags.append('-std=c++17') else: - flags.append("-std=gnu++17") + flags.append('-std=gnu++17') # Check compiler target # -------------------------------------------------------------------- has_target = False - if info.type == "clang": + if info.type == 'clang': # Add the target explicitly when the target is aarch64 macosx, because # the clang target is named differently, and we need to work around # https://github.com/rust-lang/rust-bindgen/issues/1871 and # https://github.com/alexcrichton/cc-rs/issues/542 so we always want # the target on the command line, even if the compiler would default to # that. - if target.os == "OSX" and target.cpu == "aarch64": - if "--target=arm64-apple-darwin" not in compiler: - flags.append("--target=arm64-apple-darwin") + if target.os == 'OSX' and target.cpu == 'aarch64': + if '--target=arm64-apple-darwin' not in compiler: + flags.append('--target=arm64-apple-darwin') has_target = True - elif ( - not info.kernel - or info.kernel != target.kernel - or not info.endianness - or info.endianness != target.endianness - ): - flags.append("--target=%s" % target.toolchain) + elif not info.kernel or info.kernel != target.kernel or \ + not info.endianness or info.endianness != target.endianness: + flags.append('--target=%s' % target.toolchain) has_target = True # Add target flag when there is an OS mismatch (e.g. building for Android on # Linux). However, only do this if the target OS is in our whitelist, to # keep things the same on other platforms. elif target.os in OS_preprocessor_checks and ( - not info.os or info.os != target.os - ): - flags.append("--target=%s" % target.toolchain) + not info.os or info.os != target.os): + flags.append('--target=%s' % target.toolchain) has_target = True if not has_target and (not info.cpu or info.cpu != target.cpu): same_arch = same_arch_different_bits() if (target.cpu, info.cpu) in same_arch: - flags.append("-m32") + flags.append('-m32') elif (info.cpu, target.cpu) in same_arch: - flags.append("-m64") - elif info.type == "clang-cl" and target.cpu == "aarch64": - flags.append("--target=%s" % target.toolchain) - elif info.type == "clang": - flags.append("--target=%s" % target.toolchain) + flags.append('-m64') + elif info.type == 'clang-cl' and target.cpu == 'aarch64': + flags.append('--target=%s' % target.toolchain) + elif info.type == 'clang': + flags.append('--target=%s' % target.toolchain) return namespace( type=info.type, @@ -637,133 +581,102 @@ def check_compiler(compiler, language, target): ) -@imports(_from="__builtin__", _import="open") -@imports("json") -@imports("os") +@imports(_from='__builtin__', _import='open') +@imports('json') +@imports('os') def get_vc_paths(topsrcdir): def vswhere(args): - program_files = os.environ.get("PROGRAMFILES(X86)") or os.environ.get( - "PROGRAMFILES" - ) + program_files = (os.environ.get('PROGRAMFILES(X86)') or + os.environ.get('PROGRAMFILES')) if not program_files: return [] - vswhere = os.path.join( - program_files, "Microsoft Visual Studio", "Installer", "vswhere.exe" - ) + vswhere = os.path.join(program_files, 'Microsoft Visual Studio', + 'Installer', 'vswhere.exe') if not os.path.exists(vswhere): return [] - return json.loads(check_cmd_output(vswhere, "-format", "json", *args)) - - for install in vswhere( - [ - "-products", - "*", - "-requires", - "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", - ] - ): - path = install["installationPath"] - tools_version = ( - open( - os.path.join( - path, r"VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt" - ), - "r", - ) - .read() - .strip() - ) - tools_path = os.path.join(path, r"VC\Tools\MSVC", tools_version) - yield (Version(install["installationVersion"]), tools_path) + return json.loads(check_cmd_output(vswhere, '-format', 'json', *args)) + + for install in vswhere(['-products', '*', '-requires', 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64']): + path = install['installationPath'] + tools_version = open(os.path.join( + path, r'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt'), 'r').read().strip() + tools_path = os.path.join( + path, r'VC\Tools\MSVC', tools_version) + yield (Version(install['installationVersion']), tools_path) @depends(host) def host_is_windows(host): - if host.kernel == "WINNT": + if host.kernel == 'WINNT': return True -option( - "--with-visual-studio-version", - nargs=1, - choices=("2017",), - when=host_is_windows, - help="Select a specific Visual Studio version to use", -) +option('--with-visual-studio-version', nargs=1, + choices=('2017',), when=host_is_windows, + help='Select a specific Visual Studio version to use') -@depends("--with-visual-studio-version", when=host_is_windows) +@depends('--with-visual-studio-version', when=host_is_windows) def vs_major_version(value): if value: - return {"2017": 15}[value[0]] - - -option( - env="VC_PATH", - nargs=1, - when=host_is_windows, - help="Path to the Microsoft Visual C/C++ compiler", -) - - -@depends( - host, - vs_major_version, - check_build_environment, - "VC_PATH", - "--with-visual-studio-version", - when=host_is_windows, -) -@imports(_from="__builtin__", _import="sorted") -@imports(_from="operator", _import="itemgetter") -def vc_compiler_paths_for_version( - host, vs_major_version, env, vc_path, vs_release_name -): + return {'2017': 15}[value[0]] + + +option(env='VC_PATH', nargs=1, when=host_is_windows, + help='Path to the Microsoft Visual C/C++ compiler') + + +@depends(host, vs_major_version, check_build_environment, 'VC_PATH', + '--with-visual-studio-version', when=host_is_windows) +@imports(_from='__builtin__', _import='sorted') +@imports(_from='operator', _import='itemgetter') +def vc_compiler_paths_for_version(host, vs_major_version, env, vc_path, vs_release_name): if vc_path and vs_release_name: - die("VC_PATH and --with-visual-studio-version cannot be used together.") + die('VC_PATH and --with-visual-studio-version cannot be used together.') if vc_path: # Use an arbitrary version, it doesn't matter. - all_versions = [(Version("15"), vc_path[0])] + all_versions = [(Version('15'), vc_path[0])] else: all_versions = sorted(get_vc_paths(env.topsrcdir), key=itemgetter(0)) if not all_versions: return if vs_major_version: - versions = [d for (v, d) in all_versions if v.major == vs_major_version] + versions = [d for (v, d) in all_versions if v.major == + vs_major_version] if not versions: - die("Visual Studio %s could not be found!" % vs_release_name) + die('Visual Studio %s could not be found!' % vs_release_name) path = versions[0] else: # Choose the newest version. path = all_versions[-1][1] host_dir = { - "x86_64": "HostX64", - "x86": "HostX86", + 'x86_64': 'HostX64', + 'x86': 'HostX86', }.get(host.cpu) if host_dir: - path = os.path.join(path, "bin", host_dir) + path = os.path.join(path, 'bin', host_dir) return { - "x64": [os.path.join(path, "x64")], + 'x64': [os.path.join(path, 'x64')], # The cross toolchains require DLLs from the native x64 toolchain. - "x86": [os.path.join(path, "x86"), os.path.join(path, "x64")], - "arm64": [os.path.join(path, "arm64"), os.path.join(path, "x64")], + 'x86': [os.path.join(path, 'x86'), os.path.join(path, 'x64')], + 'arm64': [os.path.join(path, 'arm64'), os.path.join(path, 'x64')], } @template def vc_compiler_path_for(host_or_target): - @depends(host_or_target, vc_compiler_paths_for_version, when=host_is_windows) + @depends(host_or_target, vc_compiler_paths_for_version, + when=host_is_windows) def vc_compiler_path(target, paths): vc_target = { - "x86": "x86", - "x86_64": "x64", - "arm": "arm", - "aarch64": "arm64", + 'x86': 'x86', + 'x86_64': 'x64', + 'arm': 'arm', + 'aarch64': 'arm64' }.get(target.cpu) if not paths: return return paths.get(vc_target) - return vc_compiler_path @@ -772,42 +685,32 @@ host_vc_compiler_path = vc_compiler_path_for(host) @dependable -@imports("os") -@imports(_from="os", _import="environ") +@imports('os') +@imports(_from='os', _import='environ') def original_path(): - return environ["PATH"].split(os.pathsep) + return environ['PATH'].split(os.pathsep) @template def toolchain_search_path_for(host_or_target): arch_alias, vc_path = { - host: ("host", host_vc_compiler_path), - target: ("target", vc_compiler_path), + host: ('host', host_vc_compiler_path), + target: ('target', vc_compiler_path), }[host_or_target] - @depends( - dependable(arch_alias), - vc_path, - original_path, - developer_options, - mozbuild_state_path, - ) - @imports("os") - @imports(_from="os", _import="environ") - def toolchain_search_path( - arch_alias, - vc_compiler_path, - original_path, - developer_options, - mozbuild_state_path, - ): + @depends(dependable(arch_alias), vc_path, original_path, developer_options, + mozbuild_state_path) + @imports('os') + @imports(_from='os', _import='environ') + def toolchain_search_path(arch_alias, vc_compiler_path, original_path, + developer_options, mozbuild_state_path): result = list(original_path) if vc_compiler_path: # The second item, if there is one, is necessary to have in $PATH for # Windows to load the required DLLs from there. if len(vc_compiler_path) > 1: - environ["PATH"] = os.pathsep.join(result + vc_compiler_path[1:]) + environ['PATH'] = os.pathsep.join(result + vc_compiler_path[1:]) # The first item is where the programs are going to be result.append(vc_compiler_path[0]) @@ -815,42 +718,35 @@ def toolchain_search_path_for(host_or_target): # Also add in the location to which `mach bootstrap` or # `mach artifact toolchain` installs clang, cbindgen, etc. bootstrapped = [ - os.path.join(mozbuild_state_path, *rest) - for rest in ( - ["clang", "bin"], - ["cbindgen"], - ["dump_syms"], - ["nasm"], - ["lucetc"], - ) - ] + os.path.join(mozbuild_state_path, *rest) for rest in ( + ['clang', 'bin'], + ['cbindgen'], + ['dump_syms'], + ['nasm'], + ['lucetc'], + )] # Also add the rustup install directory for cargo/rustc. - cargo_home = environ.get("CARGO_HOME", "") + cargo_home = environ.get('CARGO_HOME', '') if cargo_home: cargo_home = os.path.abspath(cargo_home) else: - cargo_home = os.path.expanduser(os.path.join("~", ".cargo")) - rustup_path = os.path.join(cargo_home, "bin") + cargo_home = os.path.expanduser(os.path.join('~', '.cargo')) + rustup_path = os.path.join(cargo_home, 'bin') result.append(rustup_path) if developer_options: - log.debug( - "Prioritizing mozbuild state dir in {} toolchain path because " - "you are not building in release mode.".format(arch_alias) - ) + log.debug('Prioritizing mozbuild state dir in {} toolchain path because ' + 'you are not building in release mode.'.format(arch_alias)) search_path = bootstrapped + result else: - log.debug( - "Prioritizing system over mozbuild state dir in {} " - "toolchain path because you are building in " - "release mode.".format(arch_alias) - ) + log.debug('Prioritizing system over mozbuild state dir in {} ' + 'toolchain path because you are building in ' + 'release mode.'.format(arch_alias)) search_path = result + bootstrapped - log.debug("Search path for {} toolchain: {}".format(arch_alias, search_path)) + log.debug('Search path for {} toolchain: {}'.format(arch_alias, search_path)) return search_path - return toolchain_search_path @@ -861,10 +757,10 @@ host_toolchain_search_path = toolchain_search_path_for(host) # As a workaround until bug 1516228 and bug 1516253 are fixed, set the PATH # variable for the build to contain the toolchain search path. @depends(toolchain_search_path, host_toolchain_search_path) -@imports("os") -@imports(_from="os", _import="environ") +@imports('os') +@imports(_from='os', _import='environ') def altered_path(toolchain_search_path, host_toolchain_search_path): - path = environ["PATH"].split(os.pathsep) + path = environ['PATH'].split(os.pathsep) altered_path = list(toolchain_search_path) for p in host_toolchain_search_path: if p not in altered_path: @@ -875,45 +771,42 @@ def altered_path(toolchain_search_path, host_toolchain_search_path): return os.pathsep.join(altered_path) -set_config("PATH", altered_path) +set_config('PATH', altered_path) @template def default_c_compilers(host_or_target, other_c_compiler=None): - """Template defining the set of default C compilers for the host and + '''Template defining the set of default C compilers for the host and target platforms. `host_or_target` is either `host` or `target` (the @depends functions from init.configure. `other_c_compiler` is the `target` C compiler when `host_or_target` is `host`. - """ + ''' assert host_or_target in {host, target} other_c_compiler = () if other_c_compiler is None else (other_c_compiler,) @depends(host_or_target, target, toolchain_prefix, *other_c_compiler) - def default_c_compilers( - host_or_target, target, toolchain_prefix, *other_c_compiler - ): - if host_or_target.kernel == "WINNT": - supported = types = ("clang-cl", "clang") - elif host_or_target.kernel == "Darwin": - types = ("clang",) - supported = ("clang", "gcc") + def default_c_compilers(host_or_target, target, toolchain_prefix, + *other_c_compiler): + if host_or_target.kernel == 'WINNT': + supported = types = ('clang-cl', 'clang') + elif host_or_target.kernel == 'Darwin': + types = ('clang',) + supported = ('clang', 'gcc') else: - supported = types = ("clang", "gcc") + supported = types = ('clang', 'gcc') info = other_c_compiler[0] if other_c_compiler else None if info and info.type in supported: # When getting default C compilers for the host, we prioritize the # same compiler as the target C compiler. prioritized = info.compiler - if info.type == "gcc": + if info.type == 'gcc': same_arch = same_arch_different_bits() - if ( - target.cpu != host_or_target.cpu - and (target.cpu, host_or_target.cpu) not in same_arch - and (host_or_target.cpu, target.cpu) not in same_arch - ): + if (target.cpu != host_or_target.cpu and + (target.cpu, host_or_target.cpu) not in same_arch and + (host_or_target.cpu, target.cpu) not in same_arch): # If the target C compiler is GCC, and it can't be used with # -m32/-m64 for the host, it's probably toolchain-prefixed, # so we prioritize a raw 'gcc' instead. @@ -921,13 +814,13 @@ def default_c_compilers(host_or_target, other_c_compiler=None): types = [prioritized] + [t for t in types if t != info.type] - gcc = ("gcc",) + gcc = ('gcc',) if toolchain_prefix and host_or_target is target: - gcc = tuple("%sgcc" % p for p in toolchain_prefix) + gcc + gcc = tuple('%sgcc' % p for p in toolchain_prefix) + gcc result = [] for type in types: - if type == "gcc": + if type == 'gcc': result.extend(gcc) else: result.append(type) @@ -939,7 +832,7 @@ def default_c_compilers(host_or_target, other_c_compiler=None): @template def default_cxx_compilers(c_compiler, other_c_compiler=None, other_cxx_compiler=None): - """Template defining the set of default C++ compilers for the host and + '''Template defining the set of default C++ compilers for the host and target platforms. `c_compiler` is the @depends function returning a Compiler instance for the desired platform. @@ -951,7 +844,7 @@ def default_cxx_compilers(c_compiler, other_c_compiler=None, other_cxx_compiler= We also factor in the target C++ compiler when getting the default host C++ compiler, using the target C++ compiler if the host and target C compilers are the same. - """ + ''' assert (other_c_compiler is None) == (other_cxx_compiler is None) if other_c_compiler is not None: @@ -969,11 +862,11 @@ def default_cxx_compilers(c_compiler, other_c_compiler=None, other_cxx_compiler= dir = os.path.dirname(c_compiler.compiler) file = os.path.basename(c_compiler.compiler) - if c_compiler.type == "gcc": - return (os.path.join(dir, file.replace("gcc", "g++")),) + if c_compiler.type == 'gcc': + return (os.path.join(dir, file.replace('gcc', 'g++')),) - if c_compiler.type == "clang": - return (os.path.join(dir, file.replace("clang", "clang++")),) + if c_compiler.type == 'clang': + return (os.path.join(dir, file.replace('clang', 'clang++')),) return (c_compiler.compiler,) @@ -982,13 +875,13 @@ def default_cxx_compilers(c_compiler, other_c_compiler=None, other_cxx_compiler= @template def provided_program(env_var, when=None): - """Template handling cases where a program can be specified either as a + '''Template handling cases where a program can be specified either as a path or as a path with applicable arguments. - """ + ''' @depends_if(env_var, when=when) - @imports(_from="itertools", _import="takewhile") - @imports(_from="mozbuild.shellutil", _import="split", _as="shell_split") + @imports(_from='itertools', _import='takewhile') + @imports(_from='mozbuild.shellutil', _import='split', _as='shell_split') def provided(cmd): # Assume the first dash-prefixed item (and any subsequent items) are # command-line options, the item before the dash-prefixed item is @@ -996,36 +889,31 @@ def provided_program(env_var, when=None): # of some kind (e.g. sccache). cmd = shell_split(cmd[0]) - without_flags = list(takewhile(lambda x: not x.startswith("-"), cmd)) + without_flags = list(takewhile(lambda x: not x.startswith('-'), cmd)) return namespace( wrapper=without_flags[:-1], program=without_flags[-1], - flags=cmd[len(without_flags) :], + flags=cmd[len(without_flags):], ) return provided def prepare_flags(host_or_target, macos_sdk): - if macos_sdk and host_or_target.os == "OSX": - return ["-isysroot", macos_sdk] + if macos_sdk and host_or_target.os == 'OSX': + return ['-isysroot', macos_sdk] return [] def minimum_gcc_version(): - return Version("7.1.0") + return Version('7.1.0') @template -def compiler( - language, - host_or_target, - c_compiler=None, - other_compiler=None, - other_c_compiler=None, -): - """Template handling the generic base checks for the compiler for the +def compiler(language, host_or_target, c_compiler=None, other_compiler=None, + other_c_compiler=None): + '''Template handling the generic base checks for the compiler for the given `language` on the given platform (`host_or_target`). `host_or_target` is either `host` or `target` (the @depends functions from init.configure. @@ -1036,35 +924,34 @@ def compiler( When `host_or_target` is `host` and the language is 'C++', `other_c_compiler` is the result of the `compiler` template for the language 'C' for `target`. - """ + ''' assert host_or_target in {host, target} - assert language in ("C", "C++") - assert language == "C" or c_compiler is not None + assert language in ('C', 'C++') + assert language == 'C' or c_compiler is not None assert host_or_target is target or other_compiler is not None - assert language == "C" or host_or_target is target or other_c_compiler is not None + assert language == 'C' or host_or_target is target or \ + other_c_compiler is not None host_or_target_str = { - host: "host", - target: "target", + host: 'host', + target: 'target', }[host_or_target] var = { - ("C", target): "CC", - ("C++", target): "CXX", - ("C", host): "HOST_CC", - ("C++", host): "HOST_CXX", + ('C', target): 'CC', + ('C++', target): 'CXX', + ('C', host): 'HOST_CC', + ('C++', host): 'HOST_CXX', }[language, host_or_target] default_compilers = { - "C": lambda: default_c_compilers(host_or_target, other_compiler), - "C++": lambda: default_cxx_compilers( - c_compiler, other_c_compiler, other_compiler - ), + 'C': lambda: default_c_compilers(host_or_target, other_compiler), + 'C++': lambda: default_cxx_compilers(c_compiler, other_c_compiler, other_compiler), }[language]() - what = "the %s %s compiler" % (host_or_target_str, language) + what = 'the %s %s compiler' % (host_or_target_str, language) - option(env=var, nargs=1, help="Path to %s" % what) + option(env=var, nargs=1, help='Path to %s' % what) # Handle the compiler given by the user through one of the CC/CXX/HOST_CC/ # HOST_CXX variables. @@ -1079,20 +966,15 @@ def compiler( # old-configure complicates things, and for now, we a) can't take the plain # result from check_prog as CC/CXX/HOST_CC/HOST_CXX and b) have to let # old-configure AC_SUBST it (because it's autoconf doing it, not us) - compiler = check_prog( - "_%s" % var, - what=what, - progs=default_compilers, - input=provided_compiler.program, - paths=search_path, - ) + compiler = check_prog('_%s' % var, what=what, progs=default_compilers, + input=provided_compiler.program, + paths=search_path) @depends(compiler, provided_compiler, compiler_wrapper, host_or_target, macos_sdk) - @checking("whether %s can be used" % what, lambda x: bool(x)) - @imports(_from="mozbuild.shellutil", _import="quote") - def valid_compiler( - compiler, provided_compiler, compiler_wrapper, host_or_target, macos_sdk - ): + @checking('whether %s can be used' % what, lambda x: bool(x)) + @imports(_from='mozbuild.shellutil', _import='quote') + def valid_compiler(compiler, provided_compiler, compiler_wrapper, + host_or_target, macos_sdk): wrapper = list(compiler_wrapper or ()) flags = prepare_flags(host_or_target, macos_sdk) if provided_compiler: @@ -1100,12 +982,13 @@ def compiler( # When doing a subconfigure, the compiler is set by old-configure # and it contains the wrappers from --with-compiler-wrapper and # --with-ccache. - if provided_wrapper[: len(wrapper)] == wrapper: - provided_wrapper = provided_wrapper[len(wrapper) :] + if provided_wrapper[:len(wrapper)] == wrapper: + provided_wrapper = provided_wrapper[len(wrapper):] wrapper.extend(provided_wrapper) flags.extend(provided_compiler.flags) - info = check_compiler(wrapper + [compiler] + flags, language, host_or_target) + info = check_compiler(wrapper + [compiler] + flags, language, + host_or_target) # Check that the additional flags we got are enough to not require any # more flags. If we get an exception, just ignore it; it's liable to be @@ -1115,83 +998,65 @@ def compiler( try: if info.flags: flags += info.flags - info = check_compiler( - wrapper + [compiler] + flags, language, host_or_target - ) + info = check_compiler(wrapper + [compiler] + flags, language, + host_or_target) except FatalCheckError: pass if not info.target_cpu or info.target_cpu != host_or_target.cpu: raise FatalCheckError( - "%s %s compiler target CPU (%s) does not match --%s CPU (%s)" - % ( - host_or_target_str.capitalize(), - language, - info.target_cpu or "unknown", - host_or_target_str, - host_or_target.raw_cpu, - ) - ) + '%s %s compiler target CPU (%s) does not match --%s CPU (%s)' + % (host_or_target_str.capitalize(), language, + info.target_cpu or 'unknown', host_or_target_str, + host_or_target.raw_cpu)) - if not info.target_kernel or (info.target_kernel != host_or_target.kernel): + if not info.target_kernel or (info.target_kernel != + host_or_target.kernel): raise FatalCheckError( - "%s %s compiler target kernel (%s) does not match --%s kernel (%s)" - % ( - host_or_target_str.capitalize(), - language, - info.target_kernel or "unknown", - host_or_target_str, - host_or_target.kernel, - ) - ) + '%s %s compiler target kernel (%s) does not match --%s kernel (%s)' + % (host_or_target_str.capitalize(), language, + info.target_kernel or 'unknown', host_or_target_str, + host_or_target.kernel)) - if not info.target_endianness or ( - info.target_endianness != host_or_target.endianness - ): + if not info.target_endianness or (info.target_endianness != + host_or_target.endianness): raise FatalCheckError( - "%s %s compiler target endianness (%s) does not match --%s " - "endianness (%s)" - % ( - host_or_target_str.capitalize(), - language, - info.target_endianness or "unknown", - host_or_target_str, - host_or_target.endianness, - ) - ) + '%s %s compiler target endianness (%s) does not match --%s ' + 'endianness (%s)' + % (host_or_target_str.capitalize(), language, + info.target_endianness or 'unknown', host_or_target_str, + host_or_target.endianness)) # Compiler version checks # =================================================== # Check the compiler version here instead of in `compiler_version` so # that the `checking` message doesn't pretend the compiler can be used # to then bail out one line later. - if info.type == "gcc": - if host_or_target.os == "Android": - raise FatalCheckError( - "GCC is not supported on Android.\n" - "Please use clang from the Android NDK instead." - ) + if info.type == 'gcc': + if host_or_target.os == 'Android': + raise FatalCheckError('GCC is not supported on Android.\n' + 'Please use clang from the Android NDK instead.') gcc_version = minimum_gcc_version() if info.version < gcc_version: raise FatalCheckError( - "Only GCC %d.%d or newer is supported (found version %s)." - % (gcc_version.major, gcc_version.minor, info.version) - ) + 'Only GCC %d.%d or newer is supported (found version %s).' + % (gcc_version.major, gcc_version.minor, info.version)) - if info.type == "clang-cl": - if info.version < "8.0.0": + if info.type == 'clang-cl': + if info.version < '8.0.0': raise FatalCheckError( - "Only clang-cl 8.0 or newer is supported (found version %s)" - % info.version - ) + 'Only clang-cl 8.0 or newer is supported (found version %s)' + % info.version) # If you want to bump the version check here search for # diagnose_if above, and see the associated comment. - if info.type == "clang" and not info.version: - raise FatalCheckError("Only clang/llvm 5.0 or newer is supported.") + if info.type == 'clang' and not info.version: + raise FatalCheckError( + 'Only clang/llvm 5.0 or newer is supported.') if info.flags: - raise FatalCheckError("Unknown compiler or compiler not supported.") + raise FatalCheckError( + 'Unknown compiler or compiler not supported.') return namespace( wrapper=wrapper, @@ -1203,87 +1068,69 @@ def compiler( ) @depends(valid_compiler) - @checking("%s version" % what) + @checking('%s version' % what) def compiler_version(compiler): return compiler.version - if language == "C++": - + if language == 'C++': @depends(valid_compiler, c_compiler) def valid_compiler(compiler, c_compiler): if compiler.type != c_compiler.type: - die( - "The %s C compiler is %s, while the %s C++ compiler is " - "%s. Need to use the same compiler suite.", - host_or_target_str, - c_compiler.type, - host_or_target_str, - compiler.type, - ) + die('The %s C compiler is %s, while the %s C++ compiler is ' + '%s. Need to use the same compiler suite.', + host_or_target_str, c_compiler.type, + host_or_target_str, compiler.type) if compiler.version != c_compiler.version: - die( - "The %s C compiler is version %s, while the %s C++ " - "compiler is version %s. Need to use the same compiler " - "version.", - host_or_target_str, - c_compiler.version, - host_or_target_str, - compiler.version, - ) + die('The %s C compiler is version %s, while the %s C++ ' + 'compiler is version %s. Need to use the same compiler ' + 'version.', + host_or_target_str, c_compiler.version, + host_or_target_str, compiler.version) return compiler # Set CC/CXX/HOST_CC/HOST_CXX for old-configure, which needs the wrapper # and the flags that were part of the user input for those variables to # be provided. - add_old_configure_assignment( - var, - depends_if(valid_compiler)( - lambda x: list(x.wrapper) + [x.compiler] + list(x.flags) - ), - ) + add_old_configure_assignment(var, depends_if(valid_compiler)( + lambda x: list(x.wrapper) + [x.compiler] + list(x.flags))) if host_or_target is target: - add_old_configure_assignment( - "ac_cv_prog_%s" % var, - depends_if(valid_compiler)( - lambda x: list(x.wrapper) + [x.compiler] + list(x.flags) - ), - ) + add_old_configure_assignment('ac_cv_prog_%s' % var, depends_if(valid_compiler)( + lambda x: list(x.wrapper) + [x.compiler] + list(x.flags))) # We check that it works in python configure already. - add_old_configure_assignment("ac_cv_prog_%s_works" % var.lower(), "yes") + add_old_configure_assignment('ac_cv_prog_%s_works' % var.lower(), 'yes') add_old_configure_assignment( - "ac_cv_prog_%s_cross" % var.lower(), - depends(cross_compiling)(lambda x: "yes" if x else "no"), - ) - gcc_like = depends(valid_compiler.type)( - lambda x: "yes" if x in ("gcc", "clang") else "no" - ) - add_old_configure_assignment("ac_cv_prog_%s_g" % var.lower(), gcc_like) - if language == "C": - add_old_configure_assignment("ac_cv_prog_gcc", gcc_like) - if language == "C++": - add_old_configure_assignment("ac_cv_prog_gxx", gcc_like) + 'ac_cv_prog_%s_cross' % var.lower(), + depends(cross_compiling)(lambda x: 'yes' if x else 'no')) + gcc_like = depends(valid_compiler.type)(lambda x: 'yes' if x in ('gcc', 'clang') else 'no') + add_old_configure_assignment('ac_cv_prog_%s_g' % var.lower(), gcc_like) + if language == 'C': + add_old_configure_assignment('ac_cv_prog_gcc', gcc_like) + if language == 'C++': + add_old_configure_assignment('ac_cv_prog_gxx', gcc_like) + # Set CC_TYPE/CC_VERSION/HOST_CC_TYPE/HOST_CC_VERSION to allow # old-configure to do some of its still existing checks. - if language == "C": - set_config("%s_TYPE" % var, valid_compiler.type) - add_old_configure_assignment("%s_TYPE" % var, valid_compiler.type) + if language == 'C': set_config( - "%s_VERSION" % var, depends(valid_compiler.version)(lambda v: str(v)) - ) + '%s_TYPE' % var, valid_compiler.type) + add_old_configure_assignment( + '%s_TYPE' % var, valid_compiler.type) + set_config( + '%s_VERSION' % var, depends(valid_compiler.version)(lambda v: str(v))) valid_compiler = compiler_class(valid_compiler, host_or_target) def compiler_error(): - raise FatalCheckError( - "Failed compiling a simple %s source with %s" % (language, what) - ) + raise FatalCheckError('Failed compiling a simple %s source with %s' + % (language, what)) - valid_compiler.try_compile(check_msg="%s works" % what, onerror=compiler_error) + valid_compiler.try_compile(check_msg='%s works' % what, + onerror=compiler_error) - set_config("%s_BASE_FLAGS" % var, valid_compiler.flags) + set_config('%s_BASE_FLAGS' % var, valid_compiler.flags) # Set CPP/CXXCPP for both the build system and old-configure. We don't # need to check this works for preprocessing, because we already relied @@ -1291,21 +1138,20 @@ def compiler( # in the first place. if host_or_target is target: pp_var = { - "C": "CPP", - "C++": "CXXCPP", + 'C': 'CPP', + 'C++': 'CXXCPP', }[language] preprocessor = depends_if(valid_compiler)( - lambda x: list(x.wrapper) + [x.compiler, "-E"] + list(x.flags) - ) + lambda x: list(x.wrapper) + [x.compiler, '-E'] + list(x.flags)) set_config(pp_var, preprocessor) add_old_configure_assignment(pp_var, preprocessor) - if language == "C": + if language == 'C': linker_var = { - target: "LD", - host: "HOST_LD", + target: 'LD', + host: 'HOST_LD', }[host_or_target] @deprecated_option(env=linker_var, nargs=1) @@ -1316,171 +1162,147 @@ def compiler( @depends(linker) def unused_linker(linker): if linker: - log.warning( - "The value of %s is not used by this build system." % linker_var - ) + log.warning('The value of %s is not used by this build system.' + % linker_var) return valid_compiler -c_compiler = compiler("C", target) -cxx_compiler = compiler("C++", target, c_compiler=c_compiler) -host_c_compiler = compiler("C", host, other_compiler=c_compiler) -host_cxx_compiler = compiler( - "C++", - host, - c_compiler=host_c_compiler, - other_compiler=cxx_compiler, - other_c_compiler=c_compiler, -) +c_compiler = compiler('C', target) +cxx_compiler = compiler('C++', target, c_compiler=c_compiler) +host_c_compiler = compiler('C', host, other_compiler=c_compiler) +host_cxx_compiler = compiler('C++', host, c_compiler=host_c_compiler, + other_compiler=cxx_compiler, + other_c_compiler=c_compiler) # Generic compiler-based conditions. -building_with_gcc = depends(c_compiler)(lambda info: info.type == "gcc") +building_with_gcc = depends(c_compiler)(lambda info: info.type == 'gcc') @depends(cxx_compiler, ccache_prefix) -@imports("os") +@imports('os') def cxx_is_icecream(info, ccache_prefix): - if ( - os.path.islink(info.compiler) - and os.path.basename(os.readlink(info.compiler)) == "icecc" - ): + if (os.path.islink(info.compiler) and os.path.basename( + os.readlink(info.compiler)) == 'icecc'): return True - if ccache_prefix and os.path.basename(ccache_prefix) == "icecc": + if ccache_prefix and os.path.basename(ccache_prefix) == 'icecc': return True - -set_config("CXX_IS_ICECREAM", cxx_is_icecream) +set_config('CXX_IS_ICECREAM', cxx_is_icecream) @depends(c_compiler) def msvs_version(info): # clang-cl emulates the same version scheme as cl. And MSVS_VERSION needs to # be set for GYP on Windows. - if info.type == "clang-cl": - return "2017" + if info.type == 'clang-cl': + return '2017' - return "" + return '' -set_config("MSVS_VERSION", msvs_version) +set_config('MSVS_VERSION', msvs_version) -include("compile-checks.configure") -include("arm.configure", when=depends(target.cpu)(lambda cpu: cpu == "arm")) +include('compile-checks.configure') +include('arm.configure', when=depends(target.cpu)(lambda cpu: cpu == 'arm')) @depends(host, host_os_kernel_major_version, target) def needs_macos_sdk_headers_check(host, version, target): # Only an issue on Mac OS X 10.14 (and probably above). - if host.kernel != "Darwin" or target.kernel != "Darwin" or version < "18": + if host.kernel != 'Darwin' or target.kernel !='Darwin' or version < '18': return return True -@depends( - cxx_compiler.try_run( - header="#include_next ", - check_msg="for macOS SDK headers", - when=needs_macos_sdk_headers_check, - ), - when=needs_macos_sdk_headers_check, -) +@depends(cxx_compiler.try_run(header='#include_next ', + check_msg='for macOS SDK headers', + when=needs_macos_sdk_headers_check), + when=needs_macos_sdk_headers_check) def check_have_mac_10_14_sdk(value): if value: return - die( - "System inttypes.h not found. Please try running " - "`open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg` " - "and following the instructions to install the necessary headers" - ) + die('System inttypes.h not found. Please try running ' + '`open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg` ' + 'and following the instructions to install the necessary headers') -@depends( - have_64_bit, - try_compile( - body='static_assert(sizeof(void *) == 8, "")', check_msg="for 64-bit OS" - ), -) +@depends(have_64_bit, + try_compile(body='static_assert(sizeof(void *) == 8, "")', + check_msg='for 64-bit OS')) def check_have_64_bit(have_64_bit, compiler_have_64_bit): if have_64_bit != compiler_have_64_bit: - configure_error( - "The target compiler does not agree with configure " - "about the target bitness." - ) + configure_error('The target compiler does not agree with configure ' + 'about the target bitness.') @depends(cxx_compiler, target) def needs_libstdcxx_newness_check(cxx_compiler, target): # We only have to care about this on Linux and MinGW. - if cxx_compiler.type == "clang-cl": + if cxx_compiler.type == 'clang-cl': return - if target.kernel not in ("Linux", "WINNT"): + if target.kernel not in ('Linux', 'WINNT'): return - if target.os == "Android": + if target.os == 'Android': return return True def die_on_old_libstdcxx(): - die( - "The libstdc++ in use is not new enough. Please run " - "./mach bootstrap to update your compiler, or update your system " - "libstdc++ installation." - ) - - -try_compile( - includes=["cstddef"], - body="\n".join( - [ - # _GLIBCXX_RELEASE showed up in libstdc++ 7. - "#if defined(__GLIBCXX__) && !defined(_GLIBCXX_RELEASE)", - "# error libstdc++ not new enough", - "#endif", - "#if defined(_GLIBCXX_RELEASE)", - "# if _GLIBCXX_RELEASE < %d" % minimum_gcc_version().major, - "# error libstdc++ not new enough", - "# else", - " (void) 0", - "# endif", - "#endif", - ] - ), - check_msg="for new enough STL headers from libstdc++", - when=needs_libstdcxx_newness_check, - onerror=die_on_old_libstdcxx, -) + die('The libstdc++ in use is not new enough. Please run ' + './mach bootstrap to update your compiler, or update your system ' + 'libstdc++ installation.') + +try_compile(includes=['cstddef'], + body='\n'.join([ + # _GLIBCXX_RELEASE showed up in libstdc++ 7. + '#if defined(__GLIBCXX__) && !defined(_GLIBCXX_RELEASE)', + '# error libstdc++ not new enough', + '#endif', + '#if defined(_GLIBCXX_RELEASE)', + '# if _GLIBCXX_RELEASE < %d' % minimum_gcc_version().major, + '# error libstdc++ not new enough', + '# else', + ' (void) 0', + '# endif', + '#endif', + ]), + check_msg='for new enough STL headers from libstdc++', + when=needs_libstdcxx_newness_check, + onerror=die_on_old_libstdcxx) @depends(c_compiler, target) def default_debug_flags(compiler_info, target): # Debug info is ON by default. - if compiler_info.type == "clang-cl": - return "-Z7" - elif target.kernel == "WINNT" and compiler_info.type == "clang": - return "-g -gcodeview" - return "-g" + if compiler_info.type == 'clang-cl': + return '-Z7' + elif target.kernel == 'WINNT' and compiler_info.type == 'clang': + return '-g -gcodeview' + return '-g' -option(env="MOZ_DEBUG_FLAGS", nargs=1, help="Debug compiler flags") +option(env='MOZ_DEBUG_FLAGS', + nargs=1, + help='Debug compiler flags') -imply_option("--enable-debug-symbols", depends_if("--enable-debug")(lambda v: v)) +imply_option('--enable-debug-symbols', + depends_if('--enable-debug')(lambda v: v)) -option( - "--disable-debug-symbols", - nargs="?", - help="Disable debug symbols using the given compiler flags", -) +option('--disable-debug-symbols', + nargs='?', + help='Disable debug symbols using the given compiler flags') -set_config("MOZ_DEBUG_SYMBOLS", depends_if("--enable-debug-symbols")(lambda _: True)) +set_config('MOZ_DEBUG_SYMBOLS', + depends_if('--enable-debug-symbols')(lambda _: True)) -@depends("MOZ_DEBUG_FLAGS", "--enable-debug-symbols", default_debug_flags) +@depends('MOZ_DEBUG_FLAGS', '--enable-debug-symbols', default_debug_flags) def debug_flags(env_debug_flags, enable_debug_flags, default_debug_flags): # If MOZ_DEBUG_FLAGS is set, and --enable-debug-symbols is set to a value, # --enable-debug-symbols takes precedence. Note, the value of @@ -1492,8 +1314,8 @@ def debug_flags(env_debug_flags, enable_debug_flags, default_debug_flags): return default_debug_flags -set_config("MOZ_DEBUG_FLAGS", debug_flags) -add_old_configure_assignment("MOZ_DEBUG_FLAGS", debug_flags) +set_config('MOZ_DEBUG_FLAGS', debug_flags) +add_old_configure_assignment('MOZ_DEBUG_FLAGS', debug_flags) @depends(c_compiler) @@ -1508,15 +1330,15 @@ def color_cflags(info): # value changes to e.g. "=always", exact string match may fail and # multiple color flags could be added. So examine downstream consumers # before adding flags to return values. - if info.type == "gcc": - return "-fdiagnostics-color" - elif info.type == "clang": - return "-fcolor-diagnostics" + if info.type == 'gcc': + return '-fdiagnostics-color' + elif info.type == 'clang': + return '-fcolor-diagnostics' else: - return "" + return '' -set_config("COLOR_CFLAGS", color_cflags) +set_config('COLOR_CFLAGS', color_cflags) # Some standard library headers (notably bionic on Android) declare standard # functions (e.g. getchar()) and also #define macros for those standard @@ -1568,54 +1390,48 @@ set_config("COLOR_CFLAGS", color_cflags) @depends(c_compiler, target) def libcxx_override_visibility(c_compiler, target): - if c_compiler.type == "clang" and target.os == "Android": + if c_compiler.type == 'clang' and target.os == 'Android': return namespace( - empty="", - hide_from_abi="__attribute__((__exclude_from_explicit_instantiation__))", + empty='', + hide_from_abi='__attribute__((__exclude_from_explicit_instantiation__))', ) -set_define("_LIBCPP_INLINE_VISIBILITY", libcxx_override_visibility.empty) -set_define("_LIBCPP_ALWAYS_INLINE", libcxx_override_visibility.empty) - -set_define("_LIBCPP_HIDE_FROM_ABI", libcxx_override_visibility.hide_from_abi) +set_define('_LIBCPP_INLINE_VISIBILITY', libcxx_override_visibility.empty) +set_define('_LIBCPP_ALWAYS_INLINE', libcxx_override_visibility.empty) +set_define('_LIBCPP_HIDE_FROM_ABI', libcxx_override_visibility.hide_from_abi) @depends(target, check_build_environment) def visibility_flags(target, env): - if target.os != "WINNT": - if target.kernel == "Darwin": - return ("-fvisibility=hidden", "-fvisibility-inlines-hidden") - return ( - "-I%s/system_wrappers" % os.path.join(env.dist), - "-include", - "%s/config/gcc_hidden.h" % env.topsrcdir, - ) + if target.os != 'WINNT': + if target.kernel == 'Darwin': + return ('-fvisibility=hidden', '-fvisibility-inlines-hidden') + return ('-I%s/system_wrappers' % os.path.join(env.dist), + '-include', + '%s/config/gcc_hidden.h' % env.topsrcdir) @depends(target, visibility_flags) def wrap_system_includes(target, visibility_flags): - if visibility_flags and target.kernel != "Darwin": + if visibility_flags and target.kernel != 'Darwin': return True -set_define( - "HAVE_VISIBILITY_HIDDEN_ATTRIBUTE", - depends(visibility_flags)(lambda v: bool(v) or None), -) -set_define( - "HAVE_VISIBILITY_ATTRIBUTE", depends(visibility_flags)(lambda v: bool(v) or None) -) -set_config("WRAP_SYSTEM_INCLUDES", wrap_system_includes) -set_config("VISIBILITY_FLAGS", visibility_flags) +set_define('HAVE_VISIBILITY_HIDDEN_ATTRIBUTE', + depends(visibility_flags)(lambda v: bool(v) or None)) +set_define('HAVE_VISIBILITY_ATTRIBUTE', + depends(visibility_flags)(lambda v: bool(v) or None)) +set_config('WRAP_SYSTEM_INCLUDES', wrap_system_includes) +set_config('VISIBILITY_FLAGS', visibility_flags) @template def depend_cflags(host_or_target_c_compiler): @depends(host_or_target_c_compiler) def depend_cflags(host_or_target_c_compiler): - if host_or_target_c_compiler.type != "clang-cl": - return ["-MD", "-MP", "-MF $(MDDEPDIR)/$(@F).pp"] + if host_or_target_c_compiler.type != 'clang-cl': + return ['-MD', '-MP', '-MF $(MDDEPDIR)/$(@F).pp'] else: # clang-cl doesn't accept the normal -MD -MP -MF options that clang # does, but the underlying cc1 binary understands how to generate @@ -1623,35 +1439,30 @@ def depend_cflags(host_or_target_c_compiler): # normal clang driver sends to cc1 when given the "correct" # dependency options. return [ - "-Xclang", - "-MP", - "-Xclang", - "-dependency-file", - "-Xclang", - "$(MDDEPDIR)/$(@F).pp", - "-Xclang", - "-MT", - "-Xclang", - "$@", + '-Xclang', '-MP', + '-Xclang', '-dependency-file', + '-Xclang', '$(MDDEPDIR)/$(@F).pp', + '-Xclang', '-MT', + '-Xclang', '$@' ] return depend_cflags -set_config("_DEPEND_CFLAGS", depend_cflags(c_compiler)) -set_config("_HOST_DEPEND_CFLAGS", depend_cflags(host_c_compiler)) +set_config('_DEPEND_CFLAGS', depend_cflags(c_compiler)) +set_config('_HOST_DEPEND_CFLAGS', depend_cflags(host_c_compiler)) @depends(c_compiler) def preprocess_option(compiler): # The uses of PREPROCESS_OPTION depend on the spacing for -o/-Fi. - if compiler.type in ("gcc", "clang"): - return "-E -o " + if compiler.type in ('gcc', 'clang'): + return '-E -o ' else: - return "-P -Fi" + return '-P -Fi' -set_config("PREPROCESS_OPTION", preprocess_option) +set_config('PREPROCESS_OPTION', preprocess_option) # We only want to include windows.configure when we are compiling on @@ -1660,135 +1471,120 @@ set_config("PREPROCESS_OPTION", preprocess_option) @depends(target, host) def is_windows(target, host): - return host.kernel == "WINNT" or target.kernel == "WINNT" + return host.kernel == 'WINNT' or target.kernel == 'WINNT' -include("windows.configure", when=is_windows) +include('windows.configure', when=is_windows) # On Power ISA, determine compiler flags for VMX, VSX and VSX-3. -set_config( - "PPC_VMX_FLAGS", - ["-maltivec"], - when=depends(target.cpu)(lambda cpu: cpu.startswith("ppc")), -) +set_config('PPC_VMX_FLAGS', + ['-maltivec'], + when=depends(target.cpu)(lambda cpu: cpu.startswith('ppc'))) -set_config( - "PPC_VSX_FLAGS", - ["-mvsx"], - when=depends(target.cpu)(lambda cpu: cpu.startswith("ppc")), -) +set_config('PPC_VSX_FLAGS', + ['-mvsx'], + when=depends(target.cpu)(lambda cpu: cpu.startswith('ppc'))) -set_config( - "PPC_VSX3_FLAGS", - ["-mvsx", "-mcpu=power9"], - when=depends(target.cpu)(lambda cpu: cpu.startswith("ppc")), -) +set_config('PPC_VSX3_FLAGS', + ['-mvsx','-mcpu=power9'], + when=depends(target.cpu)(lambda cpu: cpu.startswith('ppc'))) # ASAN # ============================================================== -option("--enable-address-sanitizer", help="Enable Address Sanitizer") +option('--enable-address-sanitizer', help='Enable Address Sanitizer') -@depends(when="--enable-address-sanitizer") +@depends(when='--enable-address-sanitizer') def asan(): return True -add_old_configure_assignment("MOZ_ASAN", asan) +add_old_configure_assignment('MOZ_ASAN', asan) # MSAN # ============================================================== -option("--enable-memory-sanitizer", help="Enable Memory Sanitizer") +option('--enable-memory-sanitizer', help='Enable Memory Sanitizer') -@depends(when="--enable-memory-sanitizer") +@depends(when='--enable-memory-sanitizer') def msan(): return True -add_old_configure_assignment("MOZ_MSAN", msan) +add_old_configure_assignment('MOZ_MSAN', msan) # TSAN # ============================================================== -option("--enable-thread-sanitizer", help="Enable Thread Sanitizer") +option('--enable-thread-sanitizer', help='Enable Thread Sanitizer') -@depends(when="--enable-thread-sanitizer") +@depends(when='--enable-thread-sanitizer') def tsan(): return True -add_old_configure_assignment("MOZ_TSAN", tsan) +add_old_configure_assignment('MOZ_TSAN', tsan) # UBSAN # ============================================================== -option( - "--enable-undefined-sanitizer", nargs="*", help="Enable UndefinedBehavior Sanitizer" -) - +option('--enable-undefined-sanitizer', + nargs='*', + help='Enable UndefinedBehavior Sanitizer') -@depends_if("--enable-undefined-sanitizer") +@depends_if('--enable-undefined-sanitizer') def ubsan(options): default_checks = [ - "bool", - "bounds", - "enum", - "integer-divide-by-zero", - "object-size", - "pointer-overflow", - "return", - "vla-bound", + 'bool', + 'bounds', + 'enum', + 'integer-divide-by-zero', + 'object-size', + 'pointer-overflow', + 'return', + 'vla-bound', ] checks = options if len(options) else default_checks - return ",".join(checks) - + return ','.join(checks) -add_old_configure_assignment("MOZ_UBSAN_CHECKS", ubsan) +add_old_configure_assignment('MOZ_UBSAN_CHECKS', ubsan) -option( - "--enable-signed-overflow-sanitizer", - help="Enable UndefinedBehavior Sanitizer (Signed Integer Overflow Parts)", -) +option('--enable-signed-overflow-sanitizer', + help='Enable UndefinedBehavior Sanitizer (Signed Integer Overflow Parts)') -@depends(when="--enable-signed-overflow-sanitizer") +@depends(when='--enable-signed-overflow-sanitizer') def ub_signed_overflow_san(): return True -add_old_configure_assignment("MOZ_SIGNED_OVERFLOW_SANITIZE", ub_signed_overflow_san) +add_old_configure_assignment('MOZ_SIGNED_OVERFLOW_SANITIZE', ub_signed_overflow_san) -option( - "--enable-unsigned-overflow-sanitizer", - help="Enable UndefinedBehavior Sanitizer (Unsigned Integer Overflow Parts)", -) +option('--enable-unsigned-overflow-sanitizer', + help='Enable UndefinedBehavior Sanitizer (Unsigned Integer Overflow Parts)') -@depends(when="--enable-unsigned-overflow-sanitizer") +@depends(when='--enable-unsigned-overflow-sanitizer') def ub_unsigned_overflow_san(): return True -add_old_configure_assignment("MOZ_UNSIGNED_OVERFLOW_SANITIZE", ub_unsigned_overflow_san) +add_old_configure_assignment('MOZ_UNSIGNED_OVERFLOW_SANITIZE', ub_unsigned_overflow_san) # Security Hardening # ============================================================== -option( - "--enable-hardening", - env="MOZ_SECURITY_HARDENING", - help="Enables security hardening compiler options", -) +option('--enable-hardening', env='MOZ_SECURITY_HARDENING', + help='Enables security hardening compiler options') # This function is a bit confusing. It adds or removes hardening flags in @@ -1800,19 +1596,12 @@ option( # flag. --disable-hardening will omit the security flags. (However, not all # possible security flags will be omitted by --disable-hardening, as many are # compiler-default options we do not explicitly enable.) -@depends( - "--enable-hardening", - "--enable-address-sanitizer", - "--enable-debug", - "--enable-optimize", - c_compiler, - target, -) -def security_hardening_cflags( - hardening_flag, asan, debug, optimize, c_compiler, target -): - compiler_is_gccish = c_compiler.type in ("gcc", "clang") - mingw_clang = c_compiler.type == "clang" and target.os == "WINNT" +@depends('--enable-hardening', '--enable-address-sanitizer', + '--enable-debug', '--enable-optimize', c_compiler, target) +def security_hardening_cflags(hardening_flag, asan, debug, optimize, c_compiler, + target): + compiler_is_gccish = c_compiler.type in ('gcc', 'clang') + mingw_clang = c_compiler.type == 'clang' and target.os == 'WINNT' flags = [] ldflags = [] @@ -1827,15 +1616,15 @@ def security_hardening_cflags( # Also, undefine it before defining it just in case a distro adds it, see Bug 1418398 if compiler_is_gccish and optimize and not asan: # Don't enable FORTIFY_SOURCE on Android on the top-level, but do enable in js/ - if target.os != "Android": + if target.os != 'Android': flags.append("-U_FORTIFY_SOURCE") flags.append("-D_FORTIFY_SOURCE=2") js_flags.append("-U_FORTIFY_SOURCE") js_flags.append("-D_FORTIFY_SOURCE=2") if mingw_clang: # mingw-clang needs to link in ssp which is not done by default - ldflags.append("-lssp") - js_ldflags.append("-lssp") + ldflags.append('-lssp') + js_ldflags.append('-lssp') # fstack-protector ------------------------------------ # Enable only if hardening is not disabled and ASAN is @@ -1849,18 +1638,14 @@ def security_hardening_cflags( # ftrivial-auto-var-init ------------------------------ # Initialize local variables with a 0xAA pattern in clang debug builds. # Linux32 fails some xpcshell tests with -ftrivial-auto-var-init - linux32 = target.kernel == "Linux" and target.cpu == "x86" - if ( - (c_compiler.type == "clang" or c_compiler.type == "clang-cl") - and c_compiler.version >= "8" - and debug - and not linux32 - ): - if c_compiler.type == "clang-cl": - flags.append("-Xclang") - js_flags.append("-Xclang") - flags.append("-ftrivial-auto-var-init=pattern") - js_flags.append("-ftrivial-auto-var-init=pattern") + linux32 = target.kernel == 'Linux' and target.cpu == 'x86' + if (c_compiler.type == 'clang' or c_compiler.type == 'clang-cl') and \ + c_compiler.version >= '8' and debug and not linux32: + if c_compiler.type == 'clang-cl': + flags.append('-Xclang') + js_flags.append('-Xclang') + flags.append('-ftrivial-auto-var-init=pattern') + js_flags.append('-ftrivial-auto-var-init=pattern') # ASLR ------------------------------------------------ # ASLR (dynamicbase) is enabled by default in clang-cl; but the @@ -1870,12 +1655,9 @@ def security_hardening_cflags( js_ldflags.append("-Wl,--dynamicbase") # Control Flow Guard (CFG) ---------------------------- - if ( - c_compiler.type == "clang-cl" - and c_compiler.version >= "8" - and (target.cpu != "aarch64" or c_compiler.version >= "8.0.1") - ): - if target.cpu == "aarch64" and c_compiler.version >= "10.0.0": + if c_compiler.type == 'clang-cl' and c_compiler.version >= '8' and \ + (target.cpu != 'aarch64' or c_compiler.version >= '8.0.1'): + if target.cpu == 'aarch64' and c_compiler.version >= '10.0.0': # The added checks in clang 10 make arm64 builds crash. (Bug 1639318) flags.append("-guard:cf,nochecks") js_flags.append("-guard:cf,nochecks") @@ -1897,7 +1679,7 @@ def security_hardening_cflags( # Do not merge variables for ASAN; can detect some subtle bugs if asan: # clang-cl does not recognize the flag, it must be passed down to clang - if c_compiler.type == "clang-cl": + if c_compiler.type == 'clang-cl': flags.append("-Xclang") flags.append("-fno-common") @@ -1909,72 +1691,58 @@ def security_hardening_cflags( ) -set_config("MOZ_HARDENING_CFLAGS", security_hardening_cflags.flags) -set_config("MOZ_HARDENING_LDFLAGS", security_hardening_cflags.ldflags) -set_config("MOZ_HARDENING_CFLAGS_JS", security_hardening_cflags.js_flags) -set_config("MOZ_HARDENING_LDFLAGS_JS", security_hardening_cflags.js_ldflags) +set_config('MOZ_HARDENING_CFLAGS', security_hardening_cflags.flags) +set_config('MOZ_HARDENING_LDFLAGS', security_hardening_cflags.ldflags) +set_config('MOZ_HARDENING_CFLAGS_JS', security_hardening_cflags.js_flags) +set_config('MOZ_HARDENING_LDFLAGS_JS', security_hardening_cflags.js_ldflags) # Frame pointers # ============================================================== @depends(c_compiler) def frame_pointer_flags(compiler): - if compiler.type == "clang-cl": + if compiler.type == 'clang-cl': return namespace( - enable=["-Oy-"], - disable=["-Oy"], + enable=['-Oy-'], + disable=['-Oy'], ) return namespace( - enable=["-fno-omit-frame-pointer", "-funwind-tables"], - disable=["-fomit-frame-pointer", "-funwind-tables"], + enable=['-fno-omit-frame-pointer', '-funwind-tables'], + disable=['-fomit-frame-pointer', '-funwind-tables'], ) -@depends( - moz_optimize.optimize, - moz_debug, - target, - "--enable-memory-sanitizer", - "--enable-address-sanitizer", - "--enable-undefined-sanitizer", -) +@depends(moz_optimize.optimize, moz_debug, target, + '--enable-memory-sanitizer', '--enable-address-sanitizer', + '--enable-undefined-sanitizer') def frame_pointer_default(optimize, debug, target, msan, asan, ubsan): - return bool( - not optimize - or debug - or msan - or asan - or ubsan - or (target.os == "WINNT" and target.cpu in ("x86", "aarch64")) - ) + return bool(not optimize or debug or msan or asan or ubsan or \ + (target.os == 'WINNT' and target.cpu in ('x86', 'aarch64'))) -option( - "--enable-frame-pointers", - default=frame_pointer_default, - help="{Enable|Disable} frame pointers", -) +option('--enable-frame-pointers', default=frame_pointer_default, + help='{Enable|Disable} frame pointers') -@depends("--enable-frame-pointers", frame_pointer_flags) +@depends('--enable-frame-pointers', frame_pointer_flags) def frame_pointer_flags(enable, flags): if enable: return flags.enable return flags.disable -set_config("MOZ_FRAMEPTR_FLAGS", frame_pointer_flags) +set_config('MOZ_FRAMEPTR_FLAGS', frame_pointer_flags) # nasm detection # ============================================================== -nasm = check_prog("NASM", ["nasm"], allow_missing=True, paths=toolchain_search_path) +nasm = check_prog('NASM', ['nasm'], allow_missing=True, paths=toolchain_search_path) @depends_if(nasm) -@checking("nasm version") +@checking('nasm version') def nasm_version(nasm): - (retcode, stdout, _) = get_cmd_output(nasm, "-v") + (retcode, stdout, _) = get_cmd_output(nasm, '-v') if retcode: # mac stub binary return None @@ -1993,31 +1761,30 @@ def nasm_minor_version(nasm_version): return str(nasm_version.minor) -set_config("NASM_MAJOR_VERSION", nasm_major_version) -set_config("NASM_MINOR_VERSION", nasm_minor_version) +set_config('NASM_MAJOR_VERSION', nasm_major_version) +set_config('NASM_MINOR_VERSION', nasm_minor_version) @depends(nasm, target) def nasm_asflags(nasm, target): if nasm: asflags = { - ("OSX", "x86"): ["-f", "macho32"], - ("OSX", "x86_64"): ["-f", "macho64"], - ("WINNT", "x86"): ["-f", "win32"], - ("WINNT", "x86_64"): ["-f", "win64"], + ('OSX', 'x86'): ['-f', 'macho32'], + ('OSX', 'x86_64'): ['-f', 'macho64'], + ('WINNT', 'x86'): ['-f', 'win32'], + ('WINNT', 'x86_64'): ['-f', 'win64'], }.get((target.os, target.cpu), None) if asflags is None: # We're assuming every x86 platform we support that's # not Windows or Mac is ELF. - if target.cpu == "x86": - asflags = ["-f", "elf32"] - elif target.cpu == "x86_64": - asflags = ["-f", "elf64"] + if target.cpu == 'x86': + asflags = ['-f', 'elf32'] + elif target.cpu == 'x86_64': + asflags = ['-f', 'elf64'] return asflags -set_config("NASM_ASFLAGS", nasm_asflags) - +set_config('NASM_ASFLAGS', nasm_asflags) @depends(nasm_asflags) def have_nasm(value): @@ -2030,45 +1797,43 @@ def have_yasm(yasm_asflags): if yasm_asflags: return True +set_config('HAVE_NASM', have_nasm) -set_config("HAVE_NASM", have_nasm) - -set_config("HAVE_YASM", have_yasm) +set_config('HAVE_YASM', have_yasm) # Until the YASM variable is not necessary in old-configure. -add_old_configure_assignment("YASM", have_yasm) +add_old_configure_assignment('YASM', have_yasm) # Code Coverage # ============================================================== -option("--enable-coverage", env="MOZ_CODE_COVERAGE", help="Enable code coverage") +option('--enable-coverage', env='MOZ_CODE_COVERAGE', + help='Enable code coverage') -@depends("--enable-coverage") +@depends('--enable-coverage') def code_coverage(value): if value: return True -set_config("MOZ_CODE_COVERAGE", code_coverage) -set_define("MOZ_CODE_COVERAGE", code_coverage) - +set_config('MOZ_CODE_COVERAGE', code_coverage) +set_define('MOZ_CODE_COVERAGE', code_coverage) @depends(target, c_compiler, vc_path, check_build_environment, when=code_coverage) -@imports("os") -@imports("re") -@imports(_from="__builtin__", _import="open") +@imports('os') +@imports('re') +@imports(_from='__builtin__', _import='open') def coverage_cflags(target, c_compiler, vc_path, build_env): - cflags = ["--coverage"] + cflags = ['--coverage'] # clang 11 no longer accepts this flag (its behavior became the default) - if c_compiler.type in ("clang", "clang-cl") and c_compiler.version < "11.0.0": + if c_compiler.type in ('clang', 'clang-cl') and c_compiler.version < '11.0.0': cflags += [ - "-Xclang", - "-coverage-no-function-names-in-data", + '-Xclang', '-coverage-no-function-names-in-data', ] - if target.os == "WINNT" and c_compiler.type == "clang-cl": + if target.os == 'WINNT' and c_compiler.type == 'clang-cl': # The Visual Studio directory is the parent of the Visual C++ directory. vs_path = os.path.dirname(vc_path) @@ -2077,49 +1842,46 @@ def coverage_cflags(target, c_compiler, vc_path, build_env): vs_path = os.path.realpath(vs_path) cflags += [ - "-fprofile-exclude-files=^{}.*$".format(re.escape(vs_path)), + '-fprofile-exclude-files=^{}.*$'.format(re.escape(vs_path)), ] - response_file_path = os.path.join(build_env.topobjdir, "code_coverage_cflags") + response_file_path = os.path.join(build_env.topobjdir, 'code_coverage_cflags') - with open(response_file_path, "w") as f: - f.write(" ".join(cflags)) + with open(response_file_path, 'w') as f: + f.write(' '.join(cflags)) - return ["@{}".format(response_file_path)] + return ['@{}'.format(response_file_path)] - -set_config("COVERAGE_CFLAGS", coverage_cflags) +set_config('COVERAGE_CFLAGS', coverage_cflags) # ============================================================== -option(env="RUSTFLAGS", nargs=1, help="Rust compiler flags") -set_config("RUSTFLAGS", depends("RUSTFLAGS")(lambda flags: flags)) +option(env='RUSTFLAGS', + nargs=1, + help='Rust compiler flags') +set_config('RUSTFLAGS', depends('RUSTFLAGS')(lambda flags: flags)) # Rust compiler flags # ============================================================== -option( - env="RUSTC_OPT_LEVEL", - nargs=1, - help="Rust compiler optimization level (-C opt-level=%s)", -) +option(env='RUSTC_OPT_LEVEL', + nargs=1, + help='Rust compiler optimization level (-C opt-level=%s)') # --enable-release kicks in full optimizations. -imply_option("RUSTC_OPT_LEVEL", "2", when="--enable-release") +imply_option('RUSTC_OPT_LEVEL', '2', when='--enable-release') -@depends("RUSTC_OPT_LEVEL", moz_optimize) +@depends('RUSTC_OPT_LEVEL', moz_optimize) def rustc_opt_level(opt_level_option, moz_optimize): if opt_level_option: return opt_level_option[0] else: - return "1" if moz_optimize.optimize else "0" + return '1' if moz_optimize.optimize else '0' -@depends( - rustc_opt_level, debug_rust, "--enable-debug-symbols", "--enable-frame-pointers" -) +@depends(rustc_opt_level, debug_rust, '--enable-debug-symbols', '--enable-frame-pointers') def rust_compile_flags(opt_level, debug_rust, debug_symbols, frame_pointers): # Cargo currently supports only two interesting profiles for building: # development and release. Those map (roughly) to --enable-debug and @@ -2138,26 +1900,27 @@ def rust_compile_flags(opt_level, debug_rust, debug_symbols, frame_pointers): # opt-level=0 implies -C debug-assertions, which may not be desired # unless Rust debugging is enabled. - if opt_level == "0" and not debug_rust: + if opt_level == '0' and not debug_rust: debug_assertions = False if debug_symbols: - debug_info = "2" + debug_info = '2' opts = [] if opt_level is not None: - opts.append("opt-level=%s" % opt_level) + opts.append('opt-level=%s' % opt_level) if debug_assertions is not None: - opts.append("debug-assertions=%s" % ("yes" if debug_assertions else "no")) + opts.append('debug-assertions=%s' % + ('yes' if debug_assertions else 'no')) if debug_info is not None: - opts.append("debuginfo=%s" % debug_info) + opts.append('debuginfo=%s' % debug_info) if frame_pointers: - opts.append("force-frame-pointers=yes") + opts.append('force-frame-pointers=yes') flags = [] for opt in opts: - flags.extend(["-C", opt]) + flags.extend(['-C', opt]) return flags @@ -2166,52 +1929,38 @@ def rust_compile_flags(opt_level, debug_rust, debug_symbols, frame_pointers): # ============================================================== -option("--disable-cargo-incremental", help="Disable incremental rust compilation.") - - -@depends( - rustc_opt_level, - debug_rust, - "MOZ_AUTOMATION", - code_coverage, - "--disable-cargo-incremental", - using_sccache, - "RUSTC_WRAPPER", -) -@imports("os") -def cargo_incremental( - opt_level, - debug_rust, - automation, - code_coverage, - enabled, - using_sccache, - rustc_wrapper, -): +option('--disable-cargo-incremental', + help='Disable incremental rust compilation.') + +@depends(rustc_opt_level, debug_rust, 'MOZ_AUTOMATION', code_coverage, + '--disable-cargo-incremental', using_sccache, 'RUSTC_WRAPPER') +@imports('os') +def cargo_incremental(opt_level, debug_rust, automation, code_coverage, + enabled, using_sccache, rustc_wrapper): """Return a value for the CARGO_INCREMENTAL environment variable.""" if not enabled: - return "0" + return '0' # We never want to use incremental compilation in automation. sccache # handles our automation use case much better than incremental compilation # would. if automation: - return "0" + return '0' # Coverage instrumentation doesn't play well with incremental compilation # https://github.com/rust-lang/rust/issues/50203. if code_coverage: - return "0" + return '0' # Incremental compilation doesn't work as well as it should, and if we're # using sccache, it's better to use sccache than incremental compilation. if not using_sccache and rustc_wrapper: rustc_wrapper = os.path.basename(rustc_wrapper[0]) - if os.path.splitext(rustc_wrapper)[0].lower() == "sccache": + if os.path.splitext(rustc_wrapper)[0].lower() == 'sccache': using_sccache = True if using_sccache: - return "0" + return '0' # Incremental compilation is automatically turned on for debug builds, so # we don't need to do anything special here. @@ -2223,14 +1972,14 @@ def cargo_incremental( # Let's assume that if Rust code is using -O2 or higher, we shouldn't # be using incremental compilation, because we'd be imposing a # significant runtime cost. - if opt_level not in ("0", "1"): + if opt_level not in ('0', '1'): return # We're clear to use incremental compilation! - return "1" + return '1' -set_config("CARGO_INCREMENTAL", cargo_incremental) +set_config('CARGO_INCREMENTAL', cargo_incremental) # Linker detection # ============================================================== @@ -2252,60 +2001,46 @@ set_config("CARGO_INCREMENTAL", cargo_incremental) # https://bugzilla.mozilla.org/show_bug.cgi?id=1563654#c2. @depends(target) def is_linker_option_enabled(target): - if target.kernel not in ("WINNT", "SunOS"): + if target.kernel not in ('WINNT', 'SunOS'): return True -option( - "--enable-gold", - env="MOZ_FORCE_GOLD", - help="Enable GNU Gold Linker when it is not already the default", - when=is_linker_option_enabled, -) - -imply_option("--enable-linker", "gold", when="--enable-gold") +option('--enable-gold', + env='MOZ_FORCE_GOLD', + help='Enable GNU Gold Linker when it is not already the default', + when=is_linker_option_enabled) +imply_option('--enable-linker', 'gold', when='--enable-gold') @depends(target, developer_options) def enable_linker_default(target, developer_options): # x86-64 gold has bugs in how it lays out .note.* sections. See bug 1573820. # x86-32 gold has a bug when assembly files are built. See bug 1651699. # lld is faster, so prefer that for developer builds. - if target.os == "Android" and target.cpu in ("x86", "x86_64"): - return "lld" if developer_options else "bfd" + if target.os == 'Android' and target.cpu in ('x86', 'x86_64'): + return 'lld' if developer_options else 'bfd' -option( - "--enable-linker", - nargs=1, - help="Select the linker {bfd, gold, ld64, lld, lld-*}{|}", - default=enable_linker_default, - when=is_linker_option_enabled, -) +option('--enable-linker', nargs=1, + help='Select the linker {bfd, gold, ld64, lld, lld-*}{|}', + default=enable_linker_default, + when=is_linker_option_enabled) # No-op to enable depending on --enable-linker from default_elfhack in # toolkit/moz.configure. -@depends("--enable-linker", when=is_linker_option_enabled) +@depends('--enable-linker', when=is_linker_option_enabled) def enable_linker(linker): return linker -@depends( - "--enable-linker", - c_compiler, - developer_options, - "--enable-gold", - extra_toolchain_flags, - target, - when=is_linker_option_enabled, -) -@checking("for linker", lambda x: x.KIND) -@imports("os") -@imports("shutil") -def select_linker( - linker, c_compiler, developer_options, enable_gold, toolchain_flags, target -): +@depends('--enable-linker', c_compiler, developer_options, '--enable-gold', + extra_toolchain_flags, target, when=is_linker_option_enabled) +@checking('for linker', lambda x: x.KIND) +@imports('os') +@imports('shutil') +def select_linker(linker, c_compiler, developer_options, enable_gold, + toolchain_flags, target): if linker: linker = linker[0] @@ -2313,28 +2048,28 @@ def select_linker( linker = None def is_valid_linker(linker): - if target.kernel == "Darwin": - valid_linkers = ("ld64", "lld") + if target.kernel == 'Darwin': + valid_linkers = ('ld64', 'lld') else: - valid_linkers = ("bfd", "gold", "lld") + valid_linkers = ('bfd', 'gold', 'lld') if linker in valid_linkers: return True - if "lld" in valid_linkers and linker.startswith("lld-"): + if 'lld' in valid_linkers and linker.startswith('lld-'): return True return False if linker and not is_valid_linker(linker): # Check that we are trying to use a supported linker - die("Unsupported linker " + linker) + die('Unsupported linker ' + linker) # Check the kind of linker - version_check = ["-Wl,--version"] + version_check = ['-Wl,--version'] cmd_base = c_compiler.wrapper + [c_compiler.compiler] + c_compiler.flags def try_linker(linker): # Generate the compiler flag - if linker == "ld64": - linker_flag = ["-fuse-ld=ld"] + if linker == 'ld64': + linker_flag = ['-fuse-ld=ld'] elif linker: linker_flag = ["-fuse-ld=" + linker] else: @@ -2350,29 +2085,29 @@ def select_linker( # Instead, abuse its LD_PRINT_OPTIONS feature to detect a message # specific to it on stderr when it fails to process --version. env = dict(os.environ) - env["LD_PRINT_OPTIONS"] = "1" + env['LD_PRINT_OPTIONS'] = '1' # Some locales might not print out the strings we are looking for, so # ensure consistent output. - env["LC_ALL"] = "C" + env['LC_ALL'] = 'C' retcode, stdout, stderr = get_cmd_output(*cmd, env=env) - if retcode == 1 and "Logging ld64 options" in stderr: - kind = "ld64" + if retcode == 1 and 'Logging ld64 options' in stderr: + kind = 'ld64' elif retcode != 0: return None - elif "GNU ld" in stdout: + elif 'GNU ld' in stdout: # We are using the normal linker - kind = "bfd" + kind = 'bfd' - elif "GNU gold" in stdout: - kind = "gold" + elif 'GNU gold' in stdout: + kind = 'gold' - elif "LLD" in stdout: - kind = "lld" + elif 'LLD' in stdout: + kind = 'lld' else: - kind = "unknown" + kind = 'unknown' return namespace( KIND=kind, @@ -2385,17 +2120,13 @@ def select_linker( die("Could not use {} as linker".format(linker)) die("Failed to find a linker") - if ( - linker is None - and enable_gold.origin == "default" - and developer_options - and result.KIND in ("bfd", "gold") - ): + if (linker is None and enable_gold.origin == 'default' and + developer_options and result.KIND in ('bfd', 'gold')): # try and use lld if available. - tried = try_linker("lld") - if result.KIND != "gold" and (tried is None or tried.KIND != "lld"): - tried = try_linker("gold") - if tried is None or tried.KIND != "gold": + tried = try_linker('lld') + if result.KIND != 'gold' and (tried is None or tried.KIND != 'lld'): + tried = try_linker('gold') + if tried is None or tried.KIND != 'gold': tried = None if tried: result = tried @@ -2407,22 +2138,22 @@ def select_linker( return result -set_config("LINKER_KIND", select_linker.KIND) +set_config('LINKER_KIND', select_linker.KIND) @depends_if(select_linker, macos_sdk) def linker_ldflags(linker, macos_sdk): flags = list((linker and linker.LINKER_FLAG) or []) if macos_sdk: - if linker and linker.KIND == "ld64": - flags.append("-Wl,-syslibroot,%s" % macos_sdk) + if linker and linker.KIND == 'ld64': + flags.append('-Wl,-syslibroot,%s' % macos_sdk) else: - flags.append("-Wl,--sysroot=%s" % macos_sdk) + flags.append('-Wl,--sysroot=%s' % macos_sdk) return flags -add_old_configure_assignment("LINKER_LDFLAGS", linker_ldflags) +add_old_configure_assignment('LINKER_LDFLAGS', linker_ldflags) # There's a wrinkle with MinGW: linker configuration is not enabled, so @@ -2430,34 +2161,38 @@ add_old_configure_assignment("LINKER_LDFLAGS", linker_ldflags) @depends(select_linker, target, c_compiler) def gcc_use_gnu_ld(select_linker, target, c_compiler): if select_linker is not None: - return select_linker.KIND in ("bfd", "gold", "lld") - if target.kernel == "WINNT" and c_compiler.type == "clang": + return select_linker.KIND in ('bfd', 'gold', 'lld') + if target.kernel == 'WINNT' and c_compiler.type == 'clang': return True return None # GCC_USE_GNU_LD=1 means the linker is command line compatible with GNU ld. -set_config("GCC_USE_GNU_LD", gcc_use_gnu_ld) -add_old_configure_assignment("GCC_USE_GNU_LD", gcc_use_gnu_ld) +set_config('GCC_USE_GNU_LD', gcc_use_gnu_ld) +add_old_configure_assignment('GCC_USE_GNU_LD', gcc_use_gnu_ld) # Assembler detection # ============================================================== -option(env="AS", nargs=1, help="Path to the assembler") - +option(env='AS', nargs=1, help='Path to the assembler') @depends(target, c_compiler) def as_info(target, c_compiler): - if c_compiler.type == "clang-cl": + if c_compiler.type == 'clang-cl': ml = { - "x86": "ml.exe", - "x86_64": "ml64.exe", - "aarch64": "armasm64.exe", + 'x86': 'ml.exe', + 'x86_64': 'ml64.exe', + 'aarch64': 'armasm64.exe', }.get(target.cpu) - return namespace(type="masm", names=(ml,)) + return namespace( + type='masm', + names=(ml, ) + ) # When building with anything but clang-cl, we just use the C compiler as the assembler. - return namespace(type="gcc", names=(c_compiler.compiler,)) - + return namespace( + type='gcc', + names=(c_compiler.compiler, ) + ) # One would expect the assembler to be specified merely as a program. But in # cases where the assembler is passed down into js/, it can be specified in @@ -2465,176 +2200,152 @@ def as_info(target, c_compiler): # permit the same behavior in general, even though it seems somewhat unusual. # So we have to do the same sort of dance as we did above with # `provided_compiler`. -provided_assembler = provided_program("AS") -assembler = check_prog( - "_AS", - input=provided_assembler.program, - what="the assembler", - progs=as_info.names, - paths=toolchain_search_path, -) - +provided_assembler = provided_program('AS') +assembler = check_prog('_AS', input=provided_assembler.program, + what='the assembler', progs=as_info.names, + paths=toolchain_search_path) @depends(as_info, assembler, provided_assembler, c_compiler) def as_with_flags(as_info, assembler, provided_assembler, c_compiler): if provided_assembler: - return provided_assembler.wrapper + [assembler] + provided_assembler.flags + return provided_assembler.wrapper + \ + [assembler] + \ + provided_assembler.flags - if as_info.type == "masm": + if as_info.type == 'masm': return assembler - assert as_info.type == "gcc" + assert as_info.type == 'gcc' # Need to add compiler wrappers and flags as appropriate. return c_compiler.wrapper + [assembler] + c_compiler.flags -add_old_configure_assignment("AS", as_with_flags) -add_old_configure_assignment("ac_cv_prog_AS", as_with_flags) +add_old_configure_assignment('AS', as_with_flags) +add_old_configure_assignment('ac_cv_prog_AS', as_with_flags) @depends(assembler, c_compiler, extra_toolchain_flags) -@imports("subprocess") -@imports(_from="os", _import="devnull") +@imports('subprocess') +@imports(_from='os', _import='devnull') def gnu_as(assembler, c_compiler, toolchain_flags): # clang uses a compatible GNU assembler. - if c_compiler.type == "clang": + if c_compiler.type == 'clang': return True - if c_compiler.type == "gcc": + if c_compiler.type == 'gcc': cmd = [assembler] + c_compiler.flags if toolchain_flags: cmd += toolchain_flags - cmd += ["-Wa,--version", "-c", "-o", devnull, "-x", "assembler", "-"] + cmd += ['-Wa,--version', '-c', '-o', devnull, '-x', 'assembler', '-'] # We don't actually have to provide any input on stdin, `Popen.communicate` will # close the stdin pipe. # clang will error if it uses its integrated assembler for this target, # so handle failures gracefully. - if "GNU" in check_cmd_output(*cmd, stdin=subprocess.PIPE, onerror=lambda: ""): + if 'GNU' in check_cmd_output(*cmd, stdin=subprocess.PIPE, onerror=lambda: ''): return True -set_config("GNU_AS", gnu_as) -add_old_configure_assignment("GNU_AS", gnu_as) +set_config('GNU_AS', gnu_as) +add_old_configure_assignment('GNU_AS', gnu_as) @depends(as_info, target) def as_dash_c_flag(as_info, target): # armasm64 doesn't understand -c. - if as_info.type == "masm" and target.cpu == "aarch64": - return "" + if as_info.type == 'masm' and target.cpu == 'aarch64': + return '' else: - return "-c" + return '-c' -set_config("AS_DASH_C_FLAG", as_dash_c_flag) +set_config('AS_DASH_C_FLAG', as_dash_c_flag) @depends(as_info, target) def as_outoption(as_info, target): # The uses of ASOUTOPTION depend on the spacing for -o/-Fo. - if as_info.type == "masm" and target.cpu != "aarch64": - return "-Fo" + if as_info.type == 'masm' and target.cpu != 'aarch64': + return '-Fo' - return "-o " + return '-o ' -set_config("ASOUTOPTION", as_outoption) +set_config('ASOUTOPTION', as_outoption) # clang plugin handling # ============================================================== -option( - "--enable-clang-plugin", - env="ENABLE_CLANG_PLUGIN", - help="Enable building with the Clang plugin (gecko specific static analyzers)", -) +option('--enable-clang-plugin', env='ENABLE_CLANG_PLUGIN', + help="Enable building with the Clang plugin (gecko specific static analyzers)") -add_old_configure_assignment( - "ENABLE_CLANG_PLUGIN", depends_if("--enable-clang-plugin")(lambda _: True) -) +add_old_configure_assignment('ENABLE_CLANG_PLUGIN', + depends_if('--enable-clang-plugin')(lambda _: True)) - -@depends(host_c_compiler, c_compiler, when="--enable-clang-plugin") +@depends(host_c_compiler, c_compiler, when='--enable-clang-plugin') def llvm_config(host_c_compiler, c_compiler): clang = None for compiler in (host_c_compiler, c_compiler): - if compiler and compiler.type == "clang": + if compiler and compiler.type == 'clang': clang = compiler.compiler break - elif compiler and compiler.type == "clang-cl": - clang = os.path.join(os.path.dirname(compiler.compiler), "clang") + elif compiler and compiler.type == 'clang-cl': + clang = os.path.join(os.path.dirname(compiler.compiler), 'clang') break if not clang: - die("Cannot --enable-clang-plugin when not building with clang") - llvm_config = "llvm-config" - out = check_cmd_output(clang, "--print-prog-name=llvm-config", onerror=lambda: None) + die('Cannot --enable-clang-plugin when not building with clang') + llvm_config = 'llvm-config' + out = check_cmd_output(clang, '--print-prog-name=llvm-config', + onerror=lambda: None) if out: llvm_config = out.rstrip() return (llvm_config,) -llvm_config = check_prog( - "LLVM_CONFIG", - llvm_config, - what="llvm-config", - when="--enable-clang-plugin", - paths=toolchain_search_path, -) - -add_old_configure_assignment("LLVM_CONFIG", llvm_config) +llvm_config = check_prog('LLVM_CONFIG', llvm_config, what='llvm-config', + when='--enable-clang-plugin', + paths=toolchain_search_path) +add_old_configure_assignment('LLVM_CONFIG', llvm_config) -option( - "--enable-clang-plugin-alpha", - env="ENABLE_CLANG_PLUGIN_ALPHA", - help="Enable static analysis with clang-plugin alpha checks.", -) +option('--enable-clang-plugin-alpha', env='ENABLE_CLANG_PLUGIN_ALPHA', + help='Enable static analysis with clang-plugin alpha checks.') -@depends("--enable-clang-plugin", "--enable-clang-plugin-alpha") +@depends('--enable-clang-plugin', '--enable-clang-plugin-alpha') def check_clang_plugin_alpha(enable_clang_plugin, enable_clang_plugin_alpha): if enable_clang_plugin_alpha: if enable_clang_plugin: return True die("Cannot enable clang-plugin alpha checkers without --enable-clang-plugin.") +add_old_configure_assignment('ENABLE_CLANG_PLUGIN_ALPHA', check_clang_plugin_alpha) +set_define('MOZ_CLANG_PLUGIN_ALPHA', check_clang_plugin_alpha) -add_old_configure_assignment("ENABLE_CLANG_PLUGIN_ALPHA", check_clang_plugin_alpha) -set_define("MOZ_CLANG_PLUGIN_ALPHA", check_clang_plugin_alpha) +option('--enable-mozsearch-plugin', env='ENABLE_MOZSEARCH_PLUGIN', + help="Enable building with the mozsearch indexer plugin") -option( - "--enable-mozsearch-plugin", - env="ENABLE_MOZSEARCH_PLUGIN", - help="Enable building with the mozsearch indexer plugin", -) - -add_old_configure_assignment( - "ENABLE_MOZSEARCH_PLUGIN", depends_if("--enable-mozsearch-plugin")(lambda _: True) -) +add_old_configure_assignment('ENABLE_MOZSEARCH_PLUGIN', + depends_if('--enable-mozsearch-plugin')(lambda _: True)) # Libstdc++ compatibility hacks # ============================================================== # -option( - "--enable-stdcxx-compat", - env="MOZ_STDCXX_COMPAT", - help="Enable compatibility with older libstdc++", -) +option('--enable-stdcxx-compat', env='MOZ_STDCXX_COMPAT', + help='Enable compatibility with older libstdc++') @template def libstdcxx_version(var, compiler): - @depends(compiler, when="--enable-stdcxx-compat") + @depends(compiler, when='--enable-stdcxx-compat') @checking(var, lambda v: v and "GLIBCXX_%s" % v.dotted) - @imports(_from="mozbuild.configure.libstdcxx", _import="find_version") - @imports(_from="__builtin__", _import="Exception") + @imports(_from='mozbuild.configure.libstdcxx', _import='find_version') + @imports(_from='__builtin__', _import='Exception') def version(compiler): try: result = find_version( - compiler.wrapper + [compiler.compiler] + compiler.flags - ) + compiler.wrapper + [compiler.compiler] + compiler.flags) except Exception: die("Couldn't determine libstdc++ version") if result: @@ -2648,70 +2359,61 @@ def libstdcxx_version(var, compiler): add_gcc_flag( - "-D_GLIBCXX_USE_CXX11_ABI=0", - cxx_compiler, - when=libstdcxx_version("MOZ_LIBSTDCXX_TARGET_VERSION", cxx_compiler), -) + '-D_GLIBCXX_USE_CXX11_ABI=0', cxx_compiler, + when=libstdcxx_version( + 'MOZ_LIBSTDCXX_TARGET_VERSION', cxx_compiler)) add_gcc_flag( - "-D_GLIBCXX_USE_CXX11_ABI=0", - host_cxx_compiler, - when=libstdcxx_version("MOZ_LIBSTDCXX_HOST_VERSION", host_cxx_compiler), -) + '-D_GLIBCXX_USE_CXX11_ABI=0', host_cxx_compiler, + when=libstdcxx_version( + 'MOZ_LIBSTDCXX_HOST_VERSION', host_cxx_compiler)) # Support various fuzzing options # ============================================================== -option("--enable-fuzzing", help="Enable fuzzing support") - +option('--enable-fuzzing', help='Enable fuzzing support') -@depends("--enable-fuzzing") +@depends('--enable-fuzzing') def enable_fuzzing(value): if value: return True - -@depends( - try_compile( - body="__AFL_COMPILER;", check_msg="for AFL compiler", when="--enable-fuzzing" - ) -) +@depends(try_compile(body='__AFL_COMPILER;', + check_msg='for AFL compiler', + when='--enable-fuzzing')) def enable_aflfuzzer(afl): if afl: return True - -@depends(enable_fuzzing, enable_aflfuzzer, c_compiler, target) +@depends(enable_fuzzing, + enable_aflfuzzer, + c_compiler, + target) def enable_libfuzzer(fuzzing, afl, c_compiler, target): - if fuzzing and not afl and c_compiler.type == "clang" and target.os != "Android": + if fuzzing and not afl and c_compiler.type == 'clang' and target.os != 'Android': return True - -@depends(enable_fuzzing, enable_aflfuzzer, enable_libfuzzer) +@depends(enable_fuzzing, + enable_aflfuzzer, + enable_libfuzzer) def enable_fuzzing_interfaces(fuzzing, afl, libfuzzer): if fuzzing and (afl or libfuzzer): return True +set_config('FUZZING', enable_fuzzing) +set_define('FUZZING', enable_fuzzing) -set_config("FUZZING", enable_fuzzing) -set_define("FUZZING", enable_fuzzing) - -set_config("LIBFUZZER", enable_libfuzzer) -set_define("LIBFUZZER", enable_libfuzzer) -add_old_configure_assignment("LIBFUZZER", enable_libfuzzer) +set_config('LIBFUZZER', enable_libfuzzer) +set_define('LIBFUZZER', enable_libfuzzer) +add_old_configure_assignment('LIBFUZZER', enable_libfuzzer) -set_config("FUZZING_INTERFACES", enable_fuzzing_interfaces) -set_define("FUZZING_INTERFACES", enable_fuzzing_interfaces) -add_old_configure_assignment("FUZZING_INTERFACES", enable_fuzzing_interfaces) +set_config('FUZZING_INTERFACES', enable_fuzzing_interfaces) +set_define('FUZZING_INTERFACES', enable_fuzzing_interfaces) +add_old_configure_assignment('FUZZING_INTERFACES', enable_fuzzing_interfaces) -@depends( - c_compiler.try_compile( - flags=["-fsanitize=fuzzer-no-link"], - when=enable_fuzzing, - check_msg="whether the C compiler supports -fsanitize=fuzzer-no-link", - ), - tsan, -) +@depends(c_compiler.try_compile(flags=['-fsanitize=fuzzer-no-link'], + when=enable_fuzzing, + check_msg='whether the C compiler supports -fsanitize=fuzzer-no-link'), tsan) def libfuzzer_flags(value, tsan): if tsan: # With ThreadSanitizer, we should not use any libFuzzer instrumentation because @@ -2725,20 +2427,19 @@ def libfuzzer_flags(value, tsan): if value: no_link_flag_supported = True # recommended for (and only supported by) clang >= 6 - use_flags = ["-fsanitize=fuzzer-no-link"] + use_flags = ['-fsanitize=fuzzer-no-link'] else: no_link_flag_supported = False - use_flags = ["-fsanitize-coverage=trace-pc-guard,trace-cmp"] + use_flags = ['-fsanitize-coverage=trace-pc-guard,trace-cmp'] return namespace( no_link_flag_supported=no_link_flag_supported, use_flags=use_flags, ) - -set_config("HAVE_LIBFUZZER_FLAG_FUZZER_NO_LINK", libfuzzer_flags.no_link_flag_supported) -set_config("LIBFUZZER_FLAGS", libfuzzer_flags.use_flags) -add_old_configure_assignment("LIBFUZZER_FLAGS", libfuzzer_flags.use_flags) +set_config('HAVE_LIBFUZZER_FLAG_FUZZER_NO_LINK', libfuzzer_flags.no_link_flag_supported) +set_config('LIBFUZZER_FLAGS', libfuzzer_flags.use_flags) +add_old_configure_assignment('LIBFUZZER_FLAGS', libfuzzer_flags.use_flags) # Shared library building # ============================================================== @@ -2746,56 +2447,43 @@ add_old_configure_assignment("LIBFUZZER_FLAGS", libfuzzer_flags.use_flags) # XXX: The use of makefile constructs in these variables is awful. @depends(target, c_compiler) def make_shared_library(target, compiler): - if target.os == "WINNT": - if compiler.type == "gcc": + if target.os == 'WINNT': + if compiler.type == 'gcc': return namespace( - mkshlib=["$(CXX)", "$(DSO_LDOPTS)", "-o", "$@"], - mkcshlib=["$(CC)", "$(DSO_LDOPTS)", "-o", "$@"], + mkshlib=['$(CXX)', '$(DSO_LDOPTS)', '-o', '$@'], + mkcshlib=['$(CC)', '$(DSO_LDOPTS)', '-o', '$@'], ) - elif compiler.type == "clang": + elif compiler.type == 'clang': return namespace( - mkshlib=[ - "$(CXX)", - "$(DSO_LDOPTS)", - "-Wl,-pdb,$(LINK_PDBFILE)", - "-o", - "$@", - ], - mkcshlib=[ - "$(CC)", - "$(DSO_LDOPTS)", - "-Wl,-pdb,$(LINK_PDBFILE)", - "-o", - "$@", - ], + mkshlib=['$(CXX)', '$(DSO_LDOPTS)', '-Wl,-pdb,$(LINK_PDBFILE)', '-o', '$@'], + mkcshlib=['$(CC)', '$(DSO_LDOPTS)', '-Wl,-pdb,$(LINK_PDBFILE)', '-o', '$@'], ) else: linker = [ - "$(LINKER)", - "-NOLOGO", - "-DLL", - "-OUT:$@", - "-PDB:$(LINK_PDBFILE)", - "$(DSO_LDOPTS)", + '$(LINKER)', + '-NOLOGO', '-DLL', + '-OUT:$@', + '-PDB:$(LINK_PDBFILE)', + '$(DSO_LDOPTS)' ] return namespace( mkshlib=linker, mkcshlib=linker, ) - cc = ["$(CC)", "$(COMPUTED_C_LDFLAGS)"] - cxx = ["$(CXX)", "$(COMPUTED_CXX_LDFLAGS)"] - flags = ["$(PGO_CFLAGS)", "$(DSO_PIC_CFLAGS)", "$(DSO_LDOPTS)"] - output = ["-o", "$@"] + cc = ['$(CC)', '$(COMPUTED_C_LDFLAGS)'] + cxx = ['$(CXX)', '$(COMPUTED_CXX_LDFLAGS)'] + flags = ['$(PGO_CFLAGS)', '$(DSO_PIC_CFLAGS)', '$(DSO_LDOPTS)'] + output = ['-o', '$@'] - if target.kernel == "Darwin": + if target.kernel == 'Darwin': soname = [] - elif target.os == "NetBSD": - soname = ["-Wl,-soname,$(DSO_SONAME)"] + elif target.os == 'NetBSD': + soname = ['-Wl,-soname,$(DSO_SONAME)'] else: - assert compiler.type in ("gcc", "clang") + assert compiler.type in ('gcc', 'clang') - soname = ["-Wl,-h,$(DSO_SONAME)"] + soname = ['-Wl,-h,$(DSO_SONAME)'] return namespace( mkshlib=cxx + flags + soname + output, @@ -2803,47 +2491,49 @@ def make_shared_library(target, compiler): ) -set_config("MKSHLIB", make_shared_library.mkshlib) -set_config("MKCSHLIB", make_shared_library.mkcshlib) +set_config('MKSHLIB', make_shared_library.mkshlib) +set_config('MKCSHLIB', make_shared_library.mkcshlib) @depends(c_compiler, toolchain_prefix, when=target_is_windows) def rc_names(c_compiler, toolchain_prefix): - if c_compiler.type in ("gcc", "clang"): - return tuple("%s%s" % (p, "windres") for p in ("",) + (toolchain_prefix or ())) - return ("llvm-rc",) + if c_compiler.type in ('gcc', 'clang'): + return tuple('%s%s' % (p, 'windres') + for p in ('',) + (toolchain_prefix or ())) + return ('llvm-rc',) -check_prog("RC", rc_names, paths=toolchain_search_path, when=target_is_windows) +check_prog('RC', rc_names, paths=toolchain_search_path, when=target_is_windows) @depends(link, toolchain_prefix, c_compiler) def ar_config(link, toolchain_prefix, c_compiler): - if c_compiler.type == "clang-cl" and link: + if c_compiler.type == 'clang-cl' and link: # if LINKER is set, it's either for lld-link or link - if "lld-link" in link: + if 'lld-link' in link: return namespace( - names=("llvm-lib",), - flags=("-llvmlibthin", "-out:$@"), + names=('llvm-lib',), + flags=('-llvmlibthin', '-out:$@'), ) else: return namespace( - names=("lib",), - flags=("-NOLOGO", "-OUT:$@"), + names=('lib',), + flags=('-NOLOGO', '-OUT:$@'), ) return namespace( - names=tuple("%s%s" % (p, "ar") for p in (toolchain_prefix or ()) + ("",)), - flags=("crs", "$@"), + names=tuple('%s%s' % (p, 'ar') + for p in (toolchain_prefix or ()) + ('',)), + flags=('crs', '$@'), ) -ar = check_prog("AR", ar_config.names, paths=toolchain_search_path) +ar = check_prog('AR', ar_config.names, paths=toolchain_search_path) -add_old_configure_assignment("AR", ar) +add_old_configure_assignment('AR', ar) -set_config("AR_FLAGS", ar_config.flags) +set_config('AR_FLAGS', ar_config.flags) -option("--enable-cpp-rtti", help="Enable C++ RTTI") +option('--enable-cpp-rtti', help='Enable C++ RTTI') -add_old_configure_assignment("_MOZ_USE_RTTI", "1", when="--enable-cpp-rtti") +add_old_configure_assignment('_MOZ_USE_RTTI', '1', when='--enable-cpp-rtti') diff --git a/build/moz.configure/update-programs.configure b/build/moz.configure/update-programs.configure index d5a75b9ac8eb..e3bb7b464295 100644 --- a/build/moz.configure/update-programs.configure +++ b/build/moz.configure/update-programs.configure @@ -7,55 +7,43 @@ # Verify MAR signatures # ============================================================== -option("--disable-verify-mar", help="Disable verifying MAR signatures") +option('--disable-verify-mar', help='Disable verifying MAR signatures') -set_define( - "MOZ_VERIFY_MAR_SIGNATURE", depends_if("--enable-verify-mar")(lambda _: True) -) -set_config( - "MOZ_VERIFY_MAR_SIGNATURE", depends_if("--enable-verify-mar")(lambda _: True) -) +set_define('MOZ_VERIFY_MAR_SIGNATURE', + depends_if('--enable-verify-mar')(lambda _: True)) +set_config('MOZ_VERIFY_MAR_SIGNATURE', + depends_if('--enable-verify-mar')(lambda _: True)) # Maintenance service (Windows only) # ============================================================== -option( - "--enable-maintenance-service", - when=target_is_windows, - default=target_is_windows, - help="{Enable|Disable} building of maintenance service", -) - -set_define( - "MOZ_MAINTENANCE_SERVICE", - depends_if("--enable-maintenance-service", when=target_is_windows)(lambda _: True), -) -set_config( - "MOZ_MAINTENANCE_SERVICE", - depends_if("--enable-maintenance-service", when=target_is_windows)(lambda _: True), -) +option('--enable-maintenance-service', + when=target_is_windows, default=target_is_windows, + help='{Enable|Disable} building of maintenance service') + +set_define('MOZ_MAINTENANCE_SERVICE', + depends_if('--enable-maintenance-service', + when=target_is_windows)(lambda _: True)) +set_config('MOZ_MAINTENANCE_SERVICE', + depends_if('--enable-maintenance-service', + when=target_is_windows)(lambda _: True)) # Update agent (currently Windows only) # This is an independent task that runs on a schedule to # check for, download, and install updates. # ============================================================== -option( - "--enable-update-agent", - when=target_is_windows, - default=False, - help="{Enable|Disable} building update agent", -) +option('--enable-update-agent', + when=target_is_windows, default=False, + help='{Enable|Disable} building update agent') -set_define( - "MOZ_UPDATE_AGENT", - depends_if("--enable-update-agent", when=target_is_windows)(lambda _: True), -) +set_define('MOZ_UPDATE_AGENT', + depends_if('--enable-update-agent', + when=target_is_windows)(lambda _: True)) -set_config( - "MOZ_UPDATE_AGENT", - depends_if("--enable-update-agent", when=target_is_windows)(lambda _: True), -) +set_config('MOZ_UPDATE_AGENT', + depends_if('--enable-update-agent', + when=target_is_windows)(lambda _: True)) # Enable or disable the default browser agent, which monitors the user's default # browser setting on Windows. @@ -64,20 +52,17 @@ set_config( @depends(target) def default_browser_agent_default(target): - return target.os == "WINNT" + return target.os == 'WINNT' -option( - "--enable-default-browser-agent", - default=default_browser_agent_default, - help="{Enable|Disable} building the default browser agent", -) +option('--enable-default-browser-agent', default=default_browser_agent_default, + help='{Enable|Disable} building the default browser agent') -@depends("--enable-default-browser-agent", when=target_is_windows) +@depends('--enable-default-browser-agent', when=target_is_windows) def default_agent_flag(enabled): if enabled: return True -set_config("MOZ_DEFAULT_BROWSER_AGENT", default_agent_flag) +set_config('MOZ_DEFAULT_BROWSER_AGENT', default_agent_flag) diff --git a/build/moz.configure/util.configure b/build/moz.configure/util.configure index fe82698c620b..7ee1a498ad8c 100644 --- a/build/moz.configure/util.configure +++ b/build/moz.configure/util.configure @@ -5,51 +5,45 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. -@imports("sys") +@imports('sys') def die(*args): - "Print an error and terminate configure." + 'Print an error and terminate configure.' log.error(*args) sys.exit(1) -@imports(_from="mozbuild.configure", _import="ConfigureError") +@imports(_from='mozbuild.configure', _import='ConfigureError') def configure_error(message): - """Raise a programming error and terminate configure. + '''Raise a programming error and terminate configure. Primarily for use in moz.configure templates to sanity check - their inputs from moz.configure usage.""" + their inputs from moz.configure usage.''' raise ConfigureError(message) # A wrapper to obtain a process' output and return code. # Returns a tuple (retcode, stdout, stderr). -@imports("os") -@imports("six") -@imports("subprocess") -@imports(_from="mozbuild.shellutil", _import="quote") -@imports(_from="mozbuild.util", _import="system_encoding") +@imports('os') +@imports('six') +@imports('subprocess') +@imports(_from='mozbuild.shellutil', _import='quote') +@imports(_from='mozbuild.util', _import='system_encoding') def get_cmd_output(*args, **kwargs): - log.debug("Executing: `%s`", quote(*args)) + log.debug('Executing: `%s`', quote(*args)) proc = subprocess.Popen( - args, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, # On Python 2 on Windows, close_fds prevents the process from inheriting # stdout/stderr. Elsewhere, it simply prevents it from inheriting extra # file descriptors, which is what we want. - close_fds=os.name != "nt", - **kwargs - ) + close_fds=os.name != 'nt', **kwargs) stdout, stderr = proc.communicate() # Normally we would set the `encoding` and `errors` arguments in the # constructor to subprocess.Popen, but those arguments were added in 3.6 # and we need to support back to 3.5, so instead we need to do this # nonsense. - stdout = six.ensure_text( - stdout, encoding=system_encoding, errors="replace" - ).replace("\r\n", "\n") - stderr = six.ensure_text( - stderr, encoding=system_encoding, errors="replace" - ).replace("\r\n", "\n") + stdout = six.ensure_text(stdout, encoding=system_encoding, + errors='replace').replace('\r\n', '\n') + stderr = six.ensure_text(stderr, encoding=system_encoding, + errors='replace').replace('\r\n', '\n') return proc.wait(), stdout, stderr @@ -57,83 +51,87 @@ def get_cmd_output(*args, **kwargs): # by running the given command if it exits normally, and streams that # output to log.debug and calls die or the given error callback if it # does not. -@imports(_from="mozbuild.configure.util", _import="LineIO") -@imports(_from="mozbuild.shellutil", _import="quote") +@imports(_from='mozbuild.configure.util', _import='LineIO') +@imports(_from='mozbuild.shellutil', _import='quote') def check_cmd_output(*args, **kwargs): - onerror = kwargs.pop("onerror", None) + onerror = kwargs.pop('onerror', None) with log.queue_debug(): retcode, stdout, stderr = get_cmd_output(*args, **kwargs) if retcode == 0: return stdout - log.debug("The command returned non-zero exit status %d.", retcode) - for out, desc in ((stdout, "output"), (stderr, "error output")): + log.debug('The command returned non-zero exit status %d.', + retcode) + for out, desc in ((stdout, 'output'), (stderr, 'error output')): if out: - log.debug("Its %s was:", desc) - with LineIO(lambda l: log.debug("| %s", l)) as o: + log.debug('Its %s was:', desc) + with LineIO(lambda l: log.debug('| %s', l)) as o: o.write(out) if onerror: return onerror() - die("Command `%s` failed with exit status %d." % (quote(*args), retcode)) + die('Command `%s` failed with exit status %d.' % + (quote(*args), retcode)) -@imports("os") +@imports('os') def is_absolute_or_relative(path): if os.altsep and os.altsep in path: return True return os.sep in path -@imports(_import="mozpack.path", _as="mozpath") +@imports(_import='mozpack.path', _as='mozpath') def normsep(path): return mozpath.normsep(path) -@imports("ctypes") -@imports(_from="ctypes", _import="wintypes") -@imports(_from="mozbuild.configure.constants", _import="WindowsBinaryType") +@imports('ctypes') +@imports(_from='ctypes', _import='wintypes') +@imports(_from='mozbuild.configure.constants', _import='WindowsBinaryType') def windows_binary_type(path): """Obtain the type of a binary on Windows. Returns WindowsBinaryType constant. """ GetBinaryTypeW = ctypes.windll.kernel32.GetBinaryTypeW - GetBinaryTypeW.argtypes = [wintypes.LPWSTR, ctypes.POINTER(wintypes.DWORD)] + GetBinaryTypeW.argtypes = [wintypes.LPWSTR, + ctypes.POINTER(wintypes.DWORD)] GetBinaryTypeW.restype = wintypes.BOOL bin_type = wintypes.DWORD() res = GetBinaryTypeW(path, ctypes.byref(bin_type)) if not res: - die("could not obtain binary type of %s" % path) + die('could not obtain binary type of %s' % path) if bin_type.value == 0: - return WindowsBinaryType("win32") + return WindowsBinaryType('win32') elif bin_type.value == 6: - return WindowsBinaryType("win64") + return WindowsBinaryType('win64') # If we see another binary type, something is likely horribly wrong. else: - die("unsupported binary type on %s: %s" % (path, bin_type)) + die('unsupported binary type on %s: %s' % (path, bin_type)) -@imports("ctypes") -@imports(_from="ctypes", _import="wintypes") +@imports('ctypes') +@imports(_from='ctypes', _import='wintypes') def get_GetShortPathNameW(): GetShortPathNameW = ctypes.windll.kernel32.GetShortPathNameW - GetShortPathNameW.argtypes = [wintypes.LPCWSTR, wintypes.LPWSTR, wintypes.DWORD] + GetShortPathNameW.argtypes = [wintypes.LPCWSTR, wintypes.LPWSTR, + wintypes.DWORD] GetShortPathNameW.restype = wintypes.DWORD return GetShortPathNameW @template -@imports("ctypes") -@imports("platform") -@imports(_from="mozbuild.shellutil", _import="quote") +@imports('ctypes') +@imports('platform') +@imports(_from='mozbuild.shellutil', _import='quote') def normalize_path(): # Until the build system can properly handle programs that need quoting, # transform those paths into their short version on Windows (e.g. # c:\PROGRA~1...). - if platform.system() == "Windows": + if platform.system() == 'Windows': GetShortPathNameW = get_GetShortPathNameW() def normalize_path(path): @@ -145,20 +143,17 @@ def normalize_path(): out = ctypes.create_unicode_buffer(size) needed = GetShortPathNameW(path, out, size) if size >= needed: - if " " in out.value: - die( - "GetShortPathName returned a long path name: `%s`. " + if ' ' in out.value: + die("GetShortPathName returned a long path name: `%s`. " "Use `fsutil file setshortname' " "to create a short name " "for any components of this path " "that have spaces.", - out.value, - ) + out.value) return normsep(out.value) size = needed else: - def normalize_path(path): return normsep(path) @@ -172,10 +167,10 @@ normalize_path = normalize_path() # exists. # The `paths` parameter may be passed to search the given paths instead of # $PATH. -@imports("sys") -@imports(_from="os", _import="pathsep") -@imports(_from="os", _import="environ") -@imports(_from="mozfile", _import="which") +@imports('sys') +@imports(_from='os', _import='pathsep') +@imports(_from='os', _import='environ') +@imports(_from='mozfile', _import='which') def find_program(file, paths=None): # The following snippet comes from `which` itself, with a slight # modification to use lowercase extensions, because it's confusing rustup @@ -183,11 +178,12 @@ def find_program(file, paths=None): # Windows has the concept of a list of extensions (PATHEXT env var). if sys.platform.startswith("win"): - exts = [e.lower() for e in environ.get("PATHEXT", "").split(pathsep)] + exts = [e.lower() + for e in environ.get("PATHEXT", "").split(pathsep)] # If '.exe' is not in exts then obviously this is Win9x and # or a bogus PATHEXT, then use a reasonable default. - if ".exe" not in exts: - exts = [".com", ".exe", ".bat"] + if '.exe' not in exts: + exts = ['.com', '.exe', '.bat'] else: exts = None @@ -197,43 +193,42 @@ def find_program(file, paths=None): if paths: if not isinstance(paths, (list, tuple)): - die( - "Paths provided to find_program must be a list of strings, " "not %r", - paths, - ) + die("Paths provided to find_program must be a list of strings, " + "not %r", paths) paths = pathsep.join(paths) path = which(file, path=paths, exts=exts) return normalize_path(path) if path else None -@imports("os") -@imports(_from="mozbuild.configure.util", _import="LineIO") -@imports(_from="six", _import="ensure_binary") -@imports(_from="tempfile", _import="mkstemp") +@imports('os') +@imports(_from='mozbuild.configure.util', _import='LineIO') +@imports(_from='six', _import='ensure_binary') +@imports(_from='tempfile', _import='mkstemp') def try_invoke_compiler(compiler, language, source, flags=None, onerror=None): flags = flags or [] if not isinstance(flags, (list, tuple)): - die("Flags provided to try_compile must be a list of strings, " "not %r", flags) + die("Flags provided to try_compile must be a list of strings, " + "not %r", flags) suffix = { - "C": ".c", - "C++": ".cpp", + 'C': '.c', + 'C++': '.cpp', }[language] - fd, path = mkstemp(prefix="conftest.", suffix=suffix, text=True) + fd, path = mkstemp(prefix='conftest.', suffix=suffix, text=True) try: - source = source.encode("ascii", "replace") + source = source.encode('ascii', 'replace') - log.debug("Creating `%s` with content:", path) - with LineIO(lambda l: log.debug("| %s", l)) as out: + log.debug('Creating `%s` with content:', path) + with LineIO(lambda l: log.debug('| %s', l)) as out: out.write(source) os.write(fd, ensure_binary(source)) os.close(fd) cmd = compiler + [path] + list(flags) - kwargs = {"onerror": onerror} + kwargs = {'onerror': onerror} return check_cmd_output(*cmd, **kwargs) finally: os.remove(path) @@ -293,9 +288,9 @@ def unique_list(l): # ('19.0', 'arm', r'C:\...\amd64_arm\cl.exe') # ('19.0', 'x64', r'C:\...\amd64\cl.exe') # ('19.0', 'x86', r'C:\...\amd64_x86\cl.exe') -@imports(_import="winreg") -@imports(_from="__builtin__", _import="WindowsError") -@imports(_from="fnmatch", _import="fnmatch") +@imports(_import='winreg') +@imports(_from='__builtin__', _import='WindowsError') +@imports(_from='fnmatch', _import='fnmatch') def get_registry_values(pattern, get_32_and_64_bit=False): def enum_helper(func, key): i = 0 @@ -308,7 +303,7 @@ def get_registry_values(pattern, get_32_and_64_bit=False): def get_keys(key, pattern, access_mask): try: - s = winreg.OpenKey(key, "\\".join(pattern[:-1]), 0, access_mask) + s = winreg.OpenKey(key, '\\'.join(pattern[:-1]), 0, access_mask) except WindowsError: return for k in enum_helper(winreg.EnumKey, s): @@ -320,7 +315,7 @@ def get_registry_values(pattern, get_32_and_64_bit=False): def get_values(key, pattern, access_mask): try: - s = winreg.OpenKey(key, "\\".join(pattern[:-1]), 0, access_mask) + s = winreg.OpenKey(key, '\\'.join(pattern[:-1]), 0, access_mask) except WindowsError: return for k, v, t in enum_helper(winreg.EnumValue, s): @@ -331,7 +326,7 @@ def get_registry_values(pattern, get_32_and_64_bit=False): subpattern = [] for p in pattern: subpattern.append(p) - if "*" in p: + if '*' in p: yield subpattern subpattern = [] if subpattern: @@ -344,7 +339,7 @@ def get_registry_values(pattern, get_32_and_64_bit=False): matches = base_key[:-1] base_key = base_key[-1] if i == len(pattern) - 1: - want_name = "*" in p[-1] + want_name = '*' in p[-1] for name, value in get_values(base_key, p, access_mask): yield matches + ((name, value) if want_name else (value,)) else: @@ -352,30 +347,25 @@ def get_registry_values(pattern, get_32_and_64_bit=False): next_keys.append(matches + (name, k)) keys = next_keys - pattern = pattern.split("\\") - assert pattern[0].startswith("HKEY_") + pattern = pattern.split('\\') + assert pattern[0].startswith('HKEY_') keys = [(getattr(winreg, pattern[0]),)] pattern = list(split_pattern(pattern[1:])) if get_32_and_64_bit: - for match in get_all_values( - keys, pattern, winreg.KEY_READ | winreg.KEY_WOW64_32KEY - ): + for match in get_all_values(keys, pattern, winreg.KEY_READ | winreg.KEY_WOW64_32KEY): yield match - for match in get_all_values( - keys, pattern, winreg.KEY_READ | winreg.KEY_WOW64_64KEY - ): + for match in get_all_values(keys, pattern, winreg.KEY_READ | winreg.KEY_WOW64_64KEY): yield match else: for match in get_all_values(keys, pattern, winreg.KEY_READ): yield match -@imports(_from="mozbuild.configure.util", _import="Version", _as="_Version") +@imports(_from='mozbuild.configure.util', _import='Version', _as='_Version') def Version(v): - "A version number that can be compared usefully." + 'A version number that can be compared usefully.' return _Version(v) - # Denotes a deprecated option. Combines option() and @depends: # @deprecated_option('--option') # def option(value): @@ -388,23 +378,22 @@ def Version(v): @template def deprecated_option(*args, **kwargs): - assert "help" not in kwargs - kwargs["help"] = "Deprecated" + assert 'help' not in kwargs + kwargs['help'] = 'Deprecated' opt = option(*args, **kwargs) def decorator(func): @depends(opt.option) def deprecated(value): - if value.origin != "default": + if value.origin != 'default': return func(value) - return deprecated return decorator # from mozbuild.util import ReadOnlyNamespace as namespace -@imports(_from="mozbuild.util", _import="ReadOnlyNamespace") +@imports(_from='mozbuild.util', _import='ReadOnlyNamespace') def namespace(**kwargs): return ReadOnlyNamespace(**kwargs) @@ -413,8 +402,8 @@ def namespace(**kwargs): # The given object can be a literal value, a function that takes no argument, # or, for convenience, a @depends function. @template -@imports(_from="inspect", _import="isfunction") -@imports(_from="mozbuild.configure", _import="SandboxDependsFunction") +@imports(_from='inspect', _import='isfunction') +@imports(_from='mozbuild.configure', _import='SandboxDependsFunction') def dependable(obj): if isinstance(obj, SandboxDependsFunction): return obj @@ -422,7 +411,7 @@ def dependable(obj): return depends(when=True)(obj) # Depend on --help to make lint happy if the dependable is used as an input # to an option(). - return depends("--help", when=True)(lambda _: obj) + return depends('--help', when=True)(lambda _: obj) always = dependable(True) @@ -436,7 +425,7 @@ never = dependable(False) def depends_tmpl(eval_args_fn, *args, **kwargs): if kwargs: assert len(kwargs) == 1 - when = kwargs["when"] + when = kwargs['when'] else: when = None @@ -445,9 +434,7 @@ def depends_tmpl(eval_args_fn, *args, **kwargs): def wrapper(*args): if eval_args_fn(args): return func(*args) - return wrapper - return decorator @@ -468,7 +455,6 @@ def depends_all(*args, **kwargs): # Hacks related to old-configure # ============================== - @dependable def old_configure_assignments(): return [] @@ -480,14 +466,14 @@ def add_old_configure_assignment(var, value, when=None): value = dependable(value) @depends(old_configure_assignments, var, value, when=when) - @imports(_from="mozbuild.shellutil", _import="quote") + @imports(_from='mozbuild.shellutil', _import='quote') def add_assignment(assignments, var, value): if var is None or value is None: return if value is True: - assignments.append((var, "1")) + assignments.append((var, '1')) elif value is False: - assignments.append((var, "")) + assignments.append((var, '')) else: if isinstance(value, (list, tuple)): value = quote(*value) diff --git a/build/moz.configure/warnings.configure b/build/moz.configure/warnings.configure index b549bd57f722..1efd7155960e 100755 --- a/build/moz.configure/warnings.configure +++ b/build/moz.configure/warnings.configure @@ -4,44 +4,39 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -option( - "--enable-warnings-as-errors", - env="MOZ_ENABLE_WARNINGS_AS_ERRORS", - default=depends("MOZ_AUTOMATION")(lambda x: bool(x)), - help="{Enable|Disable} treating warnings as errors", -) +option('--enable-warnings-as-errors', env='MOZ_ENABLE_WARNINGS_AS_ERRORS', + default=depends('MOZ_AUTOMATION')(lambda x: bool(x)), + help='{Enable|Disable} treating warnings as errors') -@depends("--enable-warnings-as-errors") +@depends('--enable-warnings-as-errors') def rust_warning_flags(warnings_as_errors): flags = [] # Note that cargo passes --cap-lints warn to rustc for third-party code, so # we don't need a very complicated setup. if warnings_as_errors: - flags.append("-Dwarnings") + flags.append('-Dwarnings') else: - flags.extend(("--cap-lints", "warn")) + flags.extend(('--cap-lints', 'warn')) return flags +c_warning_flag = dependable('-Werror') -c_warning_flag = dependable("-Werror") - -@depends("--enable-warnings-as-errors", c_warning_flag) +@depends('--enable-warnings-as-errors', c_warning_flag) def warnings_as_errors(warnings_as_errors, c_warning_flag): if not warnings_as_errors: - return "" + return '' return c_warning_flag - -set_config("WARNINGS_AS_ERRORS", warnings_as_errors) +set_config('WARNINGS_AS_ERRORS', warnings_as_errors) # We have a peculiar setup in old-configure.in where some compilation tests # depend on enabling warnings-as-errors even if it's disabled for Firefox # compilation. We therefore need this assignment. -add_old_configure_assignment("WARNINGS_AS_ERRORS", c_warning_flag) +add_old_configure_assignment('WARNINGS_AS_ERRORS', c_warning_flag) # GCC/Clang warnings: @@ -49,70 +44,70 @@ add_old_configure_assignment("WARNINGS_AS_ERRORS", c_warning_flag) # https://clang.llvm.org/docs/DiagnosticsReference.html # lots of useful warnings -add_gcc_warning("-Wall") +add_gcc_warning('-Wall') # catch implicit truncation of enum values assigned to smaller bit fields -check_and_add_gcc_warning("-Wbitfield-enum-conversion") +check_and_add_gcc_warning('-Wbitfield-enum-conversion') # catches bugs, e.g. "if (c); foo();", few false positives -add_gcc_warning("-Wempty-body") +add_gcc_warning('-Wempty-body') # catches return types with qualifiers like const -add_gcc_warning("-Wignored-qualifiers") +add_gcc_warning('-Wignored-qualifiers') # function declaration hides virtual function from base class -add_gcc_warning("-Woverloaded-virtual", cxx_compiler) +add_gcc_warning('-Woverloaded-virtual', cxx_compiler) # catches pointer arithmetic using NULL or sizeof(void) -add_gcc_warning("-Wpointer-arith") +add_gcc_warning('-Wpointer-arith') # catch modifying constructor parameter that shadows member variable -check_and_add_gcc_warning("-Wshadow-field-in-constructor-modified") +check_and_add_gcc_warning('-Wshadow-field-in-constructor-modified') # catches comparing signed/unsigned ints -add_gcc_warning("-Wsign-compare") +add_gcc_warning('-Wsign-compare') # catches overflow bugs, few false positives -add_gcc_warning("-Wtype-limits") +add_gcc_warning('-Wtype-limits') # catches some dead code -add_gcc_warning("-Wunreachable-code") -check_and_add_gcc_warning("-Wunreachable-code-return") +add_gcc_warning('-Wunreachable-code') +check_and_add_gcc_warning('-Wunreachable-code-return') # catches treating string literals as non-const -add_gcc_warning("-Wwrite-strings", cxx_compiler) +add_gcc_warning('-Wwrite-strings', cxx_compiler) # turned on by -Wall, but we use offsetof on non-POD types frequently -add_gcc_warning("-Wno-invalid-offsetof", cxx_compiler) +add_gcc_warning('-Wno-invalid-offsetof', cxx_compiler) # catches objects passed by value to variadic functions. -check_and_add_gcc_warning("-Wclass-varargs") +check_and_add_gcc_warning('-Wclass-varargs') # catches empty if/switch/for initialization statements that have no effect -check_and_add_gcc_warning("-Wempty-init-stmt", cxx_compiler) +check_and_add_gcc_warning('-Wempty-init-stmt', cxx_compiler) # catches some implicit conversion of floats to ints -check_and_add_gcc_warning("-Wfloat-overflow-conversion") -check_and_add_gcc_warning("-Wfloat-zero-conversion") +check_and_add_gcc_warning('-Wfloat-overflow-conversion') +check_and_add_gcc_warning('-Wfloat-zero-conversion') # catches issues around loops -check_and_add_gcc_warning("-Wloop-analysis") +check_and_add_gcc_warning('-Wloop-analysis') # catches C++ version forward-compat issues -check_and_add_gcc_warning("-Wc++2a-compat", cxx_compiler) +check_and_add_gcc_warning('-Wc++2a-compat', cxx_compiler) # catches possible misuse of the comma operator -check_and_add_gcc_warning("-Wcomma", cxx_compiler) +check_and_add_gcc_warning('-Wcomma', cxx_compiler) # catches duplicated conditions in if-else-if chains -check_and_add_gcc_warning("-Wduplicated-cond") +check_and_add_gcc_warning('-Wduplicated-cond') # catches unintentional switch case fallthroughs -check_and_add_gcc_warning("-Wimplicit-fallthrough", cxx_compiler) +check_and_add_gcc_warning('-Wimplicit-fallthrough', cxx_compiler) # catches unused variable/function declarations -check_and_add_gcc_warning("-Wunused-function", cxx_compiler) -check_and_add_gcc_warning("-Wunused-variable", cxx_compiler) +check_and_add_gcc_warning('-Wunused-function', cxx_compiler) +check_and_add_gcc_warning('-Wunused-variable', cxx_compiler) # catches expressions used as a null pointer constant # XXX: at the time of writing, the version of clang used on the OS X test @@ -122,117 +117,115 @@ check_and_add_gcc_warning("-Wunused-variable", cxx_compiler) # -Werror=non-literal-null-conversion, but we only do that when # --enable-warnings-as-errors is specified so that no unexpected fatal # warnings are produced. -check_and_add_gcc_warning( - "-Werror=non-literal-null-conversion", when="--enable-warnings-as-errors" -) +check_and_add_gcc_warning('-Werror=non-literal-null-conversion', + when='--enable-warnings-as-errors') # catches string literals used in boolean expressions -check_and_add_gcc_warning("-Wstring-conversion") +check_and_add_gcc_warning('-Wstring-conversion') # catches comparisons that are always true or false -check_and_add_gcc_warning("-Wtautological-overlap-compare") -check_and_add_gcc_warning("-Wtautological-unsigned-enum-zero-compare") -check_and_add_gcc_warning("-Wtautological-unsigned-zero-compare") +check_and_add_gcc_warning('-Wtautological-overlap-compare') +check_and_add_gcc_warning('-Wtautological-unsigned-enum-zero-compare') +check_and_add_gcc_warning('-Wtautological-unsigned-zero-compare') # This can be triggered by certain patterns used deliberately in portable code -check_and_add_gcc_warning("-Wno-error=tautological-type-limit-compare") +check_and_add_gcc_warning('-Wno-error=tautological-type-limit-compare') # we inline 'new' and 'delete' in mozalloc -check_and_add_gcc_warning("-Wno-inline-new-delete", cxx_compiler) +check_and_add_gcc_warning('-Wno-inline-new-delete', cxx_compiler) # Prevent the following GCC warnings from being treated as errors: # too many false positives -check_and_add_gcc_warning("-Wno-error=maybe-uninitialized") +check_and_add_gcc_warning('-Wno-error=maybe-uninitialized') # we don't want our builds held hostage when a platform-specific API # becomes deprecated. -check_and_add_gcc_warning("-Wno-error=deprecated-declarations") +check_and_add_gcc_warning('-Wno-error=deprecated-declarations') # false positives depending on optimization -check_and_add_gcc_warning("-Wno-error=array-bounds") +check_and_add_gcc_warning('-Wno-error=array-bounds') # can't get rid of those PGO warnings -check_and_add_gcc_warning("-Wno-error=coverage-mismatch") +check_and_add_gcc_warning('-Wno-error=coverage-mismatch') # -Wbackend-plugin warnings from Android PGO profile-use builds: # error: /builds/worker/workspace/build/src/mozglue/misc/AutoProfilerLabel.cpp: # Function control flow change detected (hash mismatch) # _ZN7mozilla17AutoProfilerLabelD2Ev [-Werror,-Wbackend-plugin] -check_and_add_gcc_warning("-Wno-error=backend-plugin") +check_and_add_gcc_warning('-Wno-error=backend-plugin') # false positives depending on optimizations -check_and_add_gcc_warning("-Wno-error=free-nonheap-object") +check_and_add_gcc_warning('-Wno-error=free-nonheap-object') # Would be a pain to fix all occurrences, for very little gain -check_and_add_gcc_warning("-Wno-multistatement-macros") +check_and_add_gcc_warning('-Wno-multistatement-macros') # Disable the -Werror for return-std-move because of a false positive # on nsTAutoStringN: https://bugs.llvm.org/show_bug.cgi?id=37249 -check_and_add_gcc_warning("-Wno-error=return-std-move") +check_and_add_gcc_warning('-Wno-error=return-std-move') # Disable the -Werror for -Wclass-memaccess as we have a long # tail of issues to fix -check_and_add_gcc_warning("-Wno-error=class-memaccess") +check_and_add_gcc_warning('-Wno-error=class-memaccess') # -Watomic-alignment is a new warning in clang 7 that seems way too broad. # https://bugs.llvm.org/show_bug.cgi?id=38593 -check_and_add_gcc_warning("-Wno-error=atomic-alignment") +check_and_add_gcc_warning('-Wno-error=atomic-alignment') # New warning with gcc 9. Not useful # https://bugzilla.mozilla.org/show_bug.cgi?id=1515356 -check_and_add_gcc_warning("-Wno-error=deprecated-copy") +check_and_add_gcc_warning('-Wno-error=deprecated-copy') # catches format/argument mismatches with printf c_format_warning, cxx_format_warning = check_and_add_gcc_warning( - "-Wformat", when=depends(target)(lambda t: t.kernel != "WINNT") -) + '-Wformat', when=depends(target)(lambda t: t.kernel != 'WINNT')) # Add compile-time warnings for unprotected functions and format functions # that represent possible security problems. Enable this only when -Wformat # is enabled, otherwise it is an error -check_and_add_gcc_warning( - "-Wformat-security", when=c_format_warning & cxx_format_warning -) -check_and_add_gcc_warning( - "-Wformat-overflow=2", when=c_format_warning & cxx_format_warning -) +check_and_add_gcc_warning('-Wformat-security', + when=c_format_warning & cxx_format_warning) +check_and_add_gcc_warning('-Wformat-overflow=2', + when=c_format_warning & cxx_format_warning) # Other MinGW specific things -with only_when(depends(target)(lambda t: t.kernel == "WINNT")): +with only_when(depends(target)(lambda t: t.kernel == 'WINNT')): # When compiling for Windows with gcc, we encounter lots of "#pragma warning"'s # which is an MSVC-only pragma that GCC does not recognize. - check_and_add_gcc_warning("-Wno-unknown-pragmas") + check_and_add_gcc_warning('-Wno-unknown-pragmas') # When compiling for Windows with gcc, gcc throws false positives and true # positives where the callsite is ifdef-ed out - check_and_add_gcc_warning("-Wno-unused-function") + check_and_add_gcc_warning('-Wno-unused-function') # When compiling for Windows with gcc, gcc cannot produce this warning # correctly: it mistakes DWORD_PTR and ULONG_PTR as types you cannot # give NULL to. (You can in fact do that.) - check_and_add_gcc_warning("-Wno-conversion-null") + check_and_add_gcc_warning('-Wno-conversion-null') # Throughout the codebase we regularly have switch statements off of enums # without covering every value in the enum. We don't care about these warnings. - check_and_add_gcc_warning("-Wno-switch") + check_and_add_gcc_warning('-Wno-switch') # Another code pattern we have is using start and end constants in enums of # different types. We do this for safety, but then when comparing it throws # an error, which we would like to ignore. This seems to only affect the MinGW # build, but we're not sure why. - check_and_add_gcc_warning("-Wno-enum-compare") + check_and_add_gcc_warning('-Wno-enum-compare') # We hit this all over the place with the gtest INSTANTIATE_TEST_CASE_P macro -check_and_add_gcc_warning("-Wno-gnu-zero-variadic-macro-arguments") +check_and_add_gcc_warning('-Wno-gnu-zero-variadic-macro-arguments') # Make it an error to be missing function declarations. -check_and_add_gcc_warning("-Werror=implicit-function-declaration") +check_and_add_gcc_warning('-Werror=implicit-function-declaration') # New in clang 11. We can't really do anything about this warning. -check_and_add_gcc_warning("-Wno-psabi") +check_and_add_gcc_warning('-Wno-psabi') # Please keep these last in this file -add_old_configure_assignment("_WARNINGS_CFLAGS", warnings_flags.cflags) -add_old_configure_assignment("_WARNINGS_CXXFLAGS", warnings_flags.cxxflags) -add_old_configure_assignment("_WARNINGS_HOST_CFLAGS", warnings_flags.host_cflags) -add_old_configure_assignment("_WARNINGS_HOST_CXXFLAGS", warnings_flags.host_cxxflags) +add_old_configure_assignment('_WARNINGS_CFLAGS', warnings_flags.cflags) +add_old_configure_assignment('_WARNINGS_CXXFLAGS', warnings_flags.cxxflags) +add_old_configure_assignment( + '_WARNINGS_HOST_CFLAGS', warnings_flags.host_cflags) +add_old_configure_assignment( + '_WARNINGS_HOST_CXXFLAGS', warnings_flags.host_cxxflags) diff --git a/build/moz.configure/windows.configure b/build/moz.configure/windows.configure index 2cc6a60411b9..466d6fed7467 100644 --- a/build/moz.configure/windows.configure +++ b/build/moz.configure/windows.configure @@ -4,20 +4,16 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -option( - "--with-windows-version", - nargs=1, - default="603", - help="Windows SDK version to target. Win 8.1 (603) is currently" - "the minimum supported version.", -) +option('--with-windows-version', nargs=1, default='603', + help='Windows SDK version to target. Win 8.1 (603) is currently' + 'the minimum supported version.') -@depends("--with-windows-version") -@imports(_from="__builtin__", _import="ValueError") +@depends('--with-windows-version') +@imports(_from='__builtin__', _import='ValueError') def valid_windows_version(value): if not value: - die("Cannot build with --without-windows-version") + die('Cannot build with --without-windows-version') try: version = int(value[0], 16) if version in (0x603,): @@ -25,30 +21,25 @@ def valid_windows_version(value): except ValueError: pass - die("Invalid value for --with-windows-version (%s)", value[0]) + die('Invalid value for --with-windows-version (%s)', value[0]) -option(env="WINDOWSSDKDIR", nargs=1, help="Directory containing the Windows SDK") +option(env='WINDOWSSDKDIR', nargs=1, + help='Directory containing the Windows SDK') -@depends("WINDOWSSDKDIR", host, c_compiler) +@depends('WINDOWSSDKDIR', host, c_compiler) def windows_sdk_dir(value, host, compiler): if value: return value # Ideally, we'd actually check for host/target ABI being MSVC, but # that's waiting for bug 1617793. - if host.kernel != "WINNT" or compiler.type != "clang-cl": + if host.kernel != 'WINNT' or compiler.type != 'clang-cl': return () - return set( - x[1] - for x in get_registry_values( - r"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots" - r"\KitsRoot*", - get_32_and_64_bit=True, - ) - ) - + return set(x[1] for x in get_registry_values( + r'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots' + r'\KitsRoot*', get_32_and_64_bit=True)) # The Windows SDK 8.1 and 10 have different layouts. The former has # $SDK/include/$subdir, while the latter has $SDK/include/$version/$subdir. @@ -59,17 +50,16 @@ def windows_sdk_dir(value, host, compiler): # 8.1. -@imports("os") -@imports("re") -@imports(_from="__builtin__", _import="sorted") -@imports(_from="__builtin__", _import="Exception") +@imports('os') +@imports('re') +@imports(_from='__builtin__', _import='sorted') +@imports(_from='__builtin__', _import='Exception') def get_sdk_dirs(sdk, subdir): def get_dirs_containing(sdk, stem, subdir): base = os.path.join(sdk, stem) try: - subdirs = [ - d for d in os.listdir(base) if os.path.isdir(os.path.join(base, d)) - ] + subdirs = [d for d in os.listdir(base) + if os.path.isdir(os.path.join(base, d))] except Exception: subdirs = [] if not subdirs: @@ -78,21 +68,18 @@ def get_sdk_dirs(sdk, subdir): return (base,) # At this point, either we have an incomplete or invalid SDK directory, # or we exclusively have version numbers in subdirs. - return tuple( - os.path.join(base, s) - for s in subdirs - if os.path.isdir(os.path.join(base, s, subdir)) - ) + return tuple(os.path.join(base, s) for s in subdirs + if os.path.isdir(os.path.join(base, s, subdir))) def categorize(dirs): return {os.path.basename(d): d for d in dirs} - include_dirs = categorize(get_dirs_containing(sdk, "include", subdir)) - lib_dirs = categorize(get_dirs_containing(sdk, "lib", subdir)) + include_dirs = categorize(get_dirs_containing(sdk, 'include', subdir)) + lib_dirs = categorize(get_dirs_containing(sdk, 'lib', subdir)) - if "include" in include_dirs: - include_dirs["winv6.3"] = include_dirs["include"] - del include_dirs["include"] + if 'include' in include_dirs: + include_dirs['winv6.3'] = include_dirs['include'] + del include_dirs['include'] valid_versions = sorted(set(include_dirs) & set(lib_dirs), reverse=True) if valid_versions: @@ -103,47 +90,39 @@ def get_sdk_dirs(sdk, subdir): ) -@imports(_from="mozbuild.shellutil", _import="quote") +@imports(_from='mozbuild.shellutil', _import='quote') def valid_windows_sdk_dir_result(value): if value: - return "0x%04x in %s" % (value.version, quote(value.path)) + return '0x%04x in %s' % (value.version, quote(value.path)) -@depends(c_compiler, windows_sdk_dir, valid_windows_version, "WINDOWSSDKDIR") -@checking("for Windows SDK", valid_windows_sdk_dir_result) -@imports(_from="__builtin__", _import="sorted") -@imports(_from="__builtin__", _import="Exception") -@imports(_from="textwrap", _import="dedent") -def valid_windows_sdk_dir( - compiler, windows_sdk_dir, target_version, windows_sdk_dir_env -): +@depends(c_compiler, windows_sdk_dir, valid_windows_version, 'WINDOWSSDKDIR') +@checking('for Windows SDK', valid_windows_sdk_dir_result) +@imports(_from='__builtin__', _import='sorted') +@imports(_from='__builtin__', _import='Exception') +@imports(_from='textwrap', _import='dedent') +def valid_windows_sdk_dir(compiler, windows_sdk_dir, target_version, + windows_sdk_dir_env): # Ideally, we'd actually check for host/target ABI being MSVC, but # that's waiting for bug 1617793. - if compiler.type != "clang-cl": + if compiler.type != 'clang-cl': return None if windows_sdk_dir_env: windows_sdk_dir_env = windows_sdk_dir_env[0] sdks = {} for d in windows_sdk_dir: - sdk = get_sdk_dirs(d, "um") + sdk = get_sdk_dirs(d, 'um') if sdk: - check = dedent( - """\ + check = dedent('''\ #include WINVER_MAXVER - """ - ) - um_dir = os.path.join(sdk.include, "um") - shared_dir = os.path.join(sdk.include, "shared") - result = try_preprocess( - compiler.wrapper - + [compiler.compiler] - + compiler.flags - + ["-X", "-I", um_dir, "-I", shared_dir], - "C", - check, - onerror=lambda: "", - ) + ''') + um_dir = os.path.join(sdk.include, 'um') + shared_dir = os.path.join(sdk.include, 'shared') + result = try_preprocess(compiler.wrapper + [compiler.compiler] + + compiler.flags + + ['-X', '-I', um_dir, '-I', shared_dir], 'C', + check, onerror=lambda: '') if result: maxver = result.splitlines()[-1] try: @@ -155,10 +134,9 @@ def valid_windows_sdk_dir( continue if d == windows_sdk_dir_env: raise FatalCheckError( - "Error while checking the version of the SDK in " - "WINDOWSSDKDIR (%s). Please verify it contains a valid and " - "complete SDK installation." % windows_sdk_dir_env - ) + 'Error while checking the version of the SDK in ' + 'WINDOWSSDKDIR (%s). Please verify it contains a valid and ' + 'complete SDK installation.' % windows_sdk_dir_env) valid_sdks = sorted(sdks, key=lambda x: sdks[x][0], reverse=True) if valid_sdks: @@ -166,18 +144,16 @@ def valid_windows_sdk_dir( if not valid_sdks or biggest_version < target_version: if windows_sdk_dir_env: raise FatalCheckError( - "You are targeting Windows version 0x%04x, but your SDK only " - "supports up to version 0x%04x. Install and use an updated SDK, " - "or target a lower version using --with-windows-version. " - "Alternatively, try running the Windows SDK Configuration Tool " - "and selecting a newer SDK. See " - "https://developer.mozilla.org/En/Windows_SDK_versions for " - "details on fixing this." % (target_version, biggest_version) - ) + 'You are targeting Windows version 0x%04x, but your SDK only ' + 'supports up to version 0x%04x. Install and use an updated SDK, ' + 'or target a lower version using --with-windows-version. ' + 'Alternatively, try running the Windows SDK Configuration Tool ' + 'and selecting a newer SDK. See ' + 'https://developer.mozilla.org/En/Windows_SDK_versions for ' + 'details on fixing this.' % (target_version, biggest_version)) raise FatalCheckError( - "Cannot find a Windows SDK for version >= 0x%04x." % target_version - ) + 'Cannot find a Windows SDK for version >= 0x%04x.' % target_version) return namespace( path=sdk.path, @@ -187,27 +163,27 @@ def valid_windows_sdk_dir( ) -@imports(_from="mozbuild.shellutil", _import="quote") +@imports(_from='mozbuild.shellutil', _import='quote') def valid_ucrt_sdk_dir_result(value): if value: - return "%s in %s" % (value.version, quote(value.path)) + return '%s in %s' % (value.version, quote(value.path)) -@depends(windows_sdk_dir, "WINDOWSSDKDIR", c_compiler) -@checking("for Universal CRT SDK", valid_ucrt_sdk_dir_result) -@imports("os") -@imports(_from="__builtin__", _import="sorted") -@imports(_import="mozpack.path", _as="mozpath") +@depends(windows_sdk_dir, 'WINDOWSSDKDIR', c_compiler) +@checking('for Universal CRT SDK', valid_ucrt_sdk_dir_result) +@imports('os') +@imports(_from='__builtin__', _import='sorted') +@imports(_import='mozpack.path', _as='mozpath') def valid_ucrt_sdk_dir(windows_sdk_dir, windows_sdk_dir_env, compiler): # Ideally, we'd actually check for host/target ABI being MSVC, but # that's waiting for bug 1617793. - if compiler.type != "clang-cl": + if compiler.type != 'clang-cl': return None if windows_sdk_dir_env: windows_sdk_dir_env = windows_sdk_dir_env[0] sdks = {} for d in windows_sdk_dir: - sdk = get_sdk_dirs(d, "ucrt") + sdk = get_sdk_dirs(d, 'ucrt') if sdk: version = os.path.basename(sdk.include) # We're supposed to always find a version in the directory, because @@ -215,7 +191,7 @@ def valid_ucrt_sdk_dir(windows_sdk_dir, windows_sdk_dir_env, compiler): # contain the Universal CRT SDK. When the main SDK is 8.1, there # is, however, supposed to be a reduced install of the SDK 10 # with the UCRT. - if version != "include": + if version != 'include': sdks[d] = Version(version), sdk continue if d == windows_sdk_dir_env: @@ -223,14 +199,12 @@ def valid_ucrt_sdk_dir(windows_sdk_dir, windows_sdk_dir_env, compiler): # Universal CRT SDK, chances are this is a start-shell-msvc*.bat # setup, where INCLUDE and LIB already contain the UCRT paths. ucrt_includes = [ - p - for p in os.environ.get("INCLUDE", "").split(";") - if os.path.basename(p).lower() == "ucrt" + p for p in os.environ.get('INCLUDE', '').split(';') + if os.path.basename(p).lower() == 'ucrt' ] ucrt_libs = [ - p - for p in os.environ.get("LIB", "").split(";") - if os.path.basename(os.path.dirname(p)).lower() == "ucrt" + p for p in os.environ.get('LIB', '').split(';') + if os.path.basename(os.path.dirname(p)).lower() == 'ucrt' ] if ucrt_includes and ucrt_libs: # Pick the first of each, since they are the ones that the @@ -239,36 +213,30 @@ def valid_ucrt_sdk_dir(windows_sdk_dir, windows_sdk_dir_env, compiler): lib = os.path.dirname(os.path.dirname(ucrt_libs[0])) path = os.path.dirname(os.path.dirname(include)) version = os.path.basename(include) - if version != "include" and mozpath.basedir(lib, [path]): - sdks[d] = ( - Version(version), - namespace( - path=path, - include=include, - lib=lib, - ), + if version != 'include' and mozpath.basedir(lib, [path]): + sdks[d] = Version(version), namespace( + path=path, + include=include, + lib=lib, ) continue raise FatalCheckError( - "The SDK in WINDOWSSDKDIR (%s) does not contain the Universal " - "CRT." % windows_sdk_dir_env - ) + 'The SDK in WINDOWSSDKDIR (%s) does not contain the Universal ' + 'CRT.' % windows_sdk_dir_env) valid_sdks = sorted(sdks, key=lambda x: sdks[x][0], reverse=True) if not valid_sdks: - raise FatalCheckError( - "Cannot find the Universal CRT SDK. " "Please install it." - ) + raise FatalCheckError('Cannot find the Universal CRT SDK. ' + 'Please install it.') version, sdk = sdks[valid_sdks[0]] - minimum_ucrt_version = Version("10.0.17134.0") + minimum_ucrt_version = Version('10.0.17134.0') if version < minimum_ucrt_version: - raise FatalCheckError( - "Latest Universal CRT SDK version found %s" - " and minimum required is %s. This or a later" - " version can be installed using the Visual" - " Studio installer." % (version, minimum_ucrt_version) - ) + raise FatalCheckError('Latest Universal CRT SDK version found %s' + ' and minimum required is %s. This or a later' + ' version can be installed using the Visual' + ' Studio installer.' + % (version, minimum_ucrt_version)) return namespace( path=sdk.path, @@ -279,36 +247,35 @@ def valid_ucrt_sdk_dir(windows_sdk_dir, windows_sdk_dir_env, compiler): @depends(c_compiler, host_c_compiler, toolchain_search_path) -@imports("os") +@imports('os') def vc_path(c_compiler, host_c_compiler, toolchain_search_path): - if c_compiler.type != "clang-cl" and host_c_compiler.type != "clang-cl": + if c_compiler.type != 'clang-cl' and host_c_compiler.type != 'clang-cl': return # In clang-cl builds, we need the headers and libraries from an MSVC installation. - vc_program = find_program("cl.exe", paths=toolchain_search_path) + vc_program = find_program('cl.exe', paths=toolchain_search_path) if not vc_program: - die("Cannot find a Visual C++ install for e.g. ATL headers.") + die('Cannot find a Visual C++ install for e.g. ATL headers.') result = os.path.dirname(vc_program) while True: next, p = os.path.split(result) if next == result: - die( - "Cannot determine the Visual C++ directory the compiler (%s) " - "is in" % vc_program - ) + die('Cannot determine the Visual C++ directory the compiler (%s) ' + 'is in' % vc_program) result = next - if p.lower() == "bin": + if p.lower() == 'bin': break return os.path.normpath(result) -option(env="DIA_SDK_PATH", nargs=1, help="Path to the Debug Interface Access SDK") +option(env='DIA_SDK_PATH', nargs=1, + help='Path to the Debug Interface Access SDK') -@depends(vc_path, "DIA_SDK_PATH") -@checking("for the Debug Interface Access SDK", lambda x: x or "not found") -@imports("os") +@depends(vc_path, 'DIA_SDK_PATH') +@checking('for the Debug Interface Access SDK', lambda x: x or 'not found') +@imports('os') def dia_sdk_dir(vc_path, dia_sdk_path): if dia_sdk_path: path = os.path.normpath(dia_sdk_path[0]) @@ -316,58 +283,51 @@ def dia_sdk_dir(vc_path, dia_sdk_path): elif vc_path: # This would be easier if we had the installationPath that # get_vc_paths works with, since 'DIA SDK' is relative to that. - path = os.path.normpath( - os.path.join(vc_path, "..", "..", "..", "..", "DIA SDK") - ) + path = os.path.normpath(os.path.join( + vc_path, '..', '..', '..', '..', 'DIA SDK')) else: return - if os.path.exists(os.path.join(path, "include", "dia2.h")): + if os.path.exists(os.path.join(path, 'include', 'dia2.h')): return path @depends(vc_path, valid_windows_sdk_dir, valid_ucrt_sdk_dir, dia_sdk_dir) -@imports("os") +@imports('os') def include_path(vc_path, windows_sdk_dir, ucrt_sdk_dir, dia_sdk_dir): if not vc_path: return - atlmfc_dir = os.path.join(vc_path, "atlmfc", "include") + atlmfc_dir = os.path.join(vc_path, 'atlmfc', 'include') if not os.path.isdir(atlmfc_dir): - die( - "Cannot find the ATL/MFC headers in the Visual C++ directory (%s). " - "Please install them." % vc_path - ) + die('Cannot find the ATL/MFC headers in the Visual C++ directory (%s). ' + 'Please install them.' % vc_path) - winrt_dir = os.path.join(windows_sdk_dir.include, "winrt") + winrt_dir = os.path.join(windows_sdk_dir.include, 'winrt') if not os.path.isdir(winrt_dir): - die( - "Cannot find the WinRT headers in the Windows SDK directory (%s). " - "Please install them." % windows_sdk_dir.path - ) + die('Cannot find the WinRT headers in the Windows SDK directory (%s). ' + 'Please install them.' % windows_sdk_dir.path) includes = [] - include_env = os.environ.get("INCLUDE") + include_env = os.environ.get('INCLUDE') if include_env: includes.append(include_env) - includes.extend( - ( - os.path.join(vc_path, "include"), - atlmfc_dir, - os.path.join(windows_sdk_dir.include, "shared"), - os.path.join(windows_sdk_dir.include, "um"), - winrt_dir, - os.path.join(ucrt_sdk_dir.include, "ucrt"), - ) - ) + includes.extend(( + os.path.join(vc_path, 'include'), + atlmfc_dir, + os.path.join(windows_sdk_dir.include, 'shared'), + os.path.join(windows_sdk_dir.include, 'um'), + winrt_dir, + os.path.join(ucrt_sdk_dir.include, 'ucrt'), + )) if dia_sdk_dir: - includes.append(os.path.join(dia_sdk_dir, "include")) + includes.append(os.path.join(dia_sdk_dir, 'include')) # Set in the environment for old-configure - includes = ";".join(includes) - os.environ["INCLUDE"] = includes + includes = ';'.join(includes) + os.environ['INCLUDE'] = includes return includes -set_config("INCLUDE", include_path) +set_config('INCLUDE', include_path) @template @@ -379,10 +339,10 @@ def dia_sdk_subdir(host_or_target, subdir): # For some reason the DIA SDK still uses the old-style targets # even in a newer MSVC. old_target = { - "x86": "", - "x86_64": "amd64", - "arm": "arm", - "aarch64": "arm64", + 'x86': '', + 'x86_64': 'amd64', + 'arm': 'arm', + 'aarch64': 'arm64' }.get(target.cpu) if old_target is None: return @@ -396,52 +356,40 @@ def dia_sdk_subdir(host_or_target, subdir): return dia_sdk_subdir -set_config("WIN_DIA_SDK_BIN_DIR", dia_sdk_subdir(host, "bin")) +set_config('WIN_DIA_SDK_BIN_DIR', dia_sdk_subdir(host, 'bin')) @template def lib_path_for(host_or_target): - @depends( - host_or_target, - dependable(host_or_target is host), - vc_path, - valid_windows_sdk_dir, - valid_ucrt_sdk_dir, - dia_sdk_subdir(host_or_target, "lib"), - ) - @imports("os") - def lib_path( - target, is_host, vc_path, windows_sdk_dir, ucrt_sdk_dir, dia_sdk_lib_dir - ): + @depends(host_or_target, dependable(host_or_target is host), vc_path, + valid_windows_sdk_dir, valid_ucrt_sdk_dir, dia_sdk_subdir(host_or_target, 'lib')) + @imports('os') + def lib_path(target, is_host, vc_path, windows_sdk_dir, ucrt_sdk_dir, dia_sdk_lib_dir): if not vc_path: return sdk_target = { - "x86": "x86", - "x86_64": "x64", - "arm": "arm", - "aarch64": "arm64", + 'x86': 'x86', + 'x86_64': 'x64', + 'arm': 'arm', + 'aarch64': 'arm64', }.get(target.cpu) # MSVC2017 switched to use the same target naming as the sdk. - atlmfc_dir = os.path.join(vc_path, "atlmfc", "lib", sdk_target) + atlmfc_dir = os.path.join(vc_path, 'atlmfc', 'lib', sdk_target) if not os.path.isdir(atlmfc_dir): - die( - "Cannot find the ATL/MFC libraries in the Visual C++ directory " - "(%s). Please install them." % vc_path - ) + die('Cannot find the ATL/MFC libraries in the Visual C++ directory ' + '(%s). Please install them.' % vc_path) libs = [] - lib_env = os.environ.get("LIB") + lib_env = os.environ.get('LIB') if lib_env and not is_host: - libs.extend(lib_env.split(";")) - libs.extend( - ( - os.path.join(vc_path, "lib", sdk_target), - atlmfc_dir, - os.path.join(windows_sdk_dir.lib, "um", sdk_target), - os.path.join(ucrt_sdk_dir.lib, "ucrt", sdk_target), - ) - ) + libs.extend(lib_env.split(';')) + libs.extend(( + os.path.join(vc_path, 'lib', sdk_target), + atlmfc_dir, + os.path.join(windows_sdk_dir.lib, 'um', sdk_target), + os.path.join(ucrt_sdk_dir.lib, 'ucrt', sdk_target), + )) if dia_sdk_lib_dir: libs.append(dia_sdk_lib_dir) return libs @@ -450,28 +398,27 @@ def lib_path_for(host_or_target): @depends_if(lib_path_for(target)) -@imports("os") +@imports('os') def lib_path(libs): # Set in the environment for old-configure - libs = ";".join(libs) - os.environ["LIB"] = libs + libs = ';'.join(libs) + os.environ['LIB'] = libs return libs -set_config("LIB", lib_path) +set_config('LIB', lib_path) lib_path_for_host = lib_path_for(host) - @depends_if(lib_path_for_host) -@imports(_from="mozbuild.shellutil", _import="quote") +@imports(_from='mozbuild.shellutil', _import='quote') def host_linker_libpaths(libs): - return ["-LIBPATH:%s" % quote(l) for l in libs] + return ['-LIBPATH:%s' % quote(l) for l in libs] @depends_if(lib_path_for_host) -@imports(_from="mozbuild.shellutil", _import="quote") +@imports(_from='mozbuild.shellutil', _import='quote') def host_linker_libpaths_bat(libs): # .bat files need a different style of quoting. Batch quoting is actually # not defined, and up to applications to handle, so it's not really clear @@ -482,54 +429,42 @@ def host_linker_libpaths_bat(libs): return ['"-LIBPATH:%s"' % l for l in libs] -set_config("HOST_LINKER_LIBPATHS", host_linker_libpaths) -set_config("HOST_LINKER_LIBPATHS_BAT", host_linker_libpaths_bat) +set_config('HOST_LINKER_LIBPATHS', host_linker_libpaths) +set_config('HOST_LINKER_LIBPATHS_BAT', host_linker_libpaths_bat) @depends(valid_windows_sdk_dir, valid_ucrt_sdk_dir, host) -@imports(_from="os", _import="environ") +@imports(_from='os', _import='environ') def sdk_bin_path(valid_windows_sdk_dir, valid_ucrt_sdk_dir, host): if not valid_windows_sdk_dir: return vc_host = { - "x86": "x86", - "x86_64": "x64", + 'x86': 'x86', + 'x86_64': 'x64', }.get(host.cpu) # From version 10.0.15063.0 onwards the bin path contains the version number. - versioned_bin = ( - "bin" - if valid_ucrt_sdk_dir.version < "10.0.15063.0" - else os.path.join("bin", str(valid_ucrt_sdk_dir.version)) - ) + versioned_bin = ('bin' if valid_ucrt_sdk_dir.version < '10.0.15063.0' + else os.path.join('bin', str(valid_ucrt_sdk_dir.version))) result = [ - environ["PATH"], - os.path.join(valid_windows_sdk_dir.path, versioned_bin, vc_host), + environ['PATH'], + os.path.join(valid_windows_sdk_dir.path, versioned_bin, vc_host) ] - if vc_host == "x64": - result.append(os.path.join(valid_windows_sdk_dir.path, versioned_bin, "x86")) + if vc_host == 'x64': + result.append( + os.path.join(valid_windows_sdk_dir.path, versioned_bin, 'x86')) return result -option(env="LINKER", nargs=1, when=target_is_windows, help="Path to the linker") +option(env='LINKER', nargs=1, when=target_is_windows, help='Path to the linker') -link = check_prog( - "LINKER", - ("lld-link",), - input="LINKER", - when=target_is_windows, - paths=toolchain_search_path, -) +link = check_prog('LINKER', ('lld-link',), input='LINKER', + when=target_is_windows, paths=toolchain_search_path) -option(env="HOST_LINKER", nargs=1, when=host_is_windows, help="Path to the host linker") +option(env='HOST_LINKER', nargs=1, when=host_is_windows, help='Path to the host linker') -host_link = check_prog( - "HOST_LINKER", - ("lld-link",), - input="HOST_LINKER", - when=host_is_windows, - paths=host_toolchain_search_path, -) +host_link = check_prog('HOST_LINKER', ('lld-link',), input='HOST_LINKER', + when=host_is_windows, paths=host_toolchain_search_path) -add_old_configure_assignment("LINKER", link) +add_old_configure_assignment('LINKER', link) diff --git a/build/pgo/profileserver.py b/build/pgo/profileserver.py index 7f3de106ab42..cbb45e08a293 100755 --- a/build/pgo/profileserver.py +++ b/build/pgo/profileserver.py @@ -22,31 +22,27 @@ from six import string_types PORT = 8888 PATH_MAPPINGS = { - "/webkit/PerformanceTests": "third_party/webkit/PerformanceTests", + '/webkit/PerformanceTests': 'third_party/webkit/PerformanceTests', # It is tempting to map to `testing/talos/talos/tests` instead, to avoid # writing `tests/` in every path, but we can't do that because some files # refer to scripts located in `../..`. - "/talos": "testing/talos/talos", + '/talos': 'testing/talos/talos', } def get_crashreports(directory, name=None): rc = 0 - upload_path = os.environ.get("UPLOAD_PATH") + upload_path = os.environ.get('UPLOAD_PATH') if upload_path: # For automation, log the minidumps with stackwalk and get them moved to # the artifacts directory. - fetches_dir = os.environ.get("MOZ_FETCHES_DIR") + fetches_dir = os.environ.get('MOZ_FETCHES_DIR') if not fetches_dir: - raise Exception( - "Unable to process minidump in automation because " - "$MOZ_FETCHES_DIR is not set in the environment" - ) - stackwalk_binary = os.path.join( - fetches_dir, "minidump_stackwalk", "minidump_stackwalk" - ) - if sys.platform == "win32": - stackwalk_binary += ".exe" + raise Exception("Unable to process minidump in automation because " + "$MOZ_FETCHES_DIR is not set in the environment") + stackwalk_binary = os.path.join(fetches_dir, 'minidump_stackwalk', 'minidump_stackwalk') + if sys.platform == 'win32': + stackwalk_binary += '.exe' minidump_path = os.path.join(directory, "minidumps") rc = mozcrash.check_for_crashes( minidump_path, @@ -58,49 +54,48 @@ def get_crashreports(directory, name=None): return rc -if __name__ == "__main__": +if __name__ == '__main__': cli = CLI() debug_args, interactive = cli.debugger_arguments() runner_args = cli.runner_args() build = MozbuildObject.from_environment() - binary = runner_args.get("binary") + binary = runner_args.get('binary') if not binary: try: binary = build.get_binary_path(where="staged-package") except BinaryNotFoundException as e: - print("{}\n\n{}\n".format(e, e.help())) + print('{}\n\n{}\n'.format(e, e.help())) sys.exit(1) binary = os.path.normpath(os.path.abspath(binary)) path_mappings = { - k: os.path.join(build.topsrcdir, v) for k, v in PATH_MAPPINGS.items() + k: os.path.join(build.topsrcdir, v) + for k, v in PATH_MAPPINGS.items() } - httpd = MozHttpd( - port=PORT, - docroot=os.path.join(build.topsrcdir, "build", "pgo"), - path_mappings=path_mappings, - ) + httpd = MozHttpd(port=PORT, + docroot=os.path.join(build.topsrcdir, "build", "pgo"), + path_mappings=path_mappings) httpd.start(block=False) locations = ServerLocations() - locations.add_host(host="127.0.0.1", port=PORT, options="primary,privileged") + locations.add_host(host='127.0.0.1', + port=PORT, + options='primary,privileged') - old_profraw_files = glob.glob("*.profraw") + old_profraw_files = glob.glob('*.profraw') for f in old_profraw_files: os.remove(f) with TemporaryDirectory() as profilePath: # TODO: refactor this into mozprofile - profile_data_dir = os.path.join(build.topsrcdir, "testing", "profiles") - with open(os.path.join(profile_data_dir, "profiles.json"), "r") as fh: - base_profiles = json.load(fh)["profileserver"] + profile_data_dir = os.path.join(build.topsrcdir, 'testing', 'profiles') + with open(os.path.join(profile_data_dir, 'profiles.json'), 'r') as fh: + base_profiles = json.load(fh)['profileserver'] - prefpaths = [ - os.path.join(profile_data_dir, profile, "user.js") - for profile in base_profiles - ] + prefpaths = [os.path.join(profile_data_dir, profile, 'user.js') + for profile in base_profiles] prefs = {} for path in prefpaths: @@ -118,16 +113,12 @@ if __name__ == "__main__": # and this is a bool pref. prefs["browser.tabs.remote.autostart"] = True - profile = FirefoxProfile( - profile=profilePath, - preferences=prefs, - addons=[ - os.path.join( - build.topsrcdir, "tools", "quitter", "quitter@mozilla.org.xpi" - ) - ], - locations=locations, - ) + profile = FirefoxProfile(profile=profilePath, + preferences=prefs, + addons=[os.path.join( + build.topsrcdir, 'tools', 'quitter', + 'quitter@mozilla.org.xpi')], + locations=locations) env = os.environ.copy() env["MOZ_CRASHREPORTER_NO_REPORT"] = "1" @@ -146,31 +137,28 @@ if __name__ == "__main__": env["LLVM_PROFILE_FILE"] = "default_%p_random_%m.profraw" # Write to an output file if we're running in automation - process_args = {"universal_newlines": True} - if "UPLOAD_PATH" in env: - process_args["logfile"] = os.path.join( - env["UPLOAD_PATH"], "profile-run-1.log" - ) + process_args = {'universal_newlines': True} + if 'UPLOAD_PATH' in env: + process_args['logfile'] = os.path.join(env['UPLOAD_PATH'], 'profile-run-1.log') # Run Firefox a first time to initialize its profile - runner = FirefoxRunner( - profile=profile, - binary=binary, - cmdargs=["data:text/html,"], - env=env, - process_args=process_args, - ) + runner = FirefoxRunner(profile=profile, + binary=binary, + cmdargs=['data:text/html,'], + env=env, + process_args=process_args) runner.start() ret = runner.wait() if ret: - print("Firefox exited with code %d during profile initialization" % ret) - logfile = process_args.get("logfile") + print("Firefox exited with code %d during profile initialization" + % ret) + logfile = process_args.get('logfile') if logfile: print("Firefox output (%s):" % logfile) with open(logfile) as f: print(f.read()) httpd.stop() - get_crashreports(profilePath, name="Profile initialization") + get_crashreports(profilePath, name='Profile initialization') sys.exit(ret) jarlog = os.getenv("JARLOG_FILE") @@ -180,55 +168,48 @@ if __name__ == "__main__": if os.path.exists(jarlog): os.remove(jarlog) - if "UPLOAD_PATH" in env: - process_args["logfile"] = os.path.join( - env["UPLOAD_PATH"], "profile-run-2.log" - ) + if 'UPLOAD_PATH' in env: + process_args['logfile'] = os.path.join(env['UPLOAD_PATH'], 'profile-run-2.log') cmdargs = ["http://localhost:%d/index.html" % PORT] - runner = FirefoxRunner( - profile=profile, - binary=binary, - cmdargs=cmdargs, - env=env, - process_args=process_args, - ) + runner = FirefoxRunner(profile=profile, + binary=binary, + cmdargs=cmdargs, + env=env, + process_args=process_args) runner.start(debug_args=debug_args, interactive=interactive) ret = runner.wait() httpd.stop() if ret: print("Firefox exited with code %d during profiling" % ret) - logfile = process_args.get("logfile") + logfile = process_args.get('logfile') if logfile: print("Firefox output (%s):" % logfile) with open(logfile) as f: print(f.read()) - get_crashreports(profilePath, name="Profiling run") + get_crashreports(profilePath, name='Profiling run') sys.exit(ret) # Try to move the crash reports to the artifacts even if Firefox appears # to exit successfully, in case there's a crash that doesn't set the # return code to non-zero for some reason. - if get_crashreports(profilePath, name="Firefox exited successfully?") != 0: + if get_crashreports(profilePath, name='Firefox exited successfully?') != 0: print("Firefox exited successfully, but produced a crashreport") sys.exit(1) - llvm_profdata = env.get("LLVM_PROFDATA") + llvm_profdata = env.get('LLVM_PROFDATA') if llvm_profdata: - profraw_files = glob.glob("*.profraw") + profraw_files = glob.glob('*.profraw') if not profraw_files: - print( - "Could not find profraw files in the current directory: %s" - % os.getcwd() - ) + print('Could not find profraw files in the current directory: %s' % os.getcwd()) sys.exit(1) merge_cmd = [ llvm_profdata, - "merge", - "-o", - "merged.profdata", + 'merge', + '-o', + 'merged.profdata', ] + profraw_files rc = subprocess.call(merge_cmd) if rc != 0: - print("INFRA-ERROR: Failed to merge profile data. Corrupt profile?") + print('INFRA-ERROR: Failed to merge profile data. Corrupt profile?') # exit with TBPL_RETRY sys.exit(4) diff --git a/build/submit_telemetry_data.py b/build/submit_telemetry_data.py index 0748fbfeadd2..700f7550f164 100644 --- a/build/submit_telemetry_data.py +++ b/build/submit_telemetry_data.py @@ -19,15 +19,15 @@ from mozbuild.telemetry import ( verify_statedir, ) -BUILD_TELEMETRY_URL = "https://incoming.telemetry.mozilla.org/{endpoint}" -SUBMIT_ENDPOINT = "submit/eng-workflow/build/1/{ping_uuid}" -STATUS_ENDPOINT = "status" +BUILD_TELEMETRY_URL = 'https://incoming.telemetry.mozilla.org/{endpoint}' +SUBMIT_ENDPOINT = 'submit/eng-workflow/build/1/{ping_uuid}' +STATUS_ENDPOINT = 'status' def delete_expired_files(directory, days=30): - """Discards files in a directory older than a specified number + '''Discards files in a directory older than a specified number of days - """ + ''' now = datetime.datetime.now() for filename in os.listdir(directory): filepath = os.path.join(directory, filename) @@ -42,9 +42,9 @@ def delete_expired_files(directory, days=30): def check_edge_server_status(session): - """Returns True if the Telemetry Edge Server + '''Returns True if the Telemetry Edge Server is ready to accept data - """ + ''' status_url = BUILD_TELEMETRY_URL.format(endpoint=STATUS_ENDPOINT) response = session.get(status_url) if response.status_code != 200: @@ -53,9 +53,9 @@ def check_edge_server_status(session): def send_telemetry_ping(session, data, ping_uuid): - """Sends a single build telemetry ping to the + '''Sends a single build telemetry ping to the edge server, returning the response object - """ + ''' resource_url = SUBMIT_ENDPOINT.format(ping_uuid=str(ping_uuid)) url = BUILD_TELEMETRY_URL.format(endpoint=resource_url) response = session.post(url, json=data) @@ -64,9 +64,9 @@ def send_telemetry_ping(session, data, ping_uuid): def submit_telemetry_data(outgoing, submitted): - """Sends information about `./mach build` invocations to + '''Sends information about `./mach build` invocations to the Telemetry pipeline - """ + ''' with requests.Session() as session: # Confirm the server is OK if not check_edge_server_status(session): @@ -76,14 +76,14 @@ def submit_telemetry_data(outgoing, submitted): for filename in os.listdir(outgoing): path = os.path.join(outgoing, filename) - if os.path.isdir(path) or not path.endswith(".json"): - logging.info("skipping item {}".format(path)) + if os.path.isdir(path) or not path.endswith('.json'): + logging.info('skipping item {}'.format(path)) continue ping_uuid = os.path.splitext(filename)[0] # strip ".json" to get ping UUID try: - with open(path, "r") as f: + with open(path, 'r') as f: data = json.load(f) # Verify the data matches the schema @@ -93,7 +93,7 @@ def submit_telemetry_data(outgoing, submitted): response = send_telemetry_ping(session, data, ping_uuid) if response.status_code != 200: - msg = "response code {code} sending {uuid} to telemetry: {body}".format( + msg = 'response code {code} sending {uuid} to telemetry: {body}'.format( body=response.content, code=response.status_code, uuid=ping_uuid, @@ -102,25 +102,27 @@ def submit_telemetry_data(outgoing, submitted): continue # Move from "outgoing" to "submitted" - os.rename( - os.path.join(outgoing, filename), os.path.join(submitted, filename) - ) + os.rename(os.path.join(outgoing, filename), + os.path.join(submitted, filename)) - logging.info("successfully posted {} to telemetry".format(ping_uuid)) + logging.info('successfully posted {} to telemetry'.format(ping_uuid)) except ValueError as ve: # ValueError is thrown if JSON cannot be decoded - logging.exception("exception parsing JSON at %s: %s" % (path, str(ve))) + logging.exception('exception parsing JSON at %s: %s' + % (path, str(ve))) os.remove(path) except voluptuous.Error as e: # Invalid is thrown if some data does not fit # the correct Schema - logging.exception("invalid data found at %s: %s" % (path, e.message)) + logging.exception('invalid data found at %s: %s' + % (path, e.message)) os.remove(path) except Exception as e: - logging.error("exception posting to telemetry " "server: %s" % str(e)) + logging.error('exception posting to telemetry ' + 'server: %s' % str(e)) break delete_expired_files(submitted) @@ -128,9 +130,9 @@ def submit_telemetry_data(outgoing, submitted): return 0 -if __name__ == "__main__": +if __name__ == '__main__': if len(sys.argv) != 2: - print("usage: python submit_telemetry_data.py ") + print('usage: python submit_telemetry_data.py ') sys.exit(1) statedir = sys.argv[1] @@ -139,11 +141,9 @@ if __name__ == "__main__": outgoing, submitted, telemetry_log = verify_statedir(statedir) # Configure logging - logging.basicConfig( - filename=telemetry_log, - format="%(asctime)s %(message)s", - level=logging.DEBUG, - ) + logging.basicConfig(filename=telemetry_log, + format='%(asctime)s %(message)s', + level=logging.DEBUG) sys.exit(submit_telemetry_data(outgoing, submitted)) diff --git a/build/unix/elfhack/inject/copy_source.py b/build/unix/elfhack/inject/copy_source.py index 02b4f6237e27..757253e3975e 100644 --- a/build/unix/elfhack/inject/copy_source.py +++ b/build/unix/elfhack/inject/copy_source.py @@ -6,5 +6,5 @@ def copy(out_file, in_path): - with open(in_path, "r") as fh: + with open(in_path, 'r') as fh: out_file.write(fh.read()) diff --git a/build/unix/elfhack/inject/moz.build b/build/unix/elfhack/inject/moz.build index 5b717a49cfeb..516104c06aaa 100644 --- a/build/unix/elfhack/inject/moz.build +++ b/build/unix/elfhack/inject/moz.build @@ -6,35 +6,35 @@ # dummy library name to avoid skipping building the source here, which # we only need the object for. -Library("elfhack_inject") +Library('elfhack_inject') DIST_INSTALL = False -cpu = CONFIG["CPU_ARCH"] +cpu = CONFIG['CPU_ARCH'] -gen_src = "%s.c" % cpu -GeneratedFile( - gen_src, script="copy_source.py", entry_point="copy", inputs=["../inject.c"] -) +gen_src = '%s.c' % cpu +GeneratedFile(gen_src, script='copy_source.py', entry_point='copy', + inputs = ['../inject.c']) SOURCES += [ - "!%s" % gen_src, + '!%s' % gen_src, ] NO_PGO = True -for v in ("OS_CPPFLAGS", "OS_CFLAGS", "DEBUG", "CLANG_PLUGIN", "OPTIMIZE", "FRAMEPTR"): +for v in ('OS_CPPFLAGS', 'OS_CFLAGS', 'DEBUG', 'CLANG_PLUGIN', 'OPTIMIZE', + 'FRAMEPTR'): flags = [] idx = 0 for flag in COMPILE_FLAGS[v]: - if flag == "-isystem": - flags.append("".join(COMPILE_FLAGS[v][idx : idx + 2])) - elif flag.startswith(("-m", "-I", "-isystem")): + if flag == '-isystem': + flags.append(''.join(COMPILE_FLAGS[v][idx:idx + 2])) + elif flag.startswith(('-m', '-I', '-isystem')): flags.append(flag) idx += 1 COMPILE_FLAGS[v] = flags -COMPILE_FLAGS["OS_CFLAGS"] += ["-O2", "-fno-stack-protector", "-fno-lto"] +COMPILE_FLAGS['OS_CFLAGS'] += ['-O2', '-fno-stack-protector', '-fno-lto'] AllowCompilerWarnings() NoVisibilityFlags() diff --git a/build/unix/elfhack/moz.build b/build/unix/elfhack/moz.build index bb68b3aa4e00..4c12e7e62ee4 100644 --- a/build/unix/elfhack/moz.build +++ b/build/unix/elfhack/moz.build @@ -5,28 +5,29 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. DIST_INSTALL = False -DIRS += ["inject"] +DIRS += ['inject'] -if not CONFIG["CROSS_COMPILE"]: +if not CONFIG['CROSS_COMPILE']: SOURCES += [ - "dummy.c", - "test-array.c", - "test-ctors.c", + 'dummy.c', + 'test-array.c', + 'test-ctors.c', ] - SOURCES["dummy.c"].flags += ["-fno-lto"] - SOURCES["test-array.c"].flags += ["-fno-lto"] - SOURCES["test-ctors.c"].flags += ["-fno-lto"] + SOURCES['dummy.c'].flags += ['-fno-lto'] + SOURCES['test-array.c'].flags += ['-fno-lto'] + SOURCES['test-ctors.c'].flags += ['-fno-lto'] HOST_SOURCES += [ - "elf.cpp", - "elfhack.cpp", + 'elf.cpp', + 'elfhack.cpp', ] -HostProgram("elfhack") +HostProgram('elfhack') NO_PGO = True -COMPILE_FLAGS["OS_CXXFLAGS"] = [ - f for f in COMPILE_FLAGS["OS_CXXFLAGS"] if f != "-fno-exceptions" -] + ["-fexceptions"] +COMPILE_FLAGS['OS_CXXFLAGS'] = [ + f for f in COMPILE_FLAGS['OS_CXXFLAGS'] if f != '-fno-exceptions' +] + ['-fexceptions'] + diff --git a/build/unix/moz.build b/build/unix/moz.build index 3e2a9047a269..95e5b92ac6c3 100644 --- a/build/unix/moz.build +++ b/build/unix/moz.build @@ -4,12 +4,12 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -if CONFIG["MOZ_LIBSTDCXX_TARGET_VERSION"] or CONFIG["MOZ_LIBSTDCXX_HOST_VERSION"]: - DIRS += ["stdc++compat"] +if CONFIG['MOZ_LIBSTDCXX_TARGET_VERSION'] or CONFIG['MOZ_LIBSTDCXX_HOST_VERSION']: + DIRS += ['stdc++compat'] -if CONFIG["USE_ELF_HACK"]: - DIRS += ["elfhack"] +if CONFIG['USE_ELF_HACK']: + DIRS += ['elfhack'] FINAL_TARGET_FILES += [ - "run-mozilla.sh", + 'run-mozilla.sh', ] diff --git a/build/unix/rewrite_asan_dylib.py b/build/unix/rewrite_asan_dylib.py index 0bcf31b559ad..ada15fa690b2 100644 --- a/build/unix/rewrite_asan_dylib.py +++ b/build/unix/rewrite_asan_dylib.py @@ -11,20 +11,19 @@ import subprocess import shutil from buildconfig import substs -""" +''' Scans the given directories for binaries referencing the AddressSanitizer runtime library, copies it to the main directory and rewrites binaries to not reference it with absolute paths but with @executable_path instead. -""" +''' # This is the dylib we're looking for -DYLIB_NAME = "libclang_rt.asan_osx_dynamic.dylib" +DYLIB_NAME = 'libclang_rt.asan_osx_dynamic.dylib' def resolve_rpath(filename): - otoolOut = subprocess.check_output( - [substs["OTOOL"], "-l", filename], universal_newlines=True - ) + otoolOut = subprocess.check_output([substs['OTOOL'], '-l', filename], + universal_newlines=True) currentCmd = None # The lines we need to find look like this: @@ -37,19 +36,19 @@ def resolve_rpath(filename): # ... # Other load command types have a varying number of fields. for line in otoolOut.splitlines(): - cmdMatch = re.match(r"^\s+cmd ([A-Z_]+)", line) + cmdMatch = re.match(r'^\s+cmd ([A-Z_]+)', line) if cmdMatch is not None: currentCmd = cmdMatch.group(1) continue - if currentCmd == "LC_RPATH": - pathMatch = re.match(r"^\s+path (.*) \(offset \d+\)", line) + if currentCmd == 'LC_RPATH': + pathMatch = re.match(r'^\s+path (.*) \(offset \d+\)', line) if pathMatch is not None: path = pathMatch.group(1) if os.path.isdir(path): return path - sys.stderr.write("@rpath could not be resolved from %s\n" % filename) + sys.stderr.write('@rpath could not be resolved from %s\n' % filename) sys.exit(1) @@ -61,13 +60,12 @@ def scan_directory(path): filename = os.path.join(root, filename) # Skip all files that aren't either dylibs or executable - if not (filename.endswith(".dylib") or os.access(filename, os.X_OK)): + if not (filename.endswith('.dylib') or os.access(filename, os.X_OK)): continue try: otoolOut = subprocess.check_output( - [substs["OTOOL"], "-L", filename], universal_newlines=True - ) + [substs['OTOOL'], '-L', filename], universal_newlines=True) except Exception: # Errors are expected on non-mach executables, ignore them and continue continue @@ -77,13 +75,14 @@ def scan_directory(path): absDylibPath = line.split()[0] # Don't try to rewrite binaries twice - if absDylibPath.startswith("@executable_path/"): + if absDylibPath.startswith('@executable_path/'): continue if not dylibCopied: - if absDylibPath.startswith("@rpath/"): + if absDylibPath.startswith('@rpath/'): rpath = resolve_rpath(filename) - copyDylibPath = absDylibPath.replace("@rpath", rpath) + copyDylibPath = absDylibPath.replace( + '@rpath', rpath) else: copyDylibPath = absDylibPath @@ -94,38 +93,28 @@ def scan_directory(path): # Now rewrite the library itself subprocess.check_call( - [ - substs["INSTALL_NAME_TOOL"], - "-id", - "@executable_path/" + DYLIB_NAME, - os.path.join(path, DYLIB_NAME), - ] - ) + [substs['INSTALL_NAME_TOOL'], '-id', + '@executable_path/' + DYLIB_NAME, + os.path.join(path, DYLIB_NAME)]) dylibCopied = True else: - sys.stderr.write( - "dylib path in %s was not found at: %s\n" - % (filename, copyDylibPath) - ) + sys.stderr.write('dylib path in %s was not found at: %s\n' % ( + filename, copyDylibPath)) # Now use install_name_tool to rewrite the path in our binary - relpath = "" if path == root else os.path.relpath(path, root) + "/" - subprocess.check_call( - [ - substs["INSTALL_NAME_TOOL"], - "-change", - absDylibPath, - "@executable_path/" + relpath + DYLIB_NAME, - filename, - ] - ) + relpath = '' if path == root else os.path.relpath( + path, root) + '/' + subprocess.check_call([substs['INSTALL_NAME_TOOL'], '-change', + absDylibPath, + '@executable_path/' + relpath + DYLIB_NAME, + filename]) break if not dylibCopied: - sys.stderr.write("%s could not be found\n" % DYLIB_NAME) + sys.stderr.write('%s could not be found\n' % DYLIB_NAME) sys.exit(1) -if __name__ == "__main__": +if __name__ == '__main__': for d in sys.argv[1:]: scan_directory(d) diff --git a/build/unix/stdc++compat/moz.build b/build/unix/stdc++compat/moz.build index aac8f2b0f591..4444d0c4f297 100644 --- a/build/unix/stdc++compat/moz.build +++ b/build/unix/stdc++compat/moz.build @@ -4,14 +4,14 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -if CONFIG["MOZ_LIBSTDCXX_TARGET_VERSION"]: - Library("stdc++compat") - SOURCES += ["stdc++compat.cpp"] +if CONFIG['MOZ_LIBSTDCXX_TARGET_VERSION']: + Library('stdc++compat') + SOURCES += ['stdc++compat.cpp'] -if CONFIG["MOZ_LIBSTDCXX_HOST_VERSION"]: - HostLibrary("host_stdc++compat") +if CONFIG['MOZ_LIBSTDCXX_HOST_VERSION']: + HostLibrary('host_stdc++compat') HOST_SOURCES += [ - "stdc++compat.cpp", + 'stdc++compat.cpp', ] FORCE_STATIC_LIB = True @@ -19,9 +19,9 @@ FORCE_STATIC_LIB = True NO_PGO = True DisableStlWrapping() -COMPILE_FLAGS["CLANG_PLUGIN"] = [] +COMPILE_FLAGS['CLANG_PLUGIN'] = [] -DEFINES["MOZ_LIBSTDCXX_VERSION"] = CONFIG["MOZ_LIBSTDCXX_TARGET_VERSION"] -HOST_DEFINES["MOZ_LIBSTDCXX_VERSION"] = CONFIG["MOZ_LIBSTDCXX_HOST_VERSION"] +DEFINES['MOZ_LIBSTDCXX_VERSION'] = CONFIG['MOZ_LIBSTDCXX_TARGET_VERSION'] +HOST_DEFINES['MOZ_LIBSTDCXX_VERSION'] = CONFIG['MOZ_LIBSTDCXX_HOST_VERSION'] -OS_LIBS += ["-Wl,--version-script,%s/hide_std.ld" % SRCDIR] +OS_LIBS += ['-Wl,--version-script,%s/hide_std.ld' % SRCDIR] diff --git a/build/upload.py b/build/upload.py index 4742b284583a..89de5e6a7aec 100644 --- a/build/upload.py +++ b/build/upload.py @@ -34,14 +34,14 @@ def FixupMsysPath(path): and commandline arguments into Windows native paths. This sucks if you're trying to pass an absolute path on a remote server. This function attempts to un-mangle such paths.""" - if "OSTYPE" in os.environ and os.environ["OSTYPE"] == "msys": + if 'OSTYPE' in os.environ and os.environ['OSTYPE'] == 'msys': # sort of awful, find out where our shell is (should be in msys/bin) # and strip the first part of that path out of the other path - if "SHELL" in os.environ: - sh = os.environ["SHELL"] - msys = sh[: sh.find("/bin")] + if 'SHELL' in os.environ: + sh = os.environ['SHELL'] + msys = sh[:sh.find('/bin')] if path.startswith(msys): - path = path[len(msys) :] + path = path[len(msys):] return path @@ -55,7 +55,7 @@ def GetBaseRelativePath(path, local_file, base_path): dir = os.path.dirname(local_file) # strip base_path + extra slash and make it unixy - dir = dir[len(base_path) + 1 :].replace("\\", "/") + dir = dir[len(base_path) + 1:].replace('\\', '/') return path + dir @@ -79,28 +79,26 @@ def CopyFilesLocally(path, files, verbose=False, base_path=None): shutil.copy(file, target_path) -if __name__ == "__main__": - path = OptionalEnvironmentVariable("UPLOAD_PATH") +if __name__ == '__main__': + path = OptionalEnvironmentVariable('UPLOAD_PATH') - if sys.platform == "win32": + if sys.platform == 'win32': if path is not None: path = FixupMsysPath(path) parser = OptionParser(usage="usage: %prog [options] ") - parser.add_option( - "-b", - "--base-path", - action="store", - help="Preserve file paths relative to this path when uploading. " - "If unset, all files will be uploaded directly to UPLOAD_PATH.", - ) + parser.add_option("-b", "--base-path", + action="store", + help="Preserve file paths relative to this path when uploading. " + "If unset, all files will be uploaded directly to UPLOAD_PATH.") (options, args) = parser.parse_args() if len(args) < 1: print("You must specify at least one file to upload") sys.exit(1) try: - CopyFilesLocally(path, args, base_path=options.base_path, verbose=True) + CopyFilesLocally(path, args, base_path=options.base_path, + verbose=True) except IOError as strerror: print(strerror) sys.exit(1) diff --git a/build/upload_generated_sources.py b/build/upload_generated_sources.py index 4a528b106eb5..0b5768cdf8d9 100644 --- a/build/upload_generated_sources.py +++ b/build/upload_generated_sources.py @@ -26,30 +26,29 @@ import time # Arbitrary, should probably measure this. NUM_WORKER_THREADS = 10 -log = logging.getLogger("upload-generated-sources") +log = logging.getLogger('upload-generated-sources') log.setLevel(logging.INFO) @contextmanager def timed(): - """ + ''' Yield a function that provides the elapsed time in seconds since this function was called. - """ + ''' start = time.time() def elapsed(): return time.time() - start - yield elapsed def gzip_compress(data): - """ + ''' Apply gzip compression to `data` and return the result as a `BytesIO`. - """ + ''' b = io.BytesIO() - with gzip.GzipFile(fileobj=b, mode="w") as f: + with gzip.GzipFile(fileobj=b, mode='w') as f: f.write(data) b.flush() b.seek(0) @@ -57,17 +56,16 @@ def gzip_compress(data): def upload_worker(queue, event, bucket, session_args): - """ + ''' Get `(name, contents)` entries from `queue` and upload `contents` to S3 with gzip compression using `name` as the key, prefixed with the SHA-512 digest of `contents` as a hex string. If an exception occurs, set `event`. - """ + ''' try: import boto3 - session = boto3.session.Session(**session_args) - s3 = session.client("s3") + s3 = session.client('s3') while True: if event.is_set(): # Some other thread hit an exception. @@ -76,68 +74,63 @@ def upload_worker(queue, event, bucket, session_args): pathname = get_filename_with_digest(name, contents) compressed = gzip_compress(contents) extra_args = { - "ContentEncoding": "gzip", - "ContentType": "text/plain", + 'ContentEncoding': 'gzip', + 'ContentType': 'text/plain', } - log.info( - 'Uploading "{}" ({} bytes)'.format(pathname, len(compressed.getvalue())) - ) + log.info('Uploading "{}" ({} bytes)'.format( + pathname, len(compressed.getvalue()))) with timed() as elapsed: - s3.upload_fileobj(compressed, bucket, pathname, ExtraArgs=extra_args) - log.info( - 'Finished uploading "{}" in {:0.3f}s'.format(pathname, elapsed()) - ) + s3.upload_fileobj(compressed, bucket, + pathname, ExtraArgs=extra_args) + log.info('Finished uploading "{}" in {:0.3f}s'.format( + pathname, elapsed())) queue.task_done() except Exception: - log.exception("Thread encountered exception:") + log.exception('Thread encountered exception:') event.set() def do_work(artifact, region, bucket): - session_args = {"region_name": region} + session_args = {'region_name': region} session = requests.Session() - retry = Retry(total=5, backoff_factor=0.1, status_forcelist=[500, 502, 503, 504]) + retry = Retry(total=5, backoff_factor=0.1, + status_forcelist=[500, 502, 503, 504]) http_adapter = requests.adapters.HTTPAdapter(max_retries=retry) - session.mount("https://", http_adapter) - session.mount("http://", http_adapter) + session.mount('https://', http_adapter) + session.mount('http://', http_adapter) - if "TASK_ID" in os.environ: - level = os.environ.get("MOZ_SCM_LEVEL", "1") - secrets_url = "http://taskcluster/secrets/v1/secret/project/releng/gecko/build/level-{}/gecko-generated-sources-upload".format( # noqa - level - ) + if 'TASK_ID' in os.environ: + level = os.environ.get('MOZ_SCM_LEVEL', '1') + secrets_url = 'http://taskcluster/secrets/v1/secret/project/releng/gecko/build/level-{}/gecko-generated-sources-upload'.format( # noqa + level) log.info( - 'Using AWS credentials from the secrets service: "{}"'.format(secrets_url) - ) + 'Using AWS credentials from the secrets service: "{}"'.format(secrets_url)) res = session.get(secrets_url) res.raise_for_status() secret = res.json() session_args.update( - aws_access_key_id=secret["secret"]["AWS_ACCESS_KEY_ID"], - aws_secret_access_key=secret["secret"]["AWS_SECRET_ACCESS_KEY"], + aws_access_key_id=secret['secret']['AWS_ACCESS_KEY_ID'], + aws_secret_access_key=secret['secret']['AWS_SECRET_ACCESS_KEY'], ) else: - log.info("Trying to use your AWS credentials..") + log.info('Trying to use your AWS credentials..') # First, fetch the artifact containing the sources. log.info('Fetching generated sources artifact: "{}"'.format(artifact)) with timed() as elapsed: res = session.get(artifact) - log.info( - "Fetch HTTP status: {}, {} bytes downloaded in {:0.3f}s".format( - res.status_code, len(res.content), elapsed() - ) - ) + log.info('Fetch HTTP status: {}, {} bytes downloaded in {:0.3f}s'.format( + res.status_code, len(res.content), elapsed())) res.raise_for_status() # Create a queue and worker threads for uploading. q = Queue() event = Event() - log.info("Creating {} worker threads".format(NUM_WORKER_THREADS)) + log.info('Creating {} worker threads'.format(NUM_WORKER_THREADS)) for i in range(NUM_WORKER_THREADS): t = Thread(target=upload_worker, args=(q, event, bucket, session_args)) t.daemon = True t.start() - with tarfile.open(fileobj=io.BytesIO(res.content), mode="r|gz") as tar: + with tarfile.open(fileobj=io.BytesIO(res.content), mode='r|gz') as tar: # Next, process each file. for entry in tar: if event.is_set(): @@ -148,28 +141,28 @@ def do_work(artifact, region, bucket): # We don't use q.join() here because we want to also monitor event. while q.unfinished_tasks: if event.wait(0.1): - log.error("Worker thread encountered exception, exiting...") + log.error('Worker thread encountered exception, exiting...') break def main(argv): - logging.basicConfig(format="%(levelname)s - %(threadName)s - %(message)s") + logging.basicConfig(format='%(levelname)s - %(threadName)s - %(message)s') parser = argparse.ArgumentParser( - description="Upload generated source files in ARTIFACT to BUCKET in S3." - ) - parser.add_argument("artifact", help="generated-sources artifact from build task") + description='Upload generated source files in ARTIFACT to BUCKET in S3.') + parser.add_argument('artifact', + help='generated-sources artifact from build task') args = parser.parse_args(argv) region, bucket = get_s3_region_and_bucket() config = MozbuildObject.from_environment() config.activate_virtualenv() - config.virtualenv_manager.install_pip_package("boto3==1.4.4") + config.virtualenv_manager.install_pip_package('boto3==1.4.4') with timed() as elapsed: do_work(region=region, bucket=bucket, artifact=args.artifact) - log.info("Finished in {:.03f}s".format(elapsed())) + log.info('Finished in {:.03f}s'.format(elapsed())) return 0 -if __name__ == "__main__": +if __name__ == '__main__': sys.exit(main(sys.argv[1:])) diff --git a/build/valgrind/mach_commands.py b/build/valgrind/mach_commands.py index 408c0be28c14..26801bc41c53 100644 --- a/build/valgrind/mach_commands.py +++ b/build/valgrind/mach_commands.py @@ -22,32 +22,24 @@ from mozbuild.base import ( def is_valgrind_build(cls): - """Must be a build with --enable-valgrind and --disable-jemalloc.""" + '''Must be a build with --enable-valgrind and --disable-jemalloc.''' defines = cls.config_environment.defines - return "MOZ_VALGRIND" in defines and "MOZ_MEMORY" not in defines + return 'MOZ_VALGRIND' in defines and 'MOZ_MEMORY' not in defines @CommandProvider class MachCommands(MachCommandBase): - """ + ''' Run Valgrind tests. - """ - - @Command( - "valgrind-test", - category="testing", - conditions=[conditions.is_firefox_or_thunderbird, is_valgrind_build], - description="Run the Valgrind test job (memory-related errors).", - ) - @CommandArgument( - "--suppressions", - default=[], - action="append", - metavar="FILENAME", - help="Specify a suppression file for Valgrind to use. Use " - "--suppression multiple times to specify multiple suppression " - "files.", - ) + ''' + @Command('valgrind-test', category='testing', + conditions=[conditions.is_firefox_or_thunderbird, is_valgrind_build], + description='Run the Valgrind test job (memory-related errors).') + @CommandArgument('--suppressions', default=[], action='append', + metavar='FILENAME', + help='Specify a suppression file for Valgrind to use. Use ' + '--suppression multiple times to specify multiple suppression ' + 'files.') def valgrind_test(self, suppressions): from mozfile import TemporaryDirectory @@ -59,29 +51,28 @@ class MachCommands(MachCommandBase): from six import string_types from valgrind.output_handler import OutputHandler - build_dir = os.path.join(self.topsrcdir, "build") + build_dir = os.path.join(self.topsrcdir, 'build') # XXX: currently we just use the PGO inputs for Valgrind runs. This may # change in the future. - httpd = MozHttpd(docroot=os.path.join(build_dir, "pgo")) + httpd = MozHttpd(docroot=os.path.join(build_dir, 'pgo')) httpd.start(block=False) with TemporaryDirectory() as profilePath: # TODO: refactor this into mozprofile - profile_data_dir = os.path.join(self.topsrcdir, "testing", "profiles") - with open(os.path.join(profile_data_dir, "profiles.json"), "r") as fh: - base_profiles = json.load(fh)["valgrind"] + profile_data_dir = os.path.join( + self.topsrcdir, 'testing', 'profiles') + with open(os.path.join(profile_data_dir, 'profiles.json'), 'r') as fh: + base_profiles = json.load(fh)['valgrind'] - prefpaths = [ - os.path.join(profile_data_dir, profile, "user.js") - for profile in base_profiles - ] + prefpaths = [os.path.join(profile_data_dir, profile, 'user.js') + for profile in base_profiles] prefs = {} for path in prefpaths: prefs.update(Preferences.read_prefs(path)) interpolation = { - "server": "%s:%d" % httpd.httpd.server_address, + 'server': '%s:%d' % httpd.httpd.server_address, } for k, v in prefs.items(): if isinstance(v, string_types): @@ -89,93 +80,88 @@ class MachCommands(MachCommandBase): prefs[k] = Preferences.cast(v) quitter = os.path.join( - self.topsrcdir, "tools", "quitter", "quitter@mozilla.org.xpi" - ) + self.topsrcdir, 'tools', 'quitter', 'quitter@mozilla.org.xpi') locations = ServerLocations() - locations.add_host( - host="127.0.0.1", port=httpd.httpd.server_port, options="primary" - ) + locations.add_host(host='127.0.0.1', + port=httpd.httpd.server_port, + options='primary') - profile = FirefoxProfile( - profile=profilePath, - preferences=prefs, - addons=[quitter], - locations=locations, - ) + profile = FirefoxProfile(profile=profilePath, + preferences=prefs, + addons=[quitter], + locations=locations) firefox_args = [httpd.get_url()] env = os.environ.copy() - env["G_SLICE"] = "always-malloc" - env["MOZ_CC_RUN_DURING_SHUTDOWN"] = "1" - env["MOZ_CRASHREPORTER_NO_REPORT"] = "1" - env["MOZ_DISABLE_NONLOCAL_CONNECTIONS"] = "1" - env["XPCOM_DEBUG_BREAK"] = "warn" + env['G_SLICE'] = 'always-malloc' + env['MOZ_CC_RUN_DURING_SHUTDOWN'] = '1' + env['MOZ_CRASHREPORTER_NO_REPORT'] = '1' + env['MOZ_DISABLE_NONLOCAL_CONNECTIONS'] = '1' + env['XPCOM_DEBUG_BREAK'] = 'warn' outputHandler = OutputHandler(self.log) kp_kwargs = { - "processOutputLine": [outputHandler], - "universal_newlines": True, + 'processOutputLine': [outputHandler], + 'universal_newlines': True, } - valgrind = "valgrind" + valgrind = 'valgrind' if not os.path.exists(valgrind): valgrind = findInPath(valgrind) valgrind_args = [ valgrind, - "--sym-offsets=yes", - "--smc-check=all-non-file", - "--vex-iropt-register-updates=allregs-at-mem-access", - "--gen-suppressions=all", - "--num-callers=36", - "--leak-check=full", - "--show-possibly-lost=no", - "--track-origins=yes", - "--trace-children=yes", - "-v", # Enable verbosity to get the list of used suppressions + '--sym-offsets=yes', + '--smc-check=all-non-file', + '--vex-iropt-register-updates=allregs-at-mem-access', + '--gen-suppressions=all', + '--num-callers=36', + '--leak-check=full', + '--show-possibly-lost=no', + '--track-origins=yes', + '--trace-children=yes', + '-v', # Enable verbosity to get the list of used suppressions # Avoid excessive delays in the presence of spinlocks. # See bug 1309851. - "--fair-sched=yes", + '--fair-sched=yes', # Keep debuginfo after library unmap. See bug 1382280. - "--keep-debuginfo=yes", + '--keep-debuginfo=yes', # Reduce noise level on rustc and/or LLVM compiled code. # See bug 1365915 - "--expensive-definedness-checks=yes", + '--expensive-definedness-checks=yes', # Compensate for the compiler inlining `new` but not `delete` # or vice versa. - "--show-mismatched-frees=no", + '--show-mismatched-frees=no', ] for s in suppressions: - valgrind_args.append("--suppressions=" + s) + valgrind_args.append('--suppressions=' + s) - supps_dir = os.path.join(build_dir, "valgrind") - supps_file1 = os.path.join(supps_dir, "cross-architecture.sup") - valgrind_args.append("--suppressions=" + supps_file1) + supps_dir = os.path.join(build_dir, 'valgrind') + supps_file1 = os.path.join(supps_dir, 'cross-architecture.sup') + valgrind_args.append('--suppressions=' + supps_file1) - if mozinfo.os == "li