2016-07-14 19:16:42 +03:00
|
|
|
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
2016-03-24 02:36:23 +03:00
|
|
|
# vim: set filetype=python:
|
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# 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/.
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
imply_option("--enable-release", mozilla_official)
|
|
|
|
imply_option("--enable-release", depends_if("MOZ_AUTOMATION")(lambda x: True))
|
2018-05-31 04:16:10 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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.|}",
|
|
|
|
)
|
2018-05-31 04:16:10 +03:00
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends("--enable-release")
|
2018-05-31 04:16:10 +03:00
|
|
|
def developer_options(value):
|
|
|
|
if not value:
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
add_old_configure_assignment("DEVELOPER_OPTIONS", developer_options)
|
|
|
|
set_config("DEVELOPER_OPTIONS", developer_options)
|
2018-05-31 04:16:10 +03:00
|
|
|
|
2017-10-25 05:54:48 +03:00
|
|
|
# Code optimization
|
|
|
|
# ==============================================================
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option("--disable-optimize", nargs="?", help="Disable optimizations via compiler flags")
|
2017-10-25 05:54:48 +03:00
|
|
|
|
2017-10-25 20:57:51 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends("--enable-optimize", "--help")
|
2019-06-13 01:30:46 +03:00
|
|
|
def moz_optimize(option, _):
|
2017-10-25 05:54:48 +03:00
|
|
|
flags = None
|
|
|
|
|
|
|
|
if len(option):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
val = "2"
|
2017-10-25 05:54:48 +03:00
|
|
|
flags = option[0]
|
|
|
|
elif option:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
val = "1"
|
2017-10-25 05:54:48 +03:00
|
|
|
else:
|
|
|
|
val = None
|
|
|
|
|
|
|
|
return namespace(
|
|
|
|
optimize=val,
|
|
|
|
flags=flags,
|
|
|
|
)
|
|
|
|
|
2017-10-25 20:57:51 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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)
|
2017-10-25 05:54:48 +03:00
|
|
|
|
2016-03-24 02:36:23 +03:00
|
|
|
# yasm detection
|
|
|
|
# ==============================================================
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
yasm = check_prog("YASM", ["yasm"], allow_missing=True)
|
2016-03-24 02:36:23 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
2016-03-24 09:26:32 +03:00
|
|
|
@depends_if(yasm)
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@checking("yasm version")
|
2016-03-24 02:36:23 +03:00
|
|
|
def yasm_version(yasm):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
version = (
|
|
|
|
check_cmd_output(
|
|
|
|
yasm, "--version", onerror=lambda: die("Failed to get yasm version.")
|
|
|
|
)
|
|
|
|
.splitlines()[0]
|
|
|
|
.split()[1]
|
|
|
|
)
|
2016-06-09 09:27:59 +03:00
|
|
|
return Version(version)
|
2016-03-24 02:36:23 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
2016-03-24 02:36:23 +03:00
|
|
|
@depends(yasm, target)
|
|
|
|
def yasm_asflags(yasm, target):
|
|
|
|
if yasm:
|
|
|
|
asflags = {
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
("OSX", "x86"): ["-f", "macho32"],
|
|
|
|
("OSX", "x86_64"): ["-f", "macho64"],
|
|
|
|
("WINNT", "x86"): ["-f", "win32"],
|
|
|
|
("WINNT", "x86_64"): ["-f", "x64"],
|
2016-03-24 02:36:23 +03:00
|
|
|
}.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.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if target.cpu == "x86":
|
|
|
|
asflags = ["-f", "elf32"]
|
|
|
|
elif target.cpu == "x86_64":
|
|
|
|
asflags = ["-f", "elf64"]
|
2016-03-24 02:36:23 +03:00
|
|
|
if asflags:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
asflags += ["-rnasm", "-pnasm"]
|
2016-03-24 02:36:23 +03:00
|
|
|
return asflags
|
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("YASM_ASFLAGS", yasm_asflags)
|
2016-03-24 02:36:23 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
2016-04-02 05:23:40 +03:00
|
|
|
# Android NDK
|
|
|
|
# ==============================================================
|
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends("--disable-compile-environment", target)
|
2019-01-17 07:14:50 +03:00
|
|
|
def compiling_android(compile_env, target):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
return compile_env and target.os == "Android"
|
2016-04-02 05:23:40 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
include("android-ndk.configure", when=compiling_android)
|
2016-04-02 05:23:40 +03:00
|
|
|
|
2018-12-13 10:12:35 +03:00
|
|
|
with only_when(target_is_osx):
|
|
|
|
# MacOS deployment target version
|
|
|
|
# ==============================================================
|
|
|
|
# This needs to happen before any compilation test is done.
|
2016-04-21 02:11:32 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option(
|
|
|
|
"--enable-macos-target",
|
|
|
|
env="MACOSX_DEPLOYMENT_TARGET",
|
|
|
|
nargs=1,
|
|
|
|
default="10.9",
|
|
|
|
help="Set the minimum MacOS version needed at runtime",
|
|
|
|
)
|
2017-10-12 16:22:59 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends("--enable-macos-target")
|
|
|
|
@imports(_from="os", _import="environ")
|
2018-12-13 10:12:35 +03:00
|
|
|
def macos_target(value):
|
|
|
|
if value:
|
|
|
|
# Ensure every compiler process we spawn uses this value.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
environ["MACOSX_DEPLOYMENT_TARGET"] = value[0]
|
2018-12-13 10:12:35 +03:00
|
|
|
return value[0]
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("MACOSX_DEPLOYMENT_TARGET", macos_target)
|
|
|
|
add_old_configure_assignment("MACOSX_DEPLOYMENT_TARGET", macos_target)
|
2018-12-13 10:12:35 +03:00
|
|
|
|
2019-07-03 02:25:01 +03:00
|
|
|
|
|
|
|
@depends(host)
|
|
|
|
def host_is_osx(host):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if host.os == "OSX":
|
2019-07-03 02:25:01 +03:00
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
with only_when(host_is_osx | target_is_osx):
|
2018-12-13 10:12:35 +03:00
|
|
|
# MacOS SDK
|
|
|
|
# =========
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option(
|
|
|
|
"--with-macos-sdk",
|
|
|
|
env="MACOS_SDK_DIR",
|
|
|
|
nargs=1,
|
|
|
|
help="Location of platform SDK to use",
|
|
|
|
)
|
2018-12-13 10:12:35 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends("--with-macos-sdk", host)
|
|
|
|
@imports(_from="os.path", _import="isdir")
|
|
|
|
@imports(_from="biplist", _import="readPlist")
|
2019-07-04 01:11:05 +03:00
|
|
|
def macos_sdk(sdk, host):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
sdk_min_version = Version("10.11")
|
|
|
|
sdk_max_version = Version("11.0")
|
2019-01-11 22:59:23 +03:00
|
|
|
|
2019-07-04 01:11:05 +03:00
|
|
|
if sdk:
|
|
|
|
sdk = sdk[0]
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
elif host.os == "OSX":
|
|
|
|
sdk = check_cmd_output(
|
|
|
|
"xcrun", "--show-sdk-path", onerror=lambda: ""
|
|
|
|
).rstrip()
|
2019-07-04 01:11:05 +03:00
|
|
|
if not sdk:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
die(
|
|
|
|
"Could not find the macOS SDK. Please use --with-macos-sdk to give "
|
|
|
|
"the path to a macOS SDK."
|
|
|
|
)
|
2019-07-04 01:11:05 +03:00
|
|
|
else:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
die(
|
|
|
|
"Need a macOS SDK when targeting macOS. Please use --with-macos-sdk "
|
|
|
|
"to give the path to a macOS SDK."
|
|
|
|
)
|
2019-07-04 01:11:05 +03:00
|
|
|
|
|
|
|
if not isdir(sdk):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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"))
|
2019-01-11 22:59:23 +03:00
|
|
|
if not obj:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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"])
|
2019-01-11 22:59:23 +03:00
|
|
|
if version < sdk_min_version:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
die(
|
|
|
|
'SDK version "%s" is too old. Please upgrade to at least %s. '
|
|
|
|
"You may need to point to it using --with-macos-sdk=<path> in your "
|
|
|
|
"mozconfig." % (version, sdk_min_version)
|
|
|
|
)
|
2019-01-11 22:59:23 +03:00
|
|
|
if version > sdk_max_version:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
die(
|
|
|
|
'SDK version "%s" is unsupported. Please downgrade to version '
|
|
|
|
"%s. You may need to point to it using --with-macos-sdk=<path> in "
|
|
|
|
"your mozconfig." % (version, sdk_max_version)
|
|
|
|
)
|
2019-07-04 01:11:05 +03:00
|
|
|
return sdk
|
2016-04-21 02:11:32 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("MACOS_SDK_DIR", macos_sdk)
|
2018-12-13 10:12:35 +03:00
|
|
|
|
2019-07-03 02:25:01 +03:00
|
|
|
|
|
|
|
with only_when(target_is_osx):
|
2018-12-13 10:12:35 +03:00
|
|
|
with only_when(cross_compiling):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option(
|
|
|
|
"--with-macos-private-frameworks",
|
|
|
|
env="MACOS_PRIVATE_FRAMEWORKS_DIR",
|
|
|
|
nargs=1,
|
|
|
|
help="Location of private frameworks to use",
|
|
|
|
)
|
2018-12-13 10:12:35 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends_if("--with-macos-private-frameworks")
|
|
|
|
@imports(_from="os.path", _import="isdir")
|
2018-12-13 10:12:35 +03:00
|
|
|
def macos_private_frameworks(value):
|
|
|
|
if value and not isdir(value[0]):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
die(
|
|
|
|
"PrivateFrameworks not found not found in %s. When using "
|
|
|
|
"--with-macos-private-frameworks, you must specify a valid "
|
|
|
|
"directory",
|
|
|
|
value[0],
|
|
|
|
)
|
2018-12-13 10:12:35 +03:00
|
|
|
return value[0]
|
|
|
|
|
|
|
|
@depends(macos_private_frameworks)
|
|
|
|
def macos_private_frameworks(value):
|
|
|
|
if value:
|
|
|
|
return value
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
return "/System/Library/PrivateFrameworks"
|
2018-12-13 10:12:35 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("MACOS_PRIVATE_FRAMEWORKS_DIR", macos_private_frameworks)
|
2016-04-21 02:11:32 +03:00
|
|
|
|
|
|
|
|
2016-03-25 15:14:59 +03:00
|
|
|
# Compiler wrappers
|
|
|
|
# ==============================================================
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option(
|
|
|
|
"--with-compiler-wrapper",
|
|
|
|
env="COMPILER_WRAPPER",
|
|
|
|
nargs=1,
|
|
|
|
help="Enable compiling with wrappers such as distcc and ccache",
|
|
|
|
)
|
2016-03-25 15:14:59 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option("--with-ccache", env="CCACHE", nargs="?", help="Enable compiling with ccache")
|
2016-03-25 15:14:59 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends_if("--with-ccache")
|
2016-03-25 15:14:59 +03:00
|
|
|
def ccache(value):
|
|
|
|
if len(value):
|
|
|
|
return value
|
|
|
|
# If --with-ccache was given without an explicit value, we default to
|
|
|
|
# 'ccache'.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
return "ccache"
|
2016-03-25 15:14:59 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
ccache = check_prog("CCACHE", progs=(), input=ccache)
|
2016-03-25 15:14:59 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option(env="CCACHE_PREFIX", nargs=1, help="Compiler prefix to use when using ccache")
|
2019-02-25 22:06:27 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
ccache_prefix = depends_if("CCACHE_PREFIX")(lambda prefix: prefix[0])
|
|
|
|
set_config("CCACHE_PREFIX", ccache_prefix)
|
2019-02-25 22:06:27 +03:00
|
|
|
|
2016-08-26 01:39:57 +03:00
|
|
|
# Distinguish ccache from sccache.
|
2017-10-12 16:22:59 +03:00
|
|
|
|
|
|
|
|
2016-03-25 15:14:59 +03:00
|
|
|
@depends_if(ccache)
|
2016-08-26 01:39:57 +03:00
|
|
|
def ccache_is_sccache(ccache):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
return check_cmd_output(ccache, "--version").startswith("sccache")
|
2016-08-26 01:39:57 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
2016-08-26 01:39:57 +03:00
|
|
|
@depends(ccache, ccache_is_sccache)
|
|
|
|
def using_ccache(ccache, ccache_is_sccache):
|
|
|
|
return ccache and not ccache_is_sccache
|
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
2016-08-26 01:39:57 +03:00
|
|
|
@depends_if(ccache, ccache_is_sccache)
|
|
|
|
def using_sccache(ccache, ccache_is_sccache):
|
2017-06-16 17:34:09 +03:00
|
|
|
return ccache and ccache_is_sccache
|
2016-03-25 15:14:59 +03:00
|
|
|
|
2019-08-29 20:45:23 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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")
|
2019-08-29 20:45:23 +03:00
|
|
|
def check_sccache_version(ccache, ccache_is_sccache, rustc_wrapper):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
sccache_min_version = Version("0.2.13")
|
2019-08-29 20:45:23 +03:00
|
|
|
|
|
|
|
def check_version(path):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
out = check_cmd_output(path, "--version")
|
2019-08-29 20:45:23 +03:00
|
|
|
version = Version(out.rstrip().split()[-1])
|
|
|
|
if version < sccache_min_version:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
die(
|
|
|
|
dedent(
|
|
|
|
"""\
|
2019-08-29 20:45:23 +03:00
|
|
|
sccache %s or later is required. sccache in use at %s has
|
|
|
|
version %s.
|
|
|
|
|
|
|
|
Please upgrade or acquire a new version with |./mach bootstrap|.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"""
|
|
|
|
),
|
|
|
|
sccache_min_version,
|
|
|
|
path,
|
|
|
|
version,
|
|
|
|
)
|
2019-08-29 20:45:23 +03:00
|
|
|
|
|
|
|
if ccache and ccache_is_sccache:
|
|
|
|
check_version(ccache)
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if rustc_wrapper and (
|
|
|
|
os.path.splitext(os.path.basename(rustc_wrapper[0]))[0].lower() == "sccache"
|
|
|
|
):
|
2019-08-30 15:22:12 +03:00
|
|
|
check_version(rustc_wrapper[0])
|
2017-10-12 16:22:59 +03:00
|
|
|
|
2016-08-26 01:39:57 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("MOZ_USING_CCACHE", using_ccache)
|
|
|
|
set_config("MOZ_USING_SCCACHE", using_sccache)
|
2017-10-12 16:22:59 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option(env="SCCACHE_VERBOSE_STATS", help="Print verbose sccache stats after build")
|
2016-08-26 01:39:57 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
|
|
|
|
@depends(using_sccache, "SCCACHE_VERBOSE_STATS")
|
2016-08-26 01:39:57 +03:00
|
|
|
def sccache_verbose_stats(using_sccache, verbose_stats):
|
|
|
|
return using_sccache and bool(verbose_stats)
|
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("SCCACHE_VERBOSE_STATS", sccache_verbose_stats)
|
2016-03-25 15:14:59 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends("--with-compiler-wrapper", ccache)
|
|
|
|
@imports(_from="mozbuild.shellutil", _import="split", _as="shell_split")
|
2016-03-25 15:14:59 +03:00
|
|
|
def compiler_wrapper(wrapper, ccache):
|
2016-04-05 08:05:59 +03:00
|
|
|
if wrapper:
|
|
|
|
raw_wrapper = wrapper[0]
|
|
|
|
wrapper = shell_split(raw_wrapper)
|
|
|
|
wrapper_program = find_program(wrapper[0])
|
|
|
|
if not wrapper_program:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
die(
|
|
|
|
"Cannot find `%s` from the given compiler wrapper `%s`",
|
|
|
|
wrapper[0],
|
|
|
|
raw_wrapper,
|
|
|
|
)
|
2016-04-05 08:05:59 +03:00
|
|
|
wrapper[0] = wrapper_program
|
|
|
|
|
2016-03-25 15:14:59 +03:00
|
|
|
if ccache:
|
|
|
|
if wrapper:
|
2016-04-05 08:05:59 +03:00
|
|
|
return tuple([ccache] + wrapper)
|
2016-03-25 15:14:59 +03:00
|
|
|
else:
|
|
|
|
return (ccache,)
|
|
|
|
elif wrapper:
|
2016-04-05 08:05:59 +03:00
|
|
|
return tuple(wrapper)
|
2016-03-25 15:14:59 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
2016-03-25 15:14:59 +03:00
|
|
|
@depends_if(compiler_wrapper)
|
|
|
|
def using_compiler_wrapper(compiler_wrapper):
|
|
|
|
return True
|
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("MOZ_USING_COMPILER_WRAPPER", using_compiler_wrapper)
|
2016-03-30 08:47:13 +03:00
|
|
|
|
|
|
|
|
2017-05-27 20:51:40 +03:00
|
|
|
# GC rooting and hazard analysis.
|
|
|
|
# ==============================================================
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option(env="MOZ_HAZARD", help="Build for the GC rooting hazard analysis")
|
2017-05-27 20:51:40 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends("MOZ_HAZARD")
|
2017-05-27 20:51:40 +03:00
|
|
|
def hazard_analysis(value):
|
|
|
|
if value:
|
|
|
|
return True
|
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("MOZ_HAZARD", hazard_analysis)
|
2017-05-27 20:51:40 +03:00
|
|
|
|
|
|
|
|
2016-03-30 08:47:13 +03:00
|
|
|
# Cross-compilation related things.
|
|
|
|
# ==============================================================
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option(
|
|
|
|
"--with-toolchain-prefix",
|
|
|
|
env="TOOLCHAIN_PREFIX",
|
|
|
|
nargs=1,
|
|
|
|
help="Prefix for the target toolchain",
|
|
|
|
)
|
2016-03-30 08:47:13 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends("--with-toolchain-prefix", target, cross_compiling)
|
2016-11-11 06:52:37 +03:00
|
|
|
def toolchain_prefix(value, target, cross_compiling):
|
2016-03-30 08:47:13 +03:00
|
|
|
if value:
|
2016-10-21 01:50:40 +03:00
|
|
|
return tuple(value)
|
|
|
|
if cross_compiling:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
return ("%s-" % target.toolchain, "%s-" % target.alias)
|
2016-10-21 01:50:40 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
2016-10-21 01:50:40 +03:00
|
|
|
@depends(toolchain_prefix, target)
|
|
|
|
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),
|
2018-12-13 09:58:27 +03:00
|
|
|
# or when cross-compiling for Android or OSX.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if toolchain_prefix and (
|
|
|
|
target.os in ("Android", "OSX") or len(toolchain_prefix) == 1
|
|
|
|
):
|
2016-10-21 01:50:40 +03:00
|
|
|
return toolchain_prefix[0]
|
2016-03-30 08:47:13 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("TOOLCHAIN_PREFIX", first_toolchain_prefix)
|
|
|
|
add_old_configure_assignment("TOOLCHAIN_PREFIX", first_toolchain_prefix)
|
2016-04-05 04:56:42 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Compilers
|
|
|
|
# ==============================================================
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
include("compilers-util.configure")
|
2016-08-04 09:51:47 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
2020-05-01 04:26:32 +03:00
|
|
|
def try_preprocess(compiler, language, source, onerror=None):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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")
|
2016-04-06 11:18:07 +03:00
|
|
|
def get_compiler_info(compiler, language):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"""Returns information about the given `compiler` (command line in the
|
2016-04-06 11:18:07 +03:00
|
|
|
form of a list or tuple), in the given `language`.
|
|
|
|
|
|
|
|
The returned information includes:
|
2019-02-15 00:45:27 +03:00
|
|
|
- the compiler type (clang-cl, clang or gcc)
|
2016-04-06 11:18:07 +03:00
|
|
|
- the compiler version
|
|
|
|
- the compiler supported language
|
|
|
|
- the compiler supported language version
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"""
|
2016-04-19 09:09:10 +03:00
|
|
|
# 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.
|
|
|
|
# So instead, we make things such that the version is missing when the
|
2019-11-14 18:16:38 +03:00
|
|
|
# clang used is below the minimum supported version (currently clang 5.0).
|
2019-06-13 01:22:24 +03:00
|
|
|
# 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.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
check = dedent(
|
|
|
|
"""\
|
2019-07-08 13:35:40 +03:00
|
|
|
#if defined(_MSC_VER) && defined(__clang__) && defined(_MT)
|
2016-09-08 01:27:56 +03:00
|
|
|
%COMPILER "clang-cl"
|
2019-01-29 15:42:53 +03:00
|
|
|
%VERSION __clang_major__.__clang_minor__.__clang_patchlevel__
|
2016-04-06 05:32:03 +03:00
|
|
|
#elif defined(__clang__)
|
2016-09-08 01:27:56 +03:00
|
|
|
%COMPILER "clang"
|
2019-11-14 18:16:38 +03:00
|
|
|
# if __has_warning("-Wunguarded-availability")
|
2016-04-06 11:18:07 +03:00
|
|
|
%VERSION __clang_major__.__clang_minor__.__clang_patchlevel__
|
2016-04-19 09:09:10 +03:00
|
|
|
# endif
|
2020-08-05 21:55:13 +03:00
|
|
|
#elif defined(__GNUC__) && !defined(__MINGW32__)
|
2016-09-08 01:27:56 +03:00
|
|
|
%COMPILER "gcc"
|
2016-04-06 11:18:07 +03:00
|
|
|
%VERSION __GNUC__.__GNUC_MINOR__.__GNUC_PATCHLEVEL__
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if __cplusplus
|
|
|
|
%cplusplus __cplusplus
|
|
|
|
#elif __STDC_VERSION__
|
|
|
|
%STDC_VERSION __STDC_VERSION__
|
2016-04-06 05:32:03 +03:00
|
|
|
#endif
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"""
|
|
|
|
)
|
2016-04-06 05:32:03 +03:00
|
|
|
|
2016-04-22 09:08:55 +03:00
|
|
|
# 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.
|
2016-04-26 09:38:45 +03:00
|
|
|
for name, preprocessor_checks in (
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
("CPU", CPU_preprocessor_checks),
|
|
|
|
("KERNEL", kernel_preprocessor_checks),
|
|
|
|
("OS", OS_preprocessor_checks),
|
2016-04-26 09:38:45 +03:00
|
|
|
):
|
2020-01-23 20:15:38 +03:00
|
|
|
for n, (value, condition) in enumerate(iteritems(preprocessor_checks)):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
check += dedent(
|
|
|
|
"""\
|
2016-04-26 09:38:45 +03:00
|
|
|
#%(if)s %(condition)s
|
2016-09-08 01:27:56 +03:00
|
|
|
%%%(name)s "%(value)s"
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"""
|
|
|
|
% {
|
|
|
|
"if": "elif" if n else "if",
|
|
|
|
"condition": condition,
|
|
|
|
"name": name,
|
|
|
|
"value": value,
|
|
|
|
}
|
|
|
|
)
|
|
|
|
check += "#endif\n"
|
2016-04-22 09:08:55 +03:00
|
|
|
|
2016-07-21 02:24:45 +03:00
|
|
|
# Also check for endianness. The advantage of living in modern times is
|
|
|
|
# that all the modern compilers we support now have __BYTE_ORDER__ defined
|
2019-02-15 00:45:27 +03:00
|
|
|
# by the preprocessor.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
check += dedent(
|
|
|
|
"""\
|
2019-02-15 00:45:27 +03:00
|
|
|
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
2016-09-08 01:27:56 +03:00
|
|
|
%ENDIANNESS "little"
|
2016-07-21 02:24:45 +03:00
|
|
|
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
2016-09-08 01:27:56 +03:00
|
|
|
%ENDIANNESS "big"
|
2016-07-21 02:24:45 +03:00
|
|
|
#endif
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"""
|
|
|
|
)
|
2016-07-21 02:24:45 +03:00
|
|
|
|
2016-04-06 05:32:03 +03:00
|
|
|
result = try_preprocess(compiler, language, check)
|
|
|
|
|
2016-04-06 11:18:07 +03:00
|
|
|
if not result:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
raise FatalCheckError("Unknown compiler or compiler not supported.")
|
2016-04-06 11:18:07 +03:00
|
|
|
|
2016-08-30 12:47:28 +03:00
|
|
|
# Metadata emitted by preprocessors such as GCC with LANG=ja_JP.utf-8 may
|
|
|
|
# have non-ASCII characters. Treat the output as bytearray.
|
2016-04-06 11:18:07 +03:00
|
|
|
data = {}
|
|
|
|
for line in result.splitlines():
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if line.startswith("%"):
|
|
|
|
k, _, v = line.partition(" ")
|
|
|
|
k = k.lstrip("%")
|
|
|
|
data[k] = v.replace(" ", "").lstrip('"').rstrip('"')
|
|
|
|
log.debug("%s = %s", k, data[k])
|
2016-04-06 11:18:07 +03:00
|
|
|
|
2016-04-19 10:03:07 +03:00
|
|
|
try:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
type = CompilerType(data["COMPILER"])
|
2018-01-31 22:32:08 +03:00
|
|
|
except Exception:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
raise FatalCheckError("Unknown compiler or compiler not supported.")
|
2016-04-06 11:18:07 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
cplusplus = int(data.get("cplusplus", "0L").rstrip("L"))
|
|
|
|
stdc_version = int(data.get("STDC_VERSION", "0L").rstrip("L"))
|
2016-04-06 11:18:07 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
version = data.get("VERSION")
|
2016-04-19 10:03:07 +03:00
|
|
|
if version:
|
|
|
|
version = Version(version)
|
|
|
|
|
2016-04-06 11:18:07 +03:00
|
|
|
return namespace(
|
2016-04-19 10:03:07 +03:00
|
|
|
type=type,
|
|
|
|
version=version,
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
cpu=data.get("CPU"),
|
|
|
|
kernel=data.get("KERNEL"),
|
|
|
|
endianness=data.get("ENDIANNESS"),
|
|
|
|
os=data.get("OS"),
|
|
|
|
language="C++" if cplusplus else "C",
|
2016-04-06 11:18:07 +03:00
|
|
|
language_version=cplusplus if cplusplus else stdc_version,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2018-09-14 20:40:52 +03:00
|
|
|
def same_arch_different_bits():
|
|
|
|
return (
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
("x86", "x86_64"),
|
|
|
|
("ppc", "ppc64"),
|
|
|
|
("sparc", "sparc64"),
|
2018-09-14 20:40:52 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@imports(_from="mozbuild.shellutil", _import="quote")
|
|
|
|
@imports(_from="mozbuild.configure.constants", _import="OS_preprocessor_checks")
|
2016-04-22 09:08:55 +03:00
|
|
|
def check_compiler(compiler, language, target):
|
2016-04-06 11:18:07 +03:00
|
|
|
info = get_compiler_info(compiler, language)
|
|
|
|
|
|
|
|
flags = []
|
|
|
|
|
|
|
|
# Check language standards
|
|
|
|
# --------------------------------------------------------------------
|
|
|
|
if language != info.language:
|
|
|
|
raise FatalCheckError(
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"`%s` is not a %s compiler." % (quote(*compiler), language)
|
|
|
|
)
|
2016-04-06 11:18:07 +03:00
|
|
|
|
|
|
|
# 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)
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if info.language == "C" and info.language_version != 199901:
|
|
|
|
if info.type == "clang-cl":
|
|
|
|
flags.append("-Xclang")
|
|
|
|
flags.append("-std=gnu99")
|
2016-04-06 11:18:07 +03:00
|
|
|
|
2019-12-03 09:50:13 +03:00
|
|
|
cxx17_version = 201703
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if info.language == "C++":
|
2019-12-03 09:50:13 +03:00
|
|
|
if info.language_version != cxx17_version:
|
|
|
|
# MSVC headers include C++17 features, but don't guard them
|
2019-06-14 19:14:50 +03:00
|
|
|
# with appropriate checks.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if info.type == "clang-cl":
|
|
|
|
flags.append("-Xclang")
|
|
|
|
flags.append("-std=c++17")
|
2019-06-14 19:14:50 +03:00
|
|
|
else:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
flags.append("-std=gnu++17")
|
2016-04-06 11:18:07 +03:00
|
|
|
|
2016-04-22 09:08:55 +03:00
|
|
|
# Check compiler target
|
|
|
|
# --------------------------------------------------------------------
|
Bug 1524467 - Use -m32/-m64 in more cases. r=froydnj
In upcoming changes, we're going to use the normal compiler flags for
bindgen instead of having a separate logic for essentially the same
flags (and there's not much reason not to use the same flags after all).
One hiccup, though is that for some reason, --target=i686-linux-gnu
doesn't work with bindgen while it works with clang in the same setup.
But -m32 does.
Considering -m32 and -m64 are standard flags and that we're using them
in many cases, it doesn't hurt to use them instead of --target with
clang.
While we're doing that, we might as well refactor a little to avoid the
multiple branches handling the use of -m32/-m64, and fix the theoretical
compile-x86_64-with-x86-clang-cl case, as well as the weird check for
aarch64.
And because only two cases actually require -Xclang, only one of which
requires a condition, and the control flow is not too complex to avoid
flag duplication, we just remove the append_flag function; it was too
confusing, with all the cases we skipped it when -Xclang was not wanted.
Differential Revision: https://phabricator.services.mozilla.com/D18316
--HG--
extra : moz-landing-system : lando
2019-02-04 20:22:58 +03:00
|
|
|
has_target = False
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if info.type == "clang":
|
2020-08-23 01:46:08 +03:00
|
|
|
# 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.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if target.os == "OSX" and target.cpu == "aarch64":
|
|
|
|
if "--target=arm64-apple-darwin" not in compiler:
|
|
|
|
flags.append("--target=arm64-apple-darwin")
|
2020-08-23 01:46:08 +03:00
|
|
|
has_target = True
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
elif (
|
|
|
|
not info.kernel
|
|
|
|
or info.kernel != target.kernel
|
|
|
|
or not info.endianness
|
|
|
|
or info.endianness != target.endianness
|
|
|
|
):
|
|
|
|
flags.append("--target=%s" % target.toolchain)
|
Bug 1524467 - Use -m32/-m64 in more cases. r=froydnj
In upcoming changes, we're going to use the normal compiler flags for
bindgen instead of having a separate logic for essentially the same
flags (and there's not much reason not to use the same flags after all).
One hiccup, though is that for some reason, --target=i686-linux-gnu
doesn't work with bindgen while it works with clang in the same setup.
But -m32 does.
Considering -m32 and -m64 are standard flags and that we're using them
in many cases, it doesn't hurt to use them instead of --target with
clang.
While we're doing that, we might as well refactor a little to avoid the
multiple branches handling the use of -m32/-m64, and fix the theoretical
compile-x86_64-with-x86-clang-cl case, as well as the weird check for
aarch64.
And because only two cases actually require -Xclang, only one of which
requires a condition, and the control flow is not too complex to avoid
flag duplication, we just remove the append_flag function; it was too
confusing, with all the cases we skipped it when -Xclang was not wanted.
Differential Revision: https://phabricator.services.mozilla.com/D18316
--HG--
extra : moz-landing-system : lando
2019-02-04 20:22:58 +03:00
|
|
|
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 (
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
not info.os or info.os != target.os
|
|
|
|
):
|
|
|
|
flags.append("--target=%s" % target.toolchain)
|
Bug 1524467 - Use -m32/-m64 in more cases. r=froydnj
In upcoming changes, we're going to use the normal compiler flags for
bindgen instead of having a separate logic for essentially the same
flags (and there's not much reason not to use the same flags after all).
One hiccup, though is that for some reason, --target=i686-linux-gnu
doesn't work with bindgen while it works with clang in the same setup.
But -m32 does.
Considering -m32 and -m64 are standard flags and that we're using them
in many cases, it doesn't hurt to use them instead of --target with
clang.
While we're doing that, we might as well refactor a little to avoid the
multiple branches handling the use of -m32/-m64, and fix the theoretical
compile-x86_64-with-x86-clang-cl case, as well as the weird check for
aarch64.
And because only two cases actually require -Xclang, only one of which
requires a condition, and the control flow is not too complex to avoid
flag duplication, we just remove the append_flag function; it was too
confusing, with all the cases we skipped it when -Xclang was not wanted.
Differential Revision: https://phabricator.services.mozilla.com/D18316
--HG--
extra : moz-landing-system : lando
2019-02-04 20:22:58 +03:00
|
|
|
has_target = True
|
|
|
|
|
2019-02-15 00:45:27 +03:00
|
|
|
if not has_target and (not info.cpu or info.cpu != target.cpu):
|
Bug 1524467 - Use -m32/-m64 in more cases. r=froydnj
In upcoming changes, we're going to use the normal compiler flags for
bindgen instead of having a separate logic for essentially the same
flags (and there's not much reason not to use the same flags after all).
One hiccup, though is that for some reason, --target=i686-linux-gnu
doesn't work with bindgen while it works with clang in the same setup.
But -m32 does.
Considering -m32 and -m64 are standard flags and that we're using them
in many cases, it doesn't hurt to use them instead of --target with
clang.
While we're doing that, we might as well refactor a little to avoid the
multiple branches handling the use of -m32/-m64, and fix the theoretical
compile-x86_64-with-x86-clang-cl case, as well as the weird check for
aarch64.
And because only two cases actually require -Xclang, only one of which
requires a condition, and the control flow is not too complex to avoid
flag duplication, we just remove the append_flag function; it was too
confusing, with all the cases we skipped it when -Xclang was not wanted.
Differential Revision: https://phabricator.services.mozilla.com/D18316
--HG--
extra : moz-landing-system : lando
2019-02-04 20:22:58 +03:00
|
|
|
same_arch = same_arch_different_bits()
|
|
|
|
if (target.cpu, info.cpu) in same_arch:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
flags.append("-m32")
|
Bug 1524467 - Use -m32/-m64 in more cases. r=froydnj
In upcoming changes, we're going to use the normal compiler flags for
bindgen instead of having a separate logic for essentially the same
flags (and there's not much reason not to use the same flags after all).
One hiccup, though is that for some reason, --target=i686-linux-gnu
doesn't work with bindgen while it works with clang in the same setup.
But -m32 does.
Considering -m32 and -m64 are standard flags and that we're using them
in many cases, it doesn't hurt to use them instead of --target with
clang.
While we're doing that, we might as well refactor a little to avoid the
multiple branches handling the use of -m32/-m64, and fix the theoretical
compile-x86_64-with-x86-clang-cl case, as well as the weird check for
aarch64.
And because only two cases actually require -Xclang, only one of which
requires a condition, and the control flow is not too complex to avoid
flag duplication, we just remove the append_flag function; it was too
confusing, with all the cases we skipped it when -Xclang was not wanted.
Differential Revision: https://phabricator.services.mozilla.com/D18316
--HG--
extra : moz-landing-system : lando
2019-02-04 20:22:58 +03:00
|
|
|
elif (info.cpu, target.cpu) in same_arch:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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)
|
2018-09-13 19:09:26 +03:00
|
|
|
|
2016-04-22 03:24:32 +03:00
|
|
|
return namespace(
|
|
|
|
type=info.type,
|
|
|
|
version=info.version,
|
2016-04-22 09:08:55 +03:00
|
|
|
target_cpu=info.cpu,
|
2016-04-26 09:38:45 +03:00
|
|
|
target_kernel=info.kernel,
|
2016-07-21 02:24:45 +03:00
|
|
|
target_endianness=info.endianness,
|
2018-09-13 19:09:26 +03:00
|
|
|
target_os=info.os,
|
2016-04-22 03:24:32 +03:00
|
|
|
flags=flags,
|
|
|
|
)
|
2016-04-06 05:32:03 +03:00
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@imports(_from="__builtin__", _import="open")
|
|
|
|
@imports("json")
|
|
|
|
@imports("os")
|
2017-04-26 22:18:48 +03:00
|
|
|
def get_vc_paths(topsrcdir):
|
|
|
|
def vswhere(args):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
program_files = os.environ.get("PROGRAMFILES(X86)") or os.environ.get(
|
|
|
|
"PROGRAMFILES"
|
|
|
|
)
|
2019-01-29 00:54:56 +03:00
|
|
|
if not program_files:
|
|
|
|
return []
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
vswhere = os.path.join(
|
|
|
|
program_files, "Microsoft Visual Studio", "Installer", "vswhere.exe"
|
|
|
|
)
|
2019-01-29 00:54:56 +03:00
|
|
|
if not os.path.exists(vswhere):
|
|
|
|
return []
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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)
|
2017-04-26 22:18:48 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
2019-01-28 23:42:07 +03:00
|
|
|
@depends(host)
|
|
|
|
def host_is_windows(host):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if host.kernel == "WINNT":
|
2019-01-28 23:42:07 +03:00
|
|
|
return True
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option(
|
|
|
|
"--with-visual-studio-version",
|
|
|
|
nargs=1,
|
|
|
|
choices=("2017",),
|
|
|
|
when=host_is_windows,
|
|
|
|
help="Select a specific Visual Studio version to use",
|
|
|
|
)
|
2017-04-26 22:18:48 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends("--with-visual-studio-version", when=host_is_windows)
|
2017-04-20 19:43:44 +03:00
|
|
|
def vs_major_version(value):
|
|
|
|
if value:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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
|
|
|
|
):
|
2019-01-28 23:44:26 +03:00
|
|
|
if vc_path and vs_release_name:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
die("VC_PATH and --with-visual-studio-version cannot be used together.")
|
2019-01-28 23:44:26 +03:00
|
|
|
if vc_path:
|
|
|
|
# Use an arbitrary version, it doesn't matter.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
all_versions = [(Version("15"), vc_path[0])]
|
2019-01-28 23:44:26 +03:00
|
|
|
else:
|
|
|
|
all_versions = sorted(get_vc_paths(env.topsrcdir), key=itemgetter(0))
|
2019-01-28 23:42:07 +03:00
|
|
|
if not all_versions:
|
|
|
|
return
|
|
|
|
if vs_major_version:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
versions = [d for (v, d) in all_versions if v.major == vs_major_version]
|
2019-01-28 23:42:07 +03:00
|
|
|
if not versions:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
die("Visual Studio %s could not be found!" % vs_release_name)
|
2019-01-28 23:44:26 +03:00
|
|
|
path = versions[0]
|
2019-01-28 23:42:07 +03:00
|
|
|
else:
|
|
|
|
# Choose the newest version.
|
2019-01-28 23:44:26 +03:00
|
|
|
path = all_versions[-1][1]
|
2019-01-29 01:24:04 +03:00
|
|
|
host_dir = {
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"x86_64": "HostX64",
|
|
|
|
"x86": "HostX86",
|
2019-01-29 01:24:04 +03:00
|
|
|
}.get(host.cpu)
|
|
|
|
if host_dir:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
path = os.path.join(path, "bin", host_dir)
|
2019-01-29 01:24:04 +03:00
|
|
|
return {
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"x64": [os.path.join(path, "x64")],
|
2019-01-29 01:24:04 +03:00
|
|
|
# The cross toolchains require DLLs from the native x64 toolchain.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"x86": [os.path.join(path, "x86"), os.path.join(path, "x64")],
|
|
|
|
"arm64": [os.path.join(path, "arm64"), os.path.join(path, "x64")],
|
2019-01-29 01:24:04 +03:00
|
|
|
}
|
2019-01-28 23:44:26 +03:00
|
|
|
|
2019-01-28 23:42:07 +03:00
|
|
|
|
2019-01-11 03:20:31 +03:00
|
|
|
@template
|
|
|
|
def vc_compiler_path_for(host_or_target):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends(host_or_target, vc_compiler_paths_for_version, when=host_is_windows)
|
2019-01-28 23:42:07 +03:00
|
|
|
def vc_compiler_path(target, paths):
|
2019-01-11 03:20:31 +03:00
|
|
|
vc_target = {
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"x86": "x86",
|
|
|
|
"x86_64": "x64",
|
|
|
|
"arm": "arm",
|
|
|
|
"aarch64": "arm64",
|
2019-01-11 03:20:31 +03:00
|
|
|
}.get(target.cpu)
|
|
|
|
if not paths:
|
|
|
|
return
|
2019-01-28 23:42:07 +03:00
|
|
|
return paths.get(vc_target)
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
|
2019-01-11 03:20:31 +03:00
|
|
|
return vc_compiler_path
|
2016-07-22 09:51:34 +03:00
|
|
|
|
2019-01-11 03:20:31 +03:00
|
|
|
|
|
|
|
vc_compiler_path = vc_compiler_path_for(target)
|
|
|
|
host_vc_compiler_path = vc_compiler_path_for(host)
|
2016-07-22 09:51:34 +03:00
|
|
|
|
|
|
|
|
2019-01-11 02:37:46 +03:00
|
|
|
@dependable
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@imports("os")
|
|
|
|
@imports(_from="os", _import="environ")
|
2019-01-11 02:37:46 +03:00
|
|
|
def original_path():
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
return environ["PATH"].split(os.pathsep)
|
2019-01-11 02:37:46 +03:00
|
|
|
|
|
|
|
|
2019-01-11 03:20:31 +03:00
|
|
|
@template
|
|
|
|
def toolchain_search_path_for(host_or_target):
|
2020-07-28 23:50:03 +03:00
|
|
|
arch_alias, vc_path = {
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
host: ("host", host_vc_compiler_path),
|
|
|
|
target: ("target", vc_compiler_path),
|
2019-01-11 03:20:31 +03:00
|
|
|
}[host_or_target]
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@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,
|
|
|
|
):
|
2019-01-11 03:20:31 +03:00
|
|
|
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:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
environ["PATH"] = os.pathsep.join(result + vc_compiler_path[1:])
|
2018-06-07 03:57:36 +03:00
|
|
|
|
2019-01-11 03:20:31 +03:00
|
|
|
# The first item is where the programs are going to be
|
|
|
|
result.append(vc_compiler_path[0])
|
2019-01-11 02:37:46 +03:00
|
|
|
|
2019-01-11 03:20:31 +03:00
|
|
|
# Also add in the location to which `mach bootstrap` or
|
2019-12-09 17:54:16 +03:00
|
|
|
# `mach artifact toolchain` installs clang, cbindgen, etc.
|
|
|
|
bootstrapped = [
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
os.path.join(mozbuild_state_path, *rest)
|
|
|
|
for rest in (
|
|
|
|
["clang", "bin"],
|
|
|
|
["cbindgen"],
|
|
|
|
["dump_syms"],
|
|
|
|
["nasm"],
|
|
|
|
["lucetc"],
|
|
|
|
)
|
|
|
|
]
|
2019-03-11 21:00:13 +03:00
|
|
|
|
2019-01-11 18:48:20 +03:00
|
|
|
# Also add the rustup install directory for cargo/rustc.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
cargo_home = environ.get("CARGO_HOME", "")
|
2020-08-24 17:08:17 +03:00
|
|
|
if cargo_home:
|
|
|
|
cargo_home = os.path.abspath(cargo_home)
|
|
|
|
else:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
cargo_home = os.path.expanduser(os.path.join("~", ".cargo"))
|
|
|
|
rustup_path = os.path.join(cargo_home, "bin")
|
2019-01-11 18:48:20 +03:00
|
|
|
result.append(rustup_path)
|
|
|
|
|
2019-06-06 04:22:21 +03:00
|
|
|
if developer_options:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
log.debug(
|
|
|
|
"Prioritizing mozbuild state dir in {} toolchain path because "
|
|
|
|
"you are not building in release mode.".format(arch_alias)
|
|
|
|
)
|
2020-07-28 23:50:03 +03:00
|
|
|
search_path = bootstrapped + result
|
|
|
|
else:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
log.debug(
|
|
|
|
"Prioritizing system over mozbuild state dir in {} "
|
|
|
|
"toolchain path because you are building in "
|
|
|
|
"release mode.".format(arch_alias)
|
|
|
|
)
|
2020-07-28 23:50:03 +03:00
|
|
|
search_path = result + bootstrapped
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
log.debug("Search path for {} toolchain: {}".format(arch_alias, search_path))
|
2020-07-28 23:50:03 +03:00
|
|
|
return search_path
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
|
2019-01-11 03:20:31 +03:00
|
|
|
return toolchain_search_path
|
2018-08-17 19:43:06 +03:00
|
|
|
|
2019-01-11 03:20:31 +03:00
|
|
|
|
|
|
|
toolchain_search_path = toolchain_search_path_for(target)
|
|
|
|
host_toolchain_search_path = toolchain_search_path_for(host)
|
2018-12-22 02:05:40 +03:00
|
|
|
|
|
|
|
|
2019-01-11 02:37:46 +03:00
|
|
|
# As a workaround until bug 1516228 and bug 1516253 are fixed, set the PATH
|
|
|
|
# variable for the build to contain the toolchain search path.
|
2019-01-11 03:20:31 +03:00
|
|
|
@depends(toolchain_search_path, host_toolchain_search_path)
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@imports("os")
|
|
|
|
@imports(_from="os", _import="environ")
|
2019-01-11 03:20:31 +03:00
|
|
|
def altered_path(toolchain_search_path, host_toolchain_search_path):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
path = environ["PATH"].split(os.pathsep)
|
2019-01-11 02:37:46 +03:00
|
|
|
altered_path = list(toolchain_search_path)
|
2019-01-11 03:20:31 +03:00
|
|
|
for p in host_toolchain_search_path:
|
|
|
|
if p not in altered_path:
|
|
|
|
altered_path.append(p)
|
2019-01-11 02:37:46 +03:00
|
|
|
for p in path:
|
|
|
|
if p not in altered_path:
|
|
|
|
altered_path.append(p)
|
|
|
|
return os.pathsep.join(altered_path)
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("PATH", altered_path)
|
2019-01-11 02:37:46 +03:00
|
|
|
|
|
|
|
|
2016-04-05 04:56:42 +03:00
|
|
|
@template
|
2018-09-14 20:40:52 +03:00
|
|
|
def default_c_compilers(host_or_target, other_c_compiler=None):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"""Template defining the set of default C compilers for the host and
|
2016-04-05 04:56:42 +03:00
|
|
|
target platforms.
|
|
|
|
`host_or_target` is either `host` or `target` (the @depends functions
|
|
|
|
from init.configure.
|
2018-09-14 20:40:52 +03:00
|
|
|
`other_c_compiler` is the `target` C compiler when `host_or_target` is `host`.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"""
|
2018-10-12 16:44:08 +03:00
|
|
|
assert host_or_target in {host, target}
|
2016-04-05 04:56:42 +03:00
|
|
|
|
2018-09-14 20:40:52 +03:00
|
|
|
other_c_compiler = () if other_c_compiler is None else (other_c_compiler,)
|
|
|
|
|
2019-06-07 03:40:10 +03:00
|
|
|
@depends(host_or_target, target, toolchain_prefix, *other_c_compiler)
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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")
|
2018-09-14 20:40:52 +03:00
|
|
|
else:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
supported = types = ("clang", "gcc")
|
2018-09-14 20:40:52 +03:00
|
|
|
|
|
|
|
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
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if info.type == "gcc":
|
2018-09-14 20:40:52 +03:00
|
|
|
same_arch = same_arch_different_bits()
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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
|
|
|
|
):
|
2018-09-15 04:14:29 +03:00
|
|
|
# If the target C compiler is GCC, and it can't be used with
|
2018-09-14 20:40:52 +03:00
|
|
|
# -m32/-m64 for the host, it's probably toolchain-prefixed,
|
|
|
|
# so we prioritize a raw 'gcc' instead.
|
|
|
|
prioritized = info.type
|
|
|
|
|
|
|
|
types = [prioritized] + [t for t in types if t != info.type]
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
gcc = ("gcc",)
|
2016-10-21 01:50:40 +03:00
|
|
|
if toolchain_prefix and host_or_target is target:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
gcc = tuple("%sgcc" % p for p in toolchain_prefix) + gcc
|
2016-10-21 01:50:40 +03:00
|
|
|
|
2018-09-14 20:40:52 +03:00
|
|
|
result = []
|
|
|
|
for type in types:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if type == "gcc":
|
2018-09-14 20:40:52 +03:00
|
|
|
result.extend(gcc)
|
|
|
|
else:
|
|
|
|
result.append(type)
|
|
|
|
|
|
|
|
return tuple(result)
|
2016-04-05 04:56:42 +03:00
|
|
|
|
|
|
|
return default_c_compilers
|
|
|
|
|
|
|
|
|
|
|
|
@template
|
2018-09-14 20:40:52 +03:00
|
|
|
def default_cxx_compilers(c_compiler, other_c_compiler=None, other_cxx_compiler=None):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"""Template defining the set of default C++ compilers for the host and
|
2016-04-05 04:56:42 +03:00
|
|
|
target platforms.
|
|
|
|
`c_compiler` is the @depends function returning a Compiler instance for
|
|
|
|
the desired platform.
|
|
|
|
|
|
|
|
Because the build system expects the C and C++ compilers to be from the
|
|
|
|
same compiler suite, we derive the default C++ compilers from the C
|
|
|
|
compiler that was found if none was provided.
|
2018-09-14 20:40:52 +03:00
|
|
|
|
2018-09-15 04:14:29 +03:00
|
|
|
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.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"""
|
2016-04-05 04:56:42 +03:00
|
|
|
|
2018-09-14 20:40:52 +03:00
|
|
|
assert (other_c_compiler is None) == (other_cxx_compiler is None)
|
|
|
|
if other_c_compiler is not None:
|
|
|
|
other_compilers = (other_c_compiler, other_cxx_compiler)
|
|
|
|
else:
|
|
|
|
other_compilers = ()
|
|
|
|
|
|
|
|
@depends(c_compiler, *other_compilers)
|
|
|
|
def default_cxx_compilers(c_compiler, *other_compilers):
|
|
|
|
if other_compilers:
|
|
|
|
other_c_compiler, other_cxx_compiler = other_compilers
|
|
|
|
if other_c_compiler.compiler == c_compiler.compiler:
|
|
|
|
return (other_cxx_compiler.compiler,)
|
|
|
|
|
2016-04-05 04:56:42 +03:00
|
|
|
dir = os.path.dirname(c_compiler.compiler)
|
|
|
|
file = os.path.basename(c_compiler.compiler)
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if c_compiler.type == "gcc":
|
|
|
|
return (os.path.join(dir, file.replace("gcc", "g++")),)
|
2016-04-05 04:56:42 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if c_compiler.type == "clang":
|
|
|
|
return (os.path.join(dir, file.replace("clang", "clang++")),)
|
2016-04-05 04:56:42 +03:00
|
|
|
|
|
|
|
return (c_compiler.compiler,)
|
|
|
|
|
|
|
|
return default_cxx_compilers
|
|
|
|
|
|
|
|
|
2018-10-04 03:29:29 +03:00
|
|
|
@template
|
2019-11-14 19:26:24 +03:00
|
|
|
def provided_program(env_var, when=None):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"""Template handling cases where a program can be specified either as a
|
2018-10-04 03:29:29 +03:00
|
|
|
path or as a path with applicable arguments.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"""
|
2018-10-04 03:29:29 +03:00
|
|
|
|
2019-11-14 19:26:24 +03:00
|
|
|
@depends_if(env_var, when=when)
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@imports(_from="itertools", _import="takewhile")
|
|
|
|
@imports(_from="mozbuild.shellutil", _import="split", _as="shell_split")
|
2018-10-04 03:29:29 +03:00
|
|
|
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
|
|
|
|
# the program we're looking for, and anything before that is a wrapper
|
|
|
|
# of some kind (e.g. sccache).
|
|
|
|
cmd = shell_split(cmd[0])
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
without_flags = list(takewhile(lambda x: not x.startswith("-"), cmd))
|
2018-10-04 03:29:29 +03:00
|
|
|
|
|
|
|
return namespace(
|
|
|
|
wrapper=without_flags[:-1],
|
|
|
|
program=without_flags[-1],
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
flags=cmd[len(without_flags) :],
|
2018-10-04 03:29:29 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
return provided
|
|
|
|
|
|
|
|
|
Bug 1526857 - Improve bindgen configuration wrt clang. r=chmanchester
The current setup for bindgen relies on either finding clang/libclang
from the output of llvm-config, or from the paths given via the
configure flags --with-clang-path/--with-libclang-path.
One _very_ common problem is that the llvm-config we end up using does
not correspond to the clang used for compilation, which has some
undesirable side effect, like failing to build.
So instead of relying on llvm-config, we do the following:
- when the compiler is clang, we just use that
- when the compiler is clang-cl, we use clang from the same directory
- otherwise, we either try to find clang in PATH, or rely on
--with-clang-path.
Once clang is found, we try to deduce the location of the corresponding
libclang via the output of `clang -print-search-dirs`, or rely on
--with-libclang-path.
Differential Revision: https://phabricator.services.mozilla.com/D33241
--HG--
extra : moz-landing-system : lando
2019-06-05 05:48:20 +03:00
|
|
|
def prepare_flags(host_or_target, macos_sdk):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if macos_sdk and host_or_target.os == "OSX":
|
|
|
|
return ["-isysroot", macos_sdk]
|
Bug 1526857 - Improve bindgen configuration wrt clang. r=chmanchester
The current setup for bindgen relies on either finding clang/libclang
from the output of llvm-config, or from the paths given via the
configure flags --with-clang-path/--with-libclang-path.
One _very_ common problem is that the llvm-config we end up using does
not correspond to the clang used for compilation, which has some
undesirable side effect, like failing to build.
So instead of relying on llvm-config, we do the following:
- when the compiler is clang, we just use that
- when the compiler is clang-cl, we use clang from the same directory
- otherwise, we either try to find clang in PATH, or rely on
--with-clang-path.
Once clang is found, we try to deduce the location of the corresponding
libclang via the output of `clang -print-search-dirs`, or rely on
--with-libclang-path.
Differential Revision: https://phabricator.services.mozilla.com/D33241
--HG--
extra : moz-landing-system : lando
2019-06-05 05:48:20 +03:00
|
|
|
return []
|
|
|
|
|
|
|
|
|
2020-02-10 21:51:42 +03:00
|
|
|
def minimum_gcc_version():
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
return Version("7.1.0")
|
2020-02-10 21:51:42 +03:00
|
|
|
|
|
|
|
|
2016-04-05 04:56:42 +03:00
|
|
|
@template
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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
|
2016-04-05 04:56:42 +03:00
|
|
|
given `language` on the given platform (`host_or_target`).
|
|
|
|
`host_or_target` is either `host` or `target` (the @depends functions
|
|
|
|
from init.configure.
|
2016-04-22 02:00:11 +03:00
|
|
|
When the language is 'C++', `c_compiler` is the result of the `compiler`
|
2016-04-05 04:56:42 +03:00
|
|
|
template for the language 'C' for the same `host_or_target`.
|
|
|
|
When `host_or_target` is `host`, `other_compiler` is the result of the
|
|
|
|
`compiler` template for the same `language` for `target`.
|
2016-04-22 02:00:11 +03:00
|
|
|
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`.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"""
|
2018-10-12 16:44:08 +03:00
|
|
|
assert host_or_target in {host, target}
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
assert language in ("C", "C++")
|
|
|
|
assert language == "C" or c_compiler is not None
|
2018-10-12 16:44:08 +03:00
|
|
|
assert host_or_target is target or other_compiler is not None
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
assert language == "C" or host_or_target is target or other_c_compiler is not None
|
2016-04-05 04:56:42 +03:00
|
|
|
|
|
|
|
host_or_target_str = {
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
host: "host",
|
|
|
|
target: "target",
|
2016-04-05 04:56:42 +03:00
|
|
|
}[host_or_target]
|
|
|
|
|
|
|
|
var = {
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
("C", target): "CC",
|
|
|
|
("C++", target): "CXX",
|
|
|
|
("C", host): "HOST_CC",
|
|
|
|
("C++", host): "HOST_CXX",
|
2016-04-05 04:56:42 +03:00
|
|
|
}[language, host_or_target]
|
|
|
|
|
|
|
|
default_compilers = {
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"C": lambda: default_c_compilers(host_or_target, other_compiler),
|
|
|
|
"C++": lambda: default_cxx_compilers(
|
|
|
|
c_compiler, other_c_compiler, other_compiler
|
|
|
|
),
|
2016-04-05 04:56:42 +03:00
|
|
|
}[language]()
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
what = "the %s %s compiler" % (host_or_target_str, language)
|
2016-04-05 04:56:42 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option(env=var, nargs=1, help="Path to %s" % what)
|
2016-04-05 04:56:42 +03:00
|
|
|
|
|
|
|
# Handle the compiler given by the user through one of the CC/CXX/HOST_CC/
|
|
|
|
# HOST_CXX variables.
|
2018-10-04 03:29:29 +03:00
|
|
|
provided_compiler = provided_program(var)
|
2016-04-05 04:56:42 +03:00
|
|
|
|
2019-01-11 03:20:31 +03:00
|
|
|
search_path = {
|
|
|
|
host: host_toolchain_search_path,
|
|
|
|
target: toolchain_search_path,
|
|
|
|
}[host_or_target]
|
|
|
|
|
2016-04-05 04:56:42 +03:00
|
|
|
# Normally, we'd use `var` instead of `_var`, but the interaction with
|
|
|
|
# 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)
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
compiler = check_prog(
|
|
|
|
"_%s" % var,
|
|
|
|
what=what,
|
|
|
|
progs=default_compilers,
|
|
|
|
input=provided_compiler.program,
|
|
|
|
paths=search_path,
|
|
|
|
)
|
2016-04-05 04:56:42 +03:00
|
|
|
|
2018-12-13 10:12:35 +03:00
|
|
|
@depends(compiler, provided_compiler, compiler_wrapper, host_or_target, macos_sdk)
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@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
|
|
|
|
):
|
2016-04-05 04:56:42 +03:00
|
|
|
wrapper = list(compiler_wrapper or ())
|
2019-11-12 03:28:17 +03:00
|
|
|
flags = prepare_flags(host_or_target, macos_sdk)
|
2016-04-05 04:56:42 +03:00
|
|
|
if provided_compiler:
|
|
|
|
provided_wrapper = list(provided_compiler.wrapper)
|
|
|
|
# When doing a subconfigure, the compiler is set by old-configure
|
|
|
|
# and it contains the wrappers from --with-compiler-wrapper and
|
|
|
|
# --with-ccache.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if provided_wrapper[: len(wrapper)] == wrapper:
|
|
|
|
provided_wrapper = provided_wrapper[len(wrapper) :]
|
2016-04-05 04:56:42 +03:00
|
|
|
wrapper.extend(provided_wrapper)
|
2019-11-12 03:28:17 +03:00
|
|
|
flags.extend(provided_compiler.flags)
|
2018-12-13 10:12:35 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
info = check_compiler(wrapper + [compiler] + flags, language, host_or_target)
|
2016-04-19 08:48:19 +03:00
|
|
|
|
|
|
|
# Check that the additional flags we got are enough to not require any
|
2017-09-21 20:40:02 +03:00
|
|
|
# more flags. If we get an exception, just ignore it; it's liable to be
|
|
|
|
# invalid command-line flags, which means the compiler we're checking
|
|
|
|
# doesn't support those command-line flags and will fail one or more of
|
|
|
|
# the checks below.
|
|
|
|
try:
|
|
|
|
if info.flags:
|
|
|
|
flags += info.flags
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
info = check_compiler(
|
|
|
|
wrapper + [compiler] + flags, language, host_or_target
|
|
|
|
)
|
2017-09-21 20:40:02 +03:00
|
|
|
except FatalCheckError:
|
|
|
|
pass
|
2016-04-22 09:08:55 +03:00
|
|
|
|
|
|
|
if not info.target_cpu or info.target_cpu != host_or_target.cpu:
|
|
|
|
raise FatalCheckError(
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"%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,
|
|
|
|
)
|
|
|
|
)
|
2016-04-19 08:48:19 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if not info.target_kernel or (info.target_kernel != host_or_target.kernel):
|
2016-04-26 09:38:45 +03:00
|
|
|
raise FatalCheckError(
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"%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,
|
|
|
|
)
|
|
|
|
)
|
2016-04-26 09:38:45 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if not info.target_endianness or (
|
|
|
|
info.target_endianness != host_or_target.endianness
|
|
|
|
):
|
2016-07-21 02:24:45 +03:00
|
|
|
raise FatalCheckError(
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"%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,
|
|
|
|
)
|
|
|
|
)
|
2016-07-21 02:24:45 +03:00
|
|
|
|
2016-04-19 09:09:10 +03:00
|
|
|
# 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.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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."
|
|
|
|
)
|
2020-02-10 21:51:42 +03:00
|
|
|
gcc_version = minimum_gcc_version()
|
|
|
|
if info.version < gcc_version:
|
2018-03-23 01:48:52 +03:00
|
|
|
raise FatalCheckError(
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"Only GCC %d.%d or newer is supported (found version %s)."
|
|
|
|
% (gcc_version.major, gcc_version.minor, info.version)
|
|
|
|
)
|
2017-10-29 00:38:59 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if info.type == "clang-cl":
|
|
|
|
if info.version < "8.0.0":
|
2019-05-14 17:22:55 +03:00
|
|
|
raise FatalCheckError(
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"Only clang-cl 8.0 or newer is supported (found version %s)"
|
|
|
|
% info.version
|
|
|
|
)
|
2019-05-14 17:22:55 +03:00
|
|
|
|
2016-04-19 09:09:10 +03:00
|
|
|
# If you want to bump the version check here search for
|
2019-06-13 01:22:24 +03:00
|
|
|
# diagnose_if above, and see the associated comment.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if info.type == "clang" and not info.version:
|
|
|
|
raise FatalCheckError("Only clang/llvm 5.0 or newer is supported.")
|
2016-04-19 09:09:10 +03:00
|
|
|
|
2017-09-21 20:40:02 +03:00
|
|
|
if info.flags:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
raise FatalCheckError("Unknown compiler or compiler not supported.")
|
2017-09-21 20:40:02 +03:00
|
|
|
|
2016-04-06 11:18:07 +03:00
|
|
|
return namespace(
|
|
|
|
wrapper=wrapper,
|
|
|
|
compiler=compiler,
|
2016-04-19 08:48:19 +03:00
|
|
|
flags=flags,
|
2016-04-22 03:24:32 +03:00
|
|
|
type=info.type,
|
|
|
|
version=info.version,
|
2016-08-04 10:24:29 +03:00
|
|
|
language=language,
|
2016-04-06 11:18:07 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
@depends(valid_compiler)
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@checking("%s version" % what)
|
2016-04-06 11:18:07 +03:00
|
|
|
def compiler_version(compiler):
|
|
|
|
return compiler.version
|
2016-04-05 04:56:42 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if language == "C++":
|
|
|
|
|
2016-04-05 04:56:42 +03:00
|
|
|
@depends(valid_compiler, c_compiler)
|
2016-04-20 07:56:55 +03:00
|
|
|
def valid_compiler(compiler, c_compiler):
|
2016-04-05 04:56:42 +03:00
|
|
|
if compiler.type != c_compiler.type:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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,
|
|
|
|
)
|
2016-04-05 04:56:42 +03:00
|
|
|
|
|
|
|
if compiler.version != c_compiler.version:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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,
|
|
|
|
)
|
2016-04-20 07:56:55 +03:00
|
|
|
return compiler
|
2016-04-05 04:56:42 +03:00
|
|
|
|
|
|
|
# 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.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
add_old_configure_assignment(
|
|
|
|
var,
|
|
|
|
depends_if(valid_compiler)(
|
|
|
|
lambda x: list(x.wrapper) + [x.compiler] + list(x.flags)
|
|
|
|
),
|
|
|
|
)
|
2016-04-05 04:56:42 +03:00
|
|
|
|
2019-01-29 17:17:29 +03:00
|
|
|
if host_or_target is target:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
add_old_configure_assignment(
|
|
|
|
"ac_cv_prog_%s" % var,
|
|
|
|
depends_if(valid_compiler)(
|
|
|
|
lambda x: list(x.wrapper) + [x.compiler] + list(x.flags)
|
|
|
|
),
|
|
|
|
)
|
2019-01-29 17:17:29 +03:00
|
|
|
# We check that it works in python configure already.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
add_old_configure_assignment("ac_cv_prog_%s_works" % var.lower(), "yes")
|
2019-01-31 05:11:50 +03:00
|
|
|
add_old_configure_assignment(
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"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)
|
2019-01-29 17:17:29 +03:00
|
|
|
|
2016-04-05 04:56:42 +03:00
|
|
|
# Set CC_TYPE/CC_VERSION/HOST_CC_TYPE/HOST_CC_VERSION to allow
|
|
|
|
# old-configure to do some of its still existing checks.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if language == "C":
|
|
|
|
set_config("%s_TYPE" % var, valid_compiler.type)
|
|
|
|
add_old_configure_assignment("%s_TYPE" % var, valid_compiler.type)
|
2019-01-23 03:27:38 +03:00
|
|
|
set_config(
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"%s_VERSION" % var, depends(valid_compiler.version)(lambda v: str(v))
|
|
|
|
)
|
2016-04-05 04:56:42 +03:00
|
|
|
|
2017-08-18 19:05:05 +03:00
|
|
|
valid_compiler = compiler_class(valid_compiler, host_or_target)
|
2016-08-04 09:51:47 +03:00
|
|
|
|
|
|
|
def compiler_error():
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
raise FatalCheckError(
|
|
|
|
"Failed compiling a simple %s source with %s" % (language, what)
|
|
|
|
)
|
2016-08-04 09:51:47 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
valid_compiler.try_compile(check_msg="%s works" % what, onerror=compiler_error)
|
2016-08-04 09:51:47 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("%s_BASE_FLAGS" % var, valid_compiler.flags)
|
2019-02-06 06:05:52 +03:00
|
|
|
|
2016-09-06 02:22:36 +03:00
|
|
|
# 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
|
|
|
|
# on $CC -E/$CXX -E doing preprocessing work to validate the compiler
|
|
|
|
# in the first place.
|
2018-10-12 16:44:08 +03:00
|
|
|
if host_or_target is target:
|
2016-09-06 02:22:36 +03:00
|
|
|
pp_var = {
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"C": "CPP",
|
|
|
|
"C++": "CXXCPP",
|
2016-09-06 02:22:36 +03:00
|
|
|
}[language]
|
|
|
|
|
|
|
|
preprocessor = depends_if(valid_compiler)(
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
lambda x: list(x.wrapper) + [x.compiler, "-E"] + list(x.flags)
|
|
|
|
)
|
2016-09-06 02:22:36 +03:00
|
|
|
|
|
|
|
set_config(pp_var, preprocessor)
|
|
|
|
add_old_configure_assignment(pp_var, preprocessor)
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if language == "C":
|
2016-11-24 09:07:01 +03:00
|
|
|
linker_var = {
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
target: "LD",
|
|
|
|
host: "HOST_LD",
|
2016-11-24 09:07:01 +03:00
|
|
|
}[host_or_target]
|
|
|
|
|
|
|
|
@deprecated_option(env=linker_var, nargs=1)
|
|
|
|
def linker(value):
|
|
|
|
if value:
|
|
|
|
return value[0]
|
|
|
|
|
2019-02-15 00:45:27 +03:00
|
|
|
@depends(linker)
|
|
|
|
def unused_linker(linker):
|
|
|
|
if linker:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
log.warning(
|
|
|
|
"The value of %s is not used by this build system." % linker_var
|
|
|
|
)
|
2016-11-24 09:07:01 +03:00
|
|
|
|
2016-04-05 04:56:42 +03:00
|
|
|
return valid_compiler
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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,
|
|
|
|
)
|
2016-06-21 02:02:01 +03:00
|
|
|
|
2016-09-21 22:04:08 +03:00
|
|
|
# Generic compiler-based conditions.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
building_with_gcc = depends(c_compiler)(lambda info: info.type == "gcc")
|
2016-09-21 22:04:08 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
2019-05-15 16:40:23 +03:00
|
|
|
@depends(cxx_compiler, ccache_prefix)
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@imports("os")
|
2019-05-15 16:40:23 +03:00
|
|
|
def cxx_is_icecream(info, ccache_prefix):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if (
|
|
|
|
os.path.islink(info.compiler)
|
|
|
|
and os.path.basename(os.readlink(info.compiler)) == "icecc"
|
|
|
|
):
|
2019-02-25 22:06:27 +03:00
|
|
|
return True
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if ccache_prefix and os.path.basename(ccache_prefix) == "icecc":
|
2019-05-15 16:40:23 +03:00
|
|
|
return True
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
|
|
|
|
set_config("CXX_IS_ICECREAM", cxx_is_icecream)
|
2019-02-25 22:06:27 +03:00
|
|
|
|
|
|
|
|
2017-06-15 02:52:55 +03:00
|
|
|
@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.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if info.type == "clang-cl":
|
|
|
|
return "2017"
|
2017-06-15 02:52:55 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
return ""
|
2017-06-15 02:52:55 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("MSVS_VERSION", msvs_version)
|
2017-06-15 02:52:55 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
include("compile-checks.configure")
|
|
|
|
include("arm.configure", when=depends(target.cpu)(lambda cpu: cpu == "arm"))
|
2016-07-27 01:27:19 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
2019-12-19 00:00:57 +03:00
|
|
|
@depends(host, host_os_kernel_major_version, target)
|
|
|
|
def needs_macos_sdk_headers_check(host, version, target):
|
2019-04-25 19:27:18 +03:00
|
|
|
# Only an issue on Mac OS X 10.14 (and probably above).
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if host.kernel != "Darwin" or target.kernel != "Darwin" or version < "18":
|
2019-12-19 00:00:57 +03:00
|
|
|
return
|
|
|
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends(
|
|
|
|
cxx_compiler.try_run(
|
|
|
|
header="#include_next <inttypes.h>",
|
|
|
|
check_msg="for macOS SDK headers",
|
|
|
|
when=needs_macos_sdk_headers_check,
|
|
|
|
),
|
|
|
|
when=needs_macos_sdk_headers_check,
|
|
|
|
)
|
2019-12-19 00:00:57 +03:00
|
|
|
def check_have_mac_10_14_sdk(value):
|
|
|
|
if value:
|
2019-04-25 19:27:18 +03:00
|
|
|
return
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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"
|
|
|
|
)
|
2019-04-25 19:27:18 +03:00
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends(
|
|
|
|
have_64_bit,
|
|
|
|
try_compile(
|
|
|
|
body='static_assert(sizeof(void *) == 8, "")', check_msg="for 64-bit OS"
|
|
|
|
),
|
|
|
|
)
|
2016-08-10 05:39:16 +03:00
|
|
|
def check_have_64_bit(have_64_bit, compiler_have_64_bit):
|
|
|
|
if have_64_bit != compiler_have_64_bit:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
configure_error(
|
|
|
|
"The target compiler does not agree with configure "
|
|
|
|
"about the target bitness."
|
|
|
|
)
|
2016-08-10 03:00:23 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
2020-02-10 21:51:42 +03:00
|
|
|
@depends(cxx_compiler, target)
|
|
|
|
def needs_libstdcxx_newness_check(cxx_compiler, target):
|
|
|
|
# We only have to care about this on Linux and MinGW.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if cxx_compiler.type == "clang-cl":
|
2020-02-10 21:51:42 +03:00
|
|
|
return
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if target.kernel not in ("Linux", "WINNT"):
|
2020-02-10 21:51:42 +03:00
|
|
|
return
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if target.os == "Android":
|
2020-02-10 21:51:42 +03:00
|
|
|
return
|
|
|
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
def die_on_old_libstdcxx():
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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,
|
|
|
|
)
|
2020-02-10 21:51:42 +03:00
|
|
|
|
|
|
|
|
2018-10-17 17:38:52 +03:00
|
|
|
@depends(c_compiler, target)
|
|
|
|
def default_debug_flags(compiler_info, target):
|
2016-06-21 02:02:01 +03:00
|
|
|
# Debug info is ON by default.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if compiler_info.type == "clang-cl":
|
|
|
|
return "-Z7"
|
|
|
|
elif target.kernel == "WINNT" and compiler_info.type == "clang":
|
|
|
|
return "-g -gcodeview"
|
|
|
|
return "-g"
|
2016-06-21 02:02:01 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option(env="MOZ_DEBUG_FLAGS", nargs=1, help="Debug compiler flags")
|
2016-06-21 02:02:01 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
imply_option("--enable-debug-symbols", depends_if("--enable-debug")(lambda v: v))
|
2016-06-21 02:02:01 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option(
|
|
|
|
"--disable-debug-symbols",
|
|
|
|
nargs="?",
|
|
|
|
help="Disable debug symbols using the given compiler flags",
|
|
|
|
)
|
2016-06-21 02:02:01 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("MOZ_DEBUG_SYMBOLS", depends_if("--enable-debug-symbols")(lambda _: True))
|
2016-06-21 02:02:01 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends("MOZ_DEBUG_FLAGS", "--enable-debug-symbols", default_debug_flags)
|
2016-06-21 02:02:01 +03:00
|
|
|
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
|
|
|
|
# --enable-debug-symbols may be implied by --enable-debug.
|
|
|
|
if len(enable_debug_flags):
|
|
|
|
return enable_debug_flags[0]
|
|
|
|
if env_debug_flags:
|
|
|
|
return env_debug_flags[0]
|
|
|
|
return default_debug_flags
|
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("MOZ_DEBUG_FLAGS", debug_flags)
|
|
|
|
add_old_configure_assignment("MOZ_DEBUG_FLAGS", debug_flags)
|
2016-05-16 22:27:37 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
2016-11-10 01:01:24 +03:00
|
|
|
@depends(c_compiler)
|
|
|
|
def color_cflags(info):
|
|
|
|
# We could test compiling with flags. By why incur the overhead when
|
|
|
|
# color support should always be present in a specific toolchain
|
|
|
|
# version?
|
|
|
|
|
|
|
|
# Code for auto-adding this flag to compiler invocations needs to
|
|
|
|
# determine if an existing flag isn't already present. That is likely
|
|
|
|
# using exact string matching on the returned value. So if the return
|
|
|
|
# value changes to e.g. "<x>=always", exact string match may fail and
|
|
|
|
# multiple color flags could be added. So examine downstream consumers
|
|
|
|
# before adding flags to return values.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if info.type == "gcc":
|
|
|
|
return "-fdiagnostics-color"
|
|
|
|
elif info.type == "clang":
|
|
|
|
return "-fcolor-diagnostics"
|
2016-11-10 01:01:24 +03:00
|
|
|
else:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
return ""
|
2016-11-10 01:01:24 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("COLOR_CFLAGS", color_cflags)
|
2016-11-10 01:01:24 +03:00
|
|
|
|
2016-07-06 22:30:22 +03:00
|
|
|
# Some standard library headers (notably bionic on Android) declare standard
|
|
|
|
# functions (e.g. getchar()) and also #define macros for those standard
|
|
|
|
# functions. libc++ deals with this by doing something like the following
|
|
|
|
# (explanatory comments added):
|
|
|
|
#
|
|
|
|
# #ifdef FUNC
|
|
|
|
# // Capture the definition of FUNC.
|
|
|
|
# inline _LIBCPP_INLINE_VISIBILITY int __libcpp_FUNC(...) { return FUNC(...); }
|
|
|
|
# #undef FUNC
|
|
|
|
# // Use a real inline definition.
|
|
|
|
# inline _LIBCPP_INLINE_VISIBILITY int FUNC(...) { return _libcpp_FUNC(...); }
|
|
|
|
# #endif
|
|
|
|
#
|
|
|
|
# _LIBCPP_INLINE_VISIBILITY is typically defined as:
|
|
|
|
#
|
|
|
|
# __attribute__((__visibility__("hidden"), __always_inline__))
|
|
|
|
#
|
|
|
|
# Unfortunately, this interacts badly with our system header wrappers, as the:
|
|
|
|
#
|
|
|
|
# #pragma GCC visibility push(default)
|
|
|
|
#
|
|
|
|
# that they do prior to including the actual system header is treated by the
|
|
|
|
# compiler as an explicit declaration of visibility on every function declared
|
|
|
|
# in the header. Therefore, when the libc++ code above is encountered, it is
|
|
|
|
# as though the compiler has effectively seen:
|
|
|
|
#
|
|
|
|
# int FUNC(...) __attribute__((__visibility__("default")));
|
|
|
|
# int FUNC(...) __attribute__((__visibility__("hidden")));
|
|
|
|
#
|
|
|
|
# and the compiler complains about the mismatched visibility declarations.
|
|
|
|
#
|
|
|
|
# However, libc++ will only define _LIBCPP_INLINE_VISIBILITY if there is no
|
|
|
|
# existing definition. We can therefore define it to the empty string (since
|
|
|
|
# we are properly managing visibility ourselves) and avoid this whole mess.
|
|
|
|
# Note that we don't need to do this with gcc, as libc++ detects gcc and
|
|
|
|
# effectively does the same thing we are doing here.
|
2017-07-05 16:32:29 +03:00
|
|
|
#
|
2019-09-11 18:13:36 +03:00
|
|
|
# _LIBCPP_ALWAYS_INLINE needs a similar workarounds, since it too declares
|
|
|
|
# hidden visibility.
|
|
|
|
#
|
|
|
|
# _LIBCPP_HIDE_FROM_ABI is a macro in libc++ versions in NDKs >=r19. It too
|
|
|
|
# declares hidden visibility, but it also declares functions as excluded from
|
|
|
|
# explicit instantiation (roughly: the function can be unused in the current
|
|
|
|
# compilation, but does not then trigger an actual definition of the function;
|
|
|
|
# it is assumed the real definition comes from elsewhere). We need to replicate
|
|
|
|
# this setup.
|
2017-10-12 16:22:59 +03:00
|
|
|
|
|
|
|
|
2016-07-06 22:30:22 +03:00
|
|
|
@depends(c_compiler, target)
|
2017-07-05 16:32:29 +03:00
|
|
|
def libcxx_override_visibility(c_compiler, target):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if c_compiler.type == "clang" and target.os == "Android":
|
2019-09-11 18:13:36 +03:00
|
|
|
return namespace(
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
empty="",
|
|
|
|
hide_from_abi="__attribute__((__exclude_from_explicit_instantiation__))",
|
2019-09-11 18:13:36 +03:00
|
|
|
)
|
2016-07-06 22:30:22 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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)
|
2016-07-06 22:30:22 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
2016-11-11 06:52:37 +03:00
|
|
|
@depends(target, check_build_environment)
|
|
|
|
def visibility_flags(target, env):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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,
|
|
|
|
)
|
2016-10-04 21:48:21 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
2016-10-04 21:48:21 +03:00
|
|
|
@depends(target, visibility_flags)
|
|
|
|
def wrap_system_includes(target, visibility_flags):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if visibility_flags and target.kernel != "Darwin":
|
2016-10-04 21:48:21 +03:00
|
|
|
return True
|
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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)
|
2016-10-04 21:48:21 +03:00
|
|
|
|
2017-11-01 17:03:08 +03:00
|
|
|
|
2019-07-18 10:46:03 +03:00
|
|
|
@template
|
|
|
|
def depend_cflags(host_or_target_c_compiler):
|
|
|
|
@depends(host_or_target_c_compiler)
|
|
|
|
def depend_cflags(host_or_target_c_compiler):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if host_or_target_c_compiler.type != "clang-cl":
|
|
|
|
return ["-MD", "-MP", "-MF $(MDDEPDIR)/$(@F).pp"]
|
2019-07-18 10:46:03 +03:00
|
|
|
else:
|
|
|
|
# clang-cl doesn't accept the normal -MD -MP -MF options that clang
|
|
|
|
# does, but the underlying cc1 binary understands how to generate
|
|
|
|
# dependency files. These options are based on analyzing what the
|
|
|
|
# normal clang driver sends to cc1 when given the "correct"
|
|
|
|
# dependency options.
|
|
|
|
return [
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"-Xclang",
|
|
|
|
"-MP",
|
|
|
|
"-Xclang",
|
|
|
|
"-dependency-file",
|
|
|
|
"-Xclang",
|
|
|
|
"$(MDDEPDIR)/$(@F).pp",
|
|
|
|
"-Xclang",
|
|
|
|
"-MT",
|
|
|
|
"-Xclang",
|
|
|
|
"$@",
|
2019-07-18 10:46:03 +03:00
|
|
|
]
|
|
|
|
|
|
|
|
return depend_cflags
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("_DEPEND_CFLAGS", depend_cflags(c_compiler))
|
|
|
|
set_config("_HOST_DEPEND_CFLAGS", depend_cflags(host_c_compiler))
|
2018-09-14 19:12:34 +03:00
|
|
|
|
|
|
|
|
2017-12-04 16:14:06 +03:00
|
|
|
@depends(c_compiler)
|
|
|
|
def preprocess_option(compiler):
|
|
|
|
# The uses of PREPROCESS_OPTION depend on the spacing for -o/-Fi.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if compiler.type in ("gcc", "clang"):
|
|
|
|
return "-E -o "
|
2017-12-04 16:14:06 +03:00
|
|
|
else:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
return "-P -Fi"
|
2017-12-04 16:14:06 +03:00
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("PREPROCESS_OPTION", preprocess_option)
|
2017-12-04 16:14:06 +03:00
|
|
|
|
|
|
|
|
2017-04-19 18:18:01 +03:00
|
|
|
# We only want to include windows.configure when we are compiling on
|
2019-11-13 14:48:25 +03:00
|
|
|
# Windows, or for Windows.
|
2017-10-12 16:22:59 +03:00
|
|
|
|
|
|
|
|
2017-04-19 18:18:01 +03:00
|
|
|
@depends(target, host)
|
|
|
|
def is_windows(target, host):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
return host.kernel == "WINNT" or target.kernel == "WINNT"
|
2016-11-12 00:05:07 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
include("windows.configure", when=is_windows)
|
2017-04-12 20:58:22 +03:00
|
|
|
|
2019-08-21 06:36:55 +03:00
|
|
|
|
|
|
|
# On Power ISA, determine compiler flags for VMX, VSX and VSX-3.
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config(
|
|
|
|
"PPC_VMX_FLAGS",
|
|
|
|
["-maltivec"],
|
|
|
|
when=depends(target.cpu)(lambda cpu: cpu.startswith("ppc")),
|
|
|
|
)
|
2019-08-21 06:36:55 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config(
|
|
|
|
"PPC_VSX_FLAGS",
|
|
|
|
["-mvsx"],
|
|
|
|
when=depends(target.cpu)(lambda cpu: cpu.startswith("ppc")),
|
|
|
|
)
|
2019-08-21 06:36:55 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config(
|
|
|
|
"PPC_VSX3_FLAGS",
|
|
|
|
["-mvsx", "-mcpu=power9"],
|
|
|
|
when=depends(target.cpu)(lambda cpu: cpu.startswith("ppc")),
|
|
|
|
)
|
2019-08-21 06:36:55 +03:00
|
|
|
|
2018-04-13 23:55:39 +03:00
|
|
|
# ASAN
|
2017-04-12 20:58:22 +03:00
|
|
|
# ==============================================================
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option("--enable-address-sanitizer", help="Enable Address Sanitizer")
|
2017-11-21 07:20:56 +03:00
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends(when="--enable-address-sanitizer")
|
2019-01-17 06:34:54 +03:00
|
|
|
def asan():
|
2017-11-21 07:20:56 +03:00
|
|
|
return True
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
add_old_configure_assignment("MOZ_ASAN", asan)
|
2017-11-21 07:20:56 +03:00
|
|
|
|
2019-06-07 16:08:27 +03:00
|
|
|
# MSAN
|
|
|
|
# ==============================================================
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option("--enable-memory-sanitizer", help="Enable Memory Sanitizer")
|
2019-06-07 16:08:27 +03:00
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends(when="--enable-memory-sanitizer")
|
2019-06-07 16:08:27 +03:00
|
|
|
def msan():
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
add_old_configure_assignment("MOZ_MSAN", msan)
|
2019-06-07 16:08:27 +03:00
|
|
|
|
|
|
|
# TSAN
|
|
|
|
# ==============================================================
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option("--enable-thread-sanitizer", help="Enable Thread Sanitizer")
|
2019-06-07 16:08:27 +03:00
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends(when="--enable-thread-sanitizer")
|
2019-06-07 16:08:27 +03:00
|
|
|
def tsan():
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
add_old_configure_assignment("MOZ_TSAN", tsan)
|
2019-06-07 16:08:27 +03:00
|
|
|
|
2018-09-11 05:47:23 +03:00
|
|
|
# UBSAN
|
|
|
|
# ==============================================================
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option(
|
|
|
|
"--enable-undefined-sanitizer", nargs="*", help="Enable UndefinedBehavior Sanitizer"
|
|
|
|
)
|
|
|
|
|
2018-09-11 05:47:23 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends_if("--enable-undefined-sanitizer")
|
2018-09-11 05:47:23 +03:00
|
|
|
def ubsan(options):
|
|
|
|
default_checks = [
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"bool",
|
|
|
|
"bounds",
|
|
|
|
"enum",
|
|
|
|
"integer-divide-by-zero",
|
|
|
|
"object-size",
|
|
|
|
"pointer-overflow",
|
|
|
|
"return",
|
|
|
|
"vla-bound",
|
2018-09-11 05:47:23 +03:00
|
|
|
]
|
|
|
|
|
|
|
|
checks = options if len(options) else default_checks
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
return ",".join(checks)
|
|
|
|
|
2018-09-11 05:47:23 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
add_old_configure_assignment("MOZ_UBSAN_CHECKS", ubsan)
|
2017-11-21 07:20:56 +03:00
|
|
|
|
2019-06-07 16:08:27 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option(
|
|
|
|
"--enable-signed-overflow-sanitizer",
|
|
|
|
help="Enable UndefinedBehavior Sanitizer (Signed Integer Overflow Parts)",
|
|
|
|
)
|
2019-06-07 16:08:27 +03:00
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends(when="--enable-signed-overflow-sanitizer")
|
2019-06-07 16:08:27 +03:00
|
|
|
def ub_signed_overflow_san():
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
add_old_configure_assignment("MOZ_SIGNED_OVERFLOW_SANITIZE", ub_signed_overflow_san)
|
2019-06-07 16:08:27 +03:00
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option(
|
|
|
|
"--enable-unsigned-overflow-sanitizer",
|
|
|
|
help="Enable UndefinedBehavior Sanitizer (Unsigned Integer Overflow Parts)",
|
|
|
|
)
|
2019-06-07 16:08:27 +03:00
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends(when="--enable-unsigned-overflow-sanitizer")
|
2019-06-07 16:08:27 +03:00
|
|
|
def ub_unsigned_overflow_san():
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
add_old_configure_assignment("MOZ_UNSIGNED_OVERFLOW_SANITIZE", ub_unsigned_overflow_san)
|
2019-06-07 16:08:27 +03:00
|
|
|
|
2018-04-13 23:55:39 +03:00
|
|
|
# Security Hardening
|
|
|
|
# ==============================================================
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option(
|
|
|
|
"--enable-hardening",
|
|
|
|
env="MOZ_SECURITY_HARDENING",
|
|
|
|
help="Enables security hardening compiler options",
|
|
|
|
)
|
2017-04-12 20:58:22 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
2019-01-25 19:41:27 +03:00
|
|
|
# This function is a bit confusing. It adds or removes hardening flags in
|
|
|
|
# three stuations: if --enable-hardening is passed; if --disable-hardening
|
|
|
|
# is passed, and if no flag is passed.
|
|
|
|
#
|
|
|
|
# At time of this comment writing, all flags are actually added in the
|
|
|
|
# default no-flag case; making --enable-hardening the same as omitting the
|
|
|
|
# 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.)
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@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"
|
2017-04-12 20:58:22 +03:00
|
|
|
|
2017-11-21 07:20:56 +03:00
|
|
|
flags = []
|
2019-01-15 03:49:23 +03:00
|
|
|
ldflags = []
|
2017-11-21 07:20:56 +03:00
|
|
|
js_flags = []
|
2019-01-15 03:49:23 +03:00
|
|
|
js_ldflags = []
|
2017-11-21 07:20:56 +03:00
|
|
|
|
2019-01-25 19:41:27 +03:00
|
|
|
# ----------------------------------------------------------
|
2017-11-21 07:20:56 +03:00
|
|
|
# If hardening is explicitly enabled, or not explicitly disabled
|
|
|
|
if hardening_flag.origin == "default" or hardening_flag:
|
2019-01-15 03:49:23 +03:00
|
|
|
# FORTIFY_SOURCE ------------------------------------
|
2017-11-21 07:20:56 +03:00
|
|
|
# Require optimization for FORTIFY_SOURCE. See Bug 1417452
|
|
|
|
# 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/
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if target.os != "Android":
|
2017-11-21 07:20:56 +03:00
|
|
|
flags.append("-U_FORTIFY_SOURCE")
|
|
|
|
flags.append("-D_FORTIFY_SOURCE=2")
|
|
|
|
js_flags.append("-U_FORTIFY_SOURCE")
|
|
|
|
js_flags.append("-D_FORTIFY_SOURCE=2")
|
2019-12-07 06:35:34 +03:00
|
|
|
if mingw_clang:
|
|
|
|
# mingw-clang needs to link in ssp which is not done by default
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
ldflags.append("-lssp")
|
|
|
|
js_ldflags.append("-lssp")
|
2017-11-21 07:20:56 +03:00
|
|
|
|
2018-11-30 10:45:23 +03:00
|
|
|
# fstack-protector ------------------------------------
|
|
|
|
# Enable only if hardening is not disabled and ASAN is
|
|
|
|
# not on as ASAN will catch the crashes for us
|
|
|
|
if compiler_is_gccish and not asan:
|
2019-12-09 20:02:50 +03:00
|
|
|
flags.append("-fstack-protector-strong")
|
|
|
|
ldflags.append("-fstack-protector-strong")
|
|
|
|
js_flags.append("-fstack-protector-strong")
|
|
|
|
js_ldflags.append("-fstack-protector-strong")
|
2018-11-30 10:45:23 +03:00
|
|
|
|
2019-08-21 10:08:29 +03:00
|
|
|
# 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
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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")
|
2019-08-21 10:08:29 +03:00
|
|
|
|
2019-01-15 03:49:23 +03:00
|
|
|
# ASLR ------------------------------------------------
|
|
|
|
# ASLR (dynamicbase) is enabled by default in clang-cl; but the
|
|
|
|
# mingw-clang build requires it to be explicitly enabled
|
2019-08-21 10:08:04 +03:00
|
|
|
if mingw_clang:
|
2019-01-15 03:49:23 +03:00
|
|
|
ldflags.append("-Wl,--dynamicbase")
|
|
|
|
js_ldflags.append("-Wl,--dynamicbase")
|
|
|
|
|
2019-01-25 19:41:27 +03:00
|
|
|
# Control Flow Guard (CFG) ----------------------------
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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":
|
2020-05-21 05:11:23 +03:00
|
|
|
# The added checks in clang 10 make arm64 builds crash. (Bug 1639318)
|
|
|
|
flags.append("-guard:cf,nochecks")
|
|
|
|
js_flags.append("-guard:cf,nochecks")
|
|
|
|
else:
|
|
|
|
flags.append("-guard:cf")
|
|
|
|
js_flags.append("-guard:cf")
|
2019-01-25 19:41:27 +03:00
|
|
|
# nolongjmp is needed because clang doesn't emit the CFG tables of
|
|
|
|
# setjmp return addresses https://bugs.llvm.org/show_bug.cgi?id=40057
|
|
|
|
ldflags.append("-guard:cf,nolongjmp")
|
|
|
|
js_ldflags.append("-guard:cf,nolongjmp")
|
|
|
|
|
|
|
|
# ----------------------------------------------------------
|
|
|
|
# If ASAN _is_ on, undefine FORTIFY_SOURCE just to be safe
|
2017-11-21 07:20:56 +03:00
|
|
|
if asan:
|
|
|
|
flags.append("-U_FORTIFY_SOURCE")
|
|
|
|
js_flags.append("-U_FORTIFY_SOURCE")
|
|
|
|
|
2018-01-16 17:00:31 +03:00
|
|
|
# fno-common -----------------------------------------
|
|
|
|
# Do not merge variables for ASAN; can detect some subtle bugs
|
|
|
|
if asan:
|
2018-03-13 18:32:15 +03:00
|
|
|
# clang-cl does not recognize the flag, it must be passed down to clang
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if c_compiler.type == "clang-cl":
|
2018-03-13 18:32:15 +03:00
|
|
|
flags.append("-Xclang")
|
2018-01-16 17:00:31 +03:00
|
|
|
flags.append("-fno-common")
|
|
|
|
|
2017-11-21 07:20:56 +03:00
|
|
|
return namespace(
|
|
|
|
flags=flags,
|
2019-01-15 03:49:23 +03:00
|
|
|
ldflags=ldflags,
|
2017-11-21 07:20:56 +03:00
|
|
|
js_flags=js_flags,
|
2019-01-15 03:49:23 +03:00
|
|
|
js_ldflags=js_ldflags,
|
2017-11-21 07:20:56 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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)
|
2017-06-06 03:05:10 +03:00
|
|
|
|
2019-07-05 03:08:32 +03:00
|
|
|
|
|
|
|
# Frame pointers
|
|
|
|
# ==============================================================
|
|
|
|
@depends(c_compiler)
|
|
|
|
def frame_pointer_flags(compiler):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if compiler.type == "clang-cl":
|
2019-07-05 03:08:32 +03:00
|
|
|
return namespace(
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
enable=["-Oy-"],
|
|
|
|
disable=["-Oy"],
|
2019-07-05 03:08:32 +03:00
|
|
|
)
|
|
|
|
return namespace(
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
enable=["-fno-omit-frame-pointer", "-funwind-tables"],
|
|
|
|
disable=["-fomit-frame-pointer", "-funwind-tables"],
|
2019-07-05 03:08:32 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends(
|
|
|
|
moz_optimize.optimize,
|
|
|
|
moz_debug,
|
|
|
|
target,
|
|
|
|
"--enable-memory-sanitizer",
|
|
|
|
"--enable-address-sanitizer",
|
|
|
|
"--enable-undefined-sanitizer",
|
|
|
|
)
|
2019-07-05 03:08:32 +03:00
|
|
|
def frame_pointer_default(optimize, debug, target, msan, asan, ubsan):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
return bool(
|
|
|
|
not optimize
|
|
|
|
or debug
|
|
|
|
or msan
|
|
|
|
or asan
|
|
|
|
or ubsan
|
|
|
|
or (target.os == "WINNT" and target.cpu in ("x86", "aarch64"))
|
|
|
|
)
|
2019-07-05 03:08:32 +03:00
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option(
|
|
|
|
"--enable-frame-pointers",
|
|
|
|
default=frame_pointer_default,
|
|
|
|
help="{Enable|Disable} frame pointers",
|
|
|
|
)
|
2019-07-05 03:08:32 +03:00
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends("--enable-frame-pointers", frame_pointer_flags)
|
2019-07-05 03:08:32 +03:00
|
|
|
def frame_pointer_flags(enable, flags):
|
|
|
|
if enable:
|
|
|
|
return flags.enable
|
|
|
|
return flags.disable
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("MOZ_FRAMEPTR_FLAGS", frame_pointer_flags)
|
2019-07-05 03:08:32 +03:00
|
|
|
|
|
|
|
|
2019-03-11 21:00:13 +03:00
|
|
|
# nasm detection
|
|
|
|
# ==============================================================
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
nasm = check_prog("NASM", ["nasm"], allow_missing=True, paths=toolchain_search_path)
|
2019-03-11 21:00:13 +03:00
|
|
|
|
|
|
|
|
|
|
|
@depends_if(nasm)
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@checking("nasm version")
|
2019-03-11 21:00:13 +03:00
|
|
|
def nasm_version(nasm):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
(retcode, stdout, _) = get_cmd_output(nasm, "-v")
|
2019-03-11 21:00:13 +03:00
|
|
|
if retcode:
|
|
|
|
# mac stub binary
|
|
|
|
return None
|
|
|
|
|
|
|
|
version = stdout.splitlines()[0].split()[2]
|
|
|
|
return Version(version)
|
|
|
|
|
|
|
|
|
|
|
|
@depends_if(nasm_version)
|
|
|
|
def nasm_major_version(nasm_version):
|
|
|
|
return str(nasm_version.major)
|
|
|
|
|
|
|
|
|
|
|
|
@depends_if(nasm_version)
|
|
|
|
def nasm_minor_version(nasm_version):
|
|
|
|
return str(nasm_version.minor)
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("NASM_MAJOR_VERSION", nasm_major_version)
|
|
|
|
set_config("NASM_MINOR_VERSION", nasm_minor_version)
|
2019-03-11 21:00:13 +03:00
|
|
|
|
|
|
|
|
|
|
|
@depends(nasm, target)
|
|
|
|
def nasm_asflags(nasm, target):
|
|
|
|
if nasm:
|
|
|
|
asflags = {
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
("OSX", "x86"): ["-f", "macho32"],
|
|
|
|
("OSX", "x86_64"): ["-f", "macho64"],
|
|
|
|
("WINNT", "x86"): ["-f", "win32"],
|
|
|
|
("WINNT", "x86_64"): ["-f", "win64"],
|
2019-03-11 21:00:13 +03:00
|
|
|
}.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.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if target.cpu == "x86":
|
|
|
|
asflags = ["-f", "elf32"]
|
|
|
|
elif target.cpu == "x86_64":
|
|
|
|
asflags = ["-f", "elf64"]
|
2019-03-11 21:00:13 +03:00
|
|
|
return asflags
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("NASM_ASFLAGS", nasm_asflags)
|
|
|
|
|
2019-03-11 21:00:13 +03:00
|
|
|
|
|
|
|
@depends(nasm_asflags)
|
|
|
|
def have_nasm(value):
|
|
|
|
if value:
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
@depends(yasm_asflags)
|
|
|
|
def have_yasm(yasm_asflags):
|
|
|
|
if yasm_asflags:
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("HAVE_NASM", have_nasm)
|
|
|
|
|
|
|
|
set_config("HAVE_YASM", have_yasm)
|
2019-03-11 21:00:13 +03:00
|
|
|
# Until the YASM variable is not necessary in old-configure.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
add_old_configure_assignment("YASM", have_yasm)
|
2019-03-11 21:00:13 +03:00
|
|
|
|
2019-05-01 18:04:48 +03:00
|
|
|
|
2018-06-20 13:16:43 +03:00
|
|
|
# Code Coverage
|
|
|
|
# ==============================================================
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option("--enable-coverage", env="MOZ_CODE_COVERAGE", help="Enable code coverage")
|
2018-06-20 13:16:43 +03:00
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends("--enable-coverage")
|
2018-06-20 13:16:43 +03:00
|
|
|
def code_coverage(value):
|
|
|
|
if value:
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("MOZ_CODE_COVERAGE", code_coverage)
|
|
|
|
set_define("MOZ_CODE_COVERAGE", code_coverage)
|
|
|
|
|
2018-06-20 13:16:43 +03:00
|
|
|
|
2019-10-23 22:37:41 +03:00
|
|
|
@depends(target, c_compiler, vc_path, check_build_environment, when=code_coverage)
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@imports("os")
|
|
|
|
@imports("re")
|
|
|
|
@imports(_from="__builtin__", _import="open")
|
2019-10-23 23:10:17 +03:00
|
|
|
def coverage_cflags(target, c_compiler, vc_path, build_env):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
cflags = ["--coverage"]
|
2019-02-20 15:18:32 +03:00
|
|
|
|
2020-06-25 19:24:40 +03:00
|
|
|
# clang 11 no longer accepts this flag (its behavior became the default)
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if c_compiler.type in ("clang", "clang-cl") and c_compiler.version < "11.0.0":
|
2019-02-20 15:18:32 +03:00
|
|
|
cflags += [
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"-Xclang",
|
|
|
|
"-coverage-no-function-names-in-data",
|
2019-02-20 15:18:32 +03:00
|
|
|
]
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if target.os == "WINNT" and c_compiler.type == "clang-cl":
|
2019-02-20 15:18:56 +03:00
|
|
|
# The Visual Studio directory is the parent of the Visual C++ directory.
|
|
|
|
vs_path = os.path.dirname(vc_path)
|
|
|
|
|
|
|
|
# We need to get the real path of Visual Studio, which can be in a
|
|
|
|
# symlinked directory (for example, on automation).
|
2020-04-09 23:44:15 +03:00
|
|
|
vs_path = os.path.realpath(vs_path)
|
2019-02-20 15:18:56 +03:00
|
|
|
|
|
|
|
cflags += [
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"-fprofile-exclude-files=^{}.*$".format(re.escape(vs_path)),
|
2019-02-20 15:18:56 +03:00
|
|
|
]
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
response_file_path = os.path.join(build_env.topobjdir, "code_coverage_cflags")
|
2019-02-20 15:18:56 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
with open(response_file_path, "w") as f:
|
|
|
|
f.write(" ".join(cflags))
|
2019-02-20 15:18:56 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
return ["@{}".format(response_file_path)]
|
2019-02-20 15:18:32 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
|
|
|
|
set_config("COVERAGE_CFLAGS", coverage_cflags)
|
2019-02-20 15:18:32 +03:00
|
|
|
|
2017-11-21 07:20:56 +03:00
|
|
|
# ==============================================================
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option(env="RUSTFLAGS", nargs=1, help="Rust compiler flags")
|
|
|
|
set_config("RUSTFLAGS", depends("RUSTFLAGS")(lambda flags: flags))
|
2017-06-21 04:29:28 +03:00
|
|
|
|
|
|
|
|
2017-10-25 00:42:01 +03:00
|
|
|
# Rust compiler flags
|
|
|
|
# ==============================================================
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option(
|
|
|
|
env="RUSTC_OPT_LEVEL",
|
|
|
|
nargs=1,
|
|
|
|
help="Rust compiler optimization level (-C opt-level=%s)",
|
|
|
|
)
|
2017-10-25 02:48:58 +03:00
|
|
|
|
|
|
|
# --enable-release kicks in full optimizations.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
imply_option("RUSTC_OPT_LEVEL", "2", when="--enable-release")
|
2017-10-25 02:48:58 +03:00
|
|
|
|
2017-10-25 20:57:51 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends("RUSTC_OPT_LEVEL", moz_optimize)
|
2018-03-12 20:25:39 +03:00
|
|
|
def rustc_opt_level(opt_level_option, moz_optimize):
|
|
|
|
if opt_level_option:
|
|
|
|
return opt_level_option[0]
|
|
|
|
else:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
return "1" if moz_optimize.optimize else "0"
|
2018-03-12 20:25:39 +03:00
|
|
|
|
2017-10-25 00:42:01 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends(
|
|
|
|
rustc_opt_level, debug_rust, "--enable-debug-symbols", "--enable-frame-pointers"
|
|
|
|
)
|
2019-07-05 03:08:32 +03:00
|
|
|
def rust_compile_flags(opt_level, debug_rust, debug_symbols, frame_pointers):
|
2017-10-25 00:42:01 +03:00
|
|
|
# Cargo currently supports only two interesting profiles for building:
|
|
|
|
# development and release. Those map (roughly) to --enable-debug and
|
|
|
|
# --disable-debug in Gecko, respectively.
|
|
|
|
#
|
|
|
|
# But we'd also like to support an additional axis of control for
|
|
|
|
# optimization level. Since Cargo only supports 2 profiles, we're in
|
|
|
|
# a bit of a bind.
|
|
|
|
#
|
|
|
|
# Code here derives various compiler options given other configure options.
|
|
|
|
# The options defined here effectively override defaults specified in
|
|
|
|
# Cargo.toml files.
|
|
|
|
|
|
|
|
debug_assertions = None
|
|
|
|
debug_info = None
|
|
|
|
|
|
|
|
# opt-level=0 implies -C debug-assertions, which may not be desired
|
|
|
|
# unless Rust debugging is enabled.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if opt_level == "0" and not debug_rust:
|
2017-10-25 00:42:01 +03:00
|
|
|
debug_assertions = False
|
|
|
|
|
|
|
|
if debug_symbols:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
debug_info = "2"
|
2017-10-25 00:42:01 +03:00
|
|
|
|
2017-10-26 21:26:14 +03:00
|
|
|
opts = []
|
2017-10-25 00:42:01 +03:00
|
|
|
|
|
|
|
if opt_level is not None:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
opts.append("opt-level=%s" % opt_level)
|
2017-10-25 00:42:01 +03:00
|
|
|
if debug_assertions is not None:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
opts.append("debug-assertions=%s" % ("yes" if debug_assertions else "no"))
|
2017-10-25 00:42:01 +03:00
|
|
|
if debug_info is not None:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
opts.append("debuginfo=%s" % debug_info)
|
2019-07-05 03:08:32 +03:00
|
|
|
if frame_pointers:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
opts.append("force-frame-pointers=yes")
|
2017-10-26 21:26:14 +03:00
|
|
|
|
|
|
|
flags = []
|
|
|
|
for opt in opts:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
flags.extend(["-C", opt])
|
2017-10-25 00:42:01 +03:00
|
|
|
|
|
|
|
return flags
|
|
|
|
|
2017-10-25 20:57:51 +03:00
|
|
|
|
2018-03-12 20:25:39 +03:00
|
|
|
# Rust incremental compilation
|
|
|
|
# ==============================================================
|
|
|
|
|
2019-08-23 07:50:55 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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,
|
|
|
|
):
|
2018-03-12 20:25:39 +03:00
|
|
|
"""Return a value for the CARGO_INCREMENTAL environment variable."""
|
|
|
|
|
2019-05-18 02:00:30 +03:00
|
|
|
if not enabled:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
return "0"
|
2019-05-18 02:00:30 +03:00
|
|
|
|
2018-03-12 20:25:39 +03:00
|
|
|
# We never want to use incremental compilation in automation. sccache
|
|
|
|
# handles our automation use case much better than incremental compilation
|
|
|
|
# would.
|
|
|
|
if automation:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
return "0"
|
2018-03-12 20:25:39 +03:00
|
|
|
|
2018-06-20 13:16:43 +03:00
|
|
|
# Coverage instrumentation doesn't play well with incremental compilation
|
|
|
|
# https://github.com/rust-lang/rust/issues/50203.
|
|
|
|
if code_coverage:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
return "0"
|
2018-06-20 13:16:43 +03:00
|
|
|
|
2019-08-23 07:50:55 +03:00
|
|
|
# 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])
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if os.path.splitext(rustc_wrapper)[0].lower() == "sccache":
|
2019-08-23 07:50:55 +03:00
|
|
|
using_sccache = True
|
|
|
|
if using_sccache:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
return "0"
|
2019-08-23 07:50:55 +03:00
|
|
|
|
2018-03-12 20:25:39 +03:00
|
|
|
# Incremental compilation is automatically turned on for debug builds, so
|
|
|
|
# we don't need to do anything special here.
|
|
|
|
if debug_rust:
|
|
|
|
return
|
|
|
|
|
|
|
|
# --enable-release automatically sets -O2 for Rust code, and people can
|
|
|
|
# set RUSTC_OPT_LEVEL to 2 or even 3 if they want to profile Rust code.
|
|
|
|
# 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.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if opt_level not in ("0", "1"):
|
2018-03-12 20:25:39 +03:00
|
|
|
return
|
|
|
|
|
|
|
|
# We're clear to use incremental compilation!
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
return "1"
|
2018-03-12 20:25:39 +03:00
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("CARGO_INCREMENTAL", cargo_incremental)
|
2018-03-12 20:25:39 +03:00
|
|
|
|
2017-07-05 12:27:56 +03:00
|
|
|
# Linker detection
|
|
|
|
# ==============================================================
|
2020-04-29 03:13:56 +03:00
|
|
|
# The policy is as follows:
|
|
|
|
# For Windows:
|
|
|
|
# - the linker is picked via the LINKER environment variable per windows.configure,
|
|
|
|
# but ought to be llvm-lld in any case.
|
|
|
|
# For macOS:
|
|
|
|
# - the linker is ld64, either from XCode on macOS, or from cctools-ports when
|
|
|
|
# cross-compiling. lld can be enabled manually, but as of writing, mach-o support
|
|
|
|
# for lld is incomplete.
|
|
|
|
# For other OSes:
|
|
|
|
# - on local developer builds: lld is used if present. Otherwise gold is used if present
|
|
|
|
# otherwise, BFD ld is used.
|
2020-07-15 12:06:39 +03:00
|
|
|
# - on release/official builds: whatever "ld" resolves to is used, except on Android x86/x86_64
|
2020-04-29 03:13:56 +03:00
|
|
|
# where BFD ld is used. Usually, "ld" resolves to BFD ld, except with the Android NDK,
|
|
|
|
# where it resolves to gold. lld is not used by default on Linux and Android because
|
|
|
|
# it introduces layout changes that prevent elfhack from working. See e.g.
|
|
|
|
# https://bugzilla.mozilla.org/show_bug.cgi?id=1563654#c2.
|
2017-07-05 12:27:56 +03:00
|
|
|
@depends(target)
|
2017-10-10 13:01:32 +03:00
|
|
|
def is_linker_option_enabled(target):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if target.kernel not in ("WINNT", "SunOS"):
|
2017-07-05 12:27:56 +03:00
|
|
|
return True
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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")
|
2017-07-05 12:27:56 +03:00
|
|
|
|
|
|
|
|
2019-08-23 22:26:22 +03:00
|
|
|
@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.
|
2020-07-15 12:06:39 +03:00
|
|
|
# x86-32 gold has a bug when assembly files are built. See bug 1651699.
|
2019-08-23 22:26:22 +03:00
|
|
|
# lld is faster, so prefer that for developer builds.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if target.os == "Android" and target.cpu in ("x86", "x86_64"):
|
|
|
|
return "lld" if developer_options else "bfd"
|
2019-08-23 22:26:22 +03:00
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option(
|
|
|
|
"--enable-linker",
|
|
|
|
nargs=1,
|
|
|
|
help="Select the linker {bfd, gold, ld64, lld, lld-*}{|}",
|
|
|
|
default=enable_linker_default,
|
|
|
|
when=is_linker_option_enabled,
|
|
|
|
)
|
2018-04-26 14:27:36 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
2020-08-05 00:56:41 +03:00
|
|
|
# No-op to enable depending on --enable-linker from default_elfhack in
|
|
|
|
# toolkit/moz.configure.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends("--enable-linker", when=is_linker_option_enabled)
|
2020-08-05 00:56:41 +03:00
|
|
|
def enable_linker(linker):
|
|
|
|
return linker
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@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
|
|
|
|
):
|
Bug 1469088 - Relax the assumptions of --enable-lto, and make it work for macOS builds. r=ted
Currently, --enable-lto just implies --enable-linker=lld, which
essentially only works on Linux, and assumes one can't do lto with
anything other than lld. Which is not true. As a matter of fact, even
ld.bfd can do lto, as long as the gold plugin for llvm is available,
or when doing lto with GCC instead of clang.
Anyways, to allow more lto setups, we adapt the --enable-linker setup
to:
- work on macOS, which it currently doesn't, and add support for the mac
linker (ld64), which, unfortunately, doesn't have a clean way to be
detected, so work around that.
- default to lld if lto is enable, no linker was explicitly given, the
compiler is clang *and* the build target is not macOS.
--HG--
extra : rebase_source : 1dab2ad6230d18e7f4285943e76352e23b987d4e
2018-07-05 05:35:31 +03:00
|
|
|
|
|
|
|
if linker:
|
|
|
|
linker = linker[0]
|
|
|
|
else:
|
|
|
|
linker = None
|
2018-04-26 14:27:36 +03:00
|
|
|
|
Bug 1469088 - Relax the assumptions of --enable-lto, and make it work for macOS builds. r=ted
Currently, --enable-lto just implies --enable-linker=lld, which
essentially only works on Linux, and assumes one can't do lto with
anything other than lld. Which is not true. As a matter of fact, even
ld.bfd can do lto, as long as the gold plugin for llvm is available,
or when doing lto with GCC instead of clang.
Anyways, to allow more lto setups, we adapt the --enable-linker setup
to:
- work on macOS, which it currently doesn't, and add support for the mac
linker (ld64), which, unfortunately, doesn't have a clean way to be
detected, so work around that.
- default to lld if lto is enable, no linker was explicitly given, the
compiler is clang *and* the build target is not macOS.
--HG--
extra : rebase_source : 1dab2ad6230d18e7f4285943e76352e23b987d4e
2018-07-05 05:35:31 +03:00
|
|
|
def is_valid_linker(linker):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if target.kernel == "Darwin":
|
|
|
|
valid_linkers = ("ld64", "lld")
|
Bug 1469088 - Relax the assumptions of --enable-lto, and make it work for macOS builds. r=ted
Currently, --enable-lto just implies --enable-linker=lld, which
essentially only works on Linux, and assumes one can't do lto with
anything other than lld. Which is not true. As a matter of fact, even
ld.bfd can do lto, as long as the gold plugin for llvm is available,
or when doing lto with GCC instead of clang.
Anyways, to allow more lto setups, we adapt the --enable-linker setup
to:
- work on macOS, which it currently doesn't, and add support for the mac
linker (ld64), which, unfortunately, doesn't have a clean way to be
detected, so work around that.
- default to lld if lto is enable, no linker was explicitly given, the
compiler is clang *and* the build target is not macOS.
--HG--
extra : rebase_source : 1dab2ad6230d18e7f4285943e76352e23b987d4e
2018-07-05 05:35:31 +03:00
|
|
|
else:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
valid_linkers = ("bfd", "gold", "lld")
|
Bug 1469088 - Relax the assumptions of --enable-lto, and make it work for macOS builds. r=ted
Currently, --enable-lto just implies --enable-linker=lld, which
essentially only works on Linux, and assumes one can't do lto with
anything other than lld. Which is not true. As a matter of fact, even
ld.bfd can do lto, as long as the gold plugin for llvm is available,
or when doing lto with GCC instead of clang.
Anyways, to allow more lto setups, we adapt the --enable-linker setup
to:
- work on macOS, which it currently doesn't, and add support for the mac
linker (ld64), which, unfortunately, doesn't have a clean way to be
detected, so work around that.
- default to lld if lto is enable, no linker was explicitly given, the
compiler is clang *and* the build target is not macOS.
--HG--
extra : rebase_source : 1dab2ad6230d18e7f4285943e76352e23b987d4e
2018-07-05 05:35:31 +03:00
|
|
|
if linker in valid_linkers:
|
|
|
|
return True
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if "lld" in valid_linkers and linker.startswith("lld-"):
|
Bug 1469088 - Relax the assumptions of --enable-lto, and make it work for macOS builds. r=ted
Currently, --enable-lto just implies --enable-linker=lld, which
essentially only works on Linux, and assumes one can't do lto with
anything other than lld. Which is not true. As a matter of fact, even
ld.bfd can do lto, as long as the gold plugin for llvm is available,
or when doing lto with GCC instead of clang.
Anyways, to allow more lto setups, we adapt the --enable-linker setup
to:
- work on macOS, which it currently doesn't, and add support for the mac
linker (ld64), which, unfortunately, doesn't have a clean way to be
detected, so work around that.
- default to lld if lto is enable, no linker was explicitly given, the
compiler is clang *and* the build target is not macOS.
--HG--
extra : rebase_source : 1dab2ad6230d18e7f4285943e76352e23b987d4e
2018-07-05 05:35:31 +03:00
|
|
|
return True
|
|
|
|
return False
|
|
|
|
|
|
|
|
if linker and not is_valid_linker(linker):
|
2018-05-09 14:53:16 +03:00
|
|
|
# Check that we are trying to use a supported linker
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
die("Unsupported linker " + linker)
|
2018-05-09 14:53:16 +03:00
|
|
|
|
2018-04-26 14:27:36 +03:00
|
|
|
# Check the kind of linker
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
version_check = ["-Wl,--version"]
|
2017-07-05 12:27:56 +03:00
|
|
|
cmd_base = c_compiler.wrapper + [c_compiler.compiler] + c_compiler.flags
|
|
|
|
|
2018-06-07 02:46:31 +03:00
|
|
|
def try_linker(linker):
|
|
|
|
# Generate the compiler flag
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if linker == "ld64":
|
|
|
|
linker_flag = ["-fuse-ld=ld"]
|
Bug 1469088 - Relax the assumptions of --enable-lto, and make it work for macOS builds. r=ted
Currently, --enable-lto just implies --enable-linker=lld, which
essentially only works on Linux, and assumes one can't do lto with
anything other than lld. Which is not true. As a matter of fact, even
ld.bfd can do lto, as long as the gold plugin for llvm is available,
or when doing lto with GCC instead of clang.
Anyways, to allow more lto setups, we adapt the --enable-linker setup
to:
- work on macOS, which it currently doesn't, and add support for the mac
linker (ld64), which, unfortunately, doesn't have a clean way to be
detected, so work around that.
- default to lld if lto is enable, no linker was explicitly given, the
compiler is clang *and* the build target is not macOS.
--HG--
extra : rebase_source : 1dab2ad6230d18e7f4285943e76352e23b987d4e
2018-07-05 05:35:31 +03:00
|
|
|
elif linker:
|
|
|
|
linker_flag = ["-fuse-ld=" + linker]
|
|
|
|
else:
|
|
|
|
linker_flag = []
|
2018-06-07 02:46:31 +03:00
|
|
|
cmd = cmd_base + linker_flag + version_check
|
|
|
|
if toolchain_flags:
|
|
|
|
cmd += toolchain_flags
|
2018-06-07 02:46:31 +03:00
|
|
|
|
Bug 1469088 - Relax the assumptions of --enable-lto, and make it work for macOS builds. r=ted
Currently, --enable-lto just implies --enable-linker=lld, which
essentially only works on Linux, and assumes one can't do lto with
anything other than lld. Which is not true. As a matter of fact, even
ld.bfd can do lto, as long as the gold plugin for llvm is available,
or when doing lto with GCC instead of clang.
Anyways, to allow more lto setups, we adapt the --enable-linker setup
to:
- work on macOS, which it currently doesn't, and add support for the mac
linker (ld64), which, unfortunately, doesn't have a clean way to be
detected, so work around that.
- default to lld if lto is enable, no linker was explicitly given, the
compiler is clang *and* the build target is not macOS.
--HG--
extra : rebase_source : 1dab2ad6230d18e7f4285943e76352e23b987d4e
2018-07-05 05:35:31 +03:00
|
|
|
# ld64 doesn't have anything to print out a version. It does print out
|
|
|
|
# "ld64: For information on command line options please use 'man ld'."
|
|
|
|
# but that would require doing two attempts, one with --version, that
|
|
|
|
# would fail, and another with --help.
|
|
|
|
# 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)
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
env["LD_PRINT_OPTIONS"] = "1"
|
2020-05-14 20:50:14 +03:00
|
|
|
# Some locales might not print out the strings we are looking for, so
|
|
|
|
# ensure consistent output.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
env["LC_ALL"] = "C"
|
Bug 1469088 - Relax the assumptions of --enable-lto, and make it work for macOS builds. r=ted
Currently, --enable-lto just implies --enable-linker=lld, which
essentially only works on Linux, and assumes one can't do lto with
anything other than lld. Which is not true. As a matter of fact, even
ld.bfd can do lto, as long as the gold plugin for llvm is available,
or when doing lto with GCC instead of clang.
Anyways, to allow more lto setups, we adapt the --enable-linker setup
to:
- work on macOS, which it currently doesn't, and add support for the mac
linker (ld64), which, unfortunately, doesn't have a clean way to be
detected, so work around that.
- default to lld if lto is enable, no linker was explicitly given, the
compiler is clang *and* the build target is not macOS.
--HG--
extra : rebase_source : 1dab2ad6230d18e7f4285943e76352e23b987d4e
2018-07-05 05:35:31 +03:00
|
|
|
retcode, stdout, stderr = get_cmd_output(*cmd, env=env)
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if retcode == 1 and "Logging ld64 options" in stderr:
|
|
|
|
kind = "ld64"
|
Bug 1469088 - Relax the assumptions of --enable-lto, and make it work for macOS builds. r=ted
Currently, --enable-lto just implies --enable-linker=lld, which
essentially only works on Linux, and assumes one can't do lto with
anything other than lld. Which is not true. As a matter of fact, even
ld.bfd can do lto, as long as the gold plugin for llvm is available,
or when doing lto with GCC instead of clang.
Anyways, to allow more lto setups, we adapt the --enable-linker setup
to:
- work on macOS, which it currently doesn't, and add support for the mac
linker (ld64), which, unfortunately, doesn't have a clean way to be
detected, so work around that.
- default to lld if lto is enable, no linker was explicitly given, the
compiler is clang *and* the build target is not macOS.
--HG--
extra : rebase_source : 1dab2ad6230d18e7f4285943e76352e23b987d4e
2018-07-05 05:35:31 +03:00
|
|
|
|
|
|
|
elif retcode != 0:
|
2018-07-05 03:28:49 +03:00
|
|
|
return None
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
elif "GNU ld" in stdout:
|
2018-06-07 02:46:31 +03:00
|
|
|
# We are using the normal linker
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
kind = "bfd"
|
2018-06-07 02:46:31 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
elif "GNU gold" in stdout:
|
|
|
|
kind = "gold"
|
2018-06-07 02:46:31 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
elif "LLD" in stdout:
|
|
|
|
kind = "lld"
|
2018-06-07 02:46:31 +03:00
|
|
|
|
|
|
|
else:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
kind = "unknown"
|
2017-07-05 12:27:56 +03:00
|
|
|
|
2018-04-26 14:27:36 +03:00
|
|
|
return namespace(
|
2018-06-07 02:46:31 +03:00
|
|
|
KIND=kind,
|
2018-04-26 14:27:36 +03:00
|
|
|
LINKER_FLAG=linker_flag,
|
|
|
|
)
|
2018-06-07 02:46:31 +03:00
|
|
|
|
|
|
|
result = try_linker(linker)
|
2018-07-05 03:28:49 +03:00
|
|
|
if result is None:
|
|
|
|
if linker:
|
|
|
|
die("Could not use {} as linker".format(linker))
|
|
|
|
die("Failed to find a linker")
|
2018-06-07 02:46:31 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if (
|
|
|
|
linker is None
|
|
|
|
and enable_gold.origin == "default"
|
|
|
|
and developer_options
|
|
|
|
and result.KIND in ("bfd", "gold")
|
|
|
|
):
|
2018-07-05 03:28:49 +03:00
|
|
|
# try and use lld if available.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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":
|
2018-07-05 03:28:49 +03:00
|
|
|
tried = None
|
|
|
|
if tried:
|
|
|
|
result = tried
|
2018-06-07 02:46:31 +03:00
|
|
|
|
|
|
|
# If an explicit linker was given, error out if what we found is different.
|
|
|
|
if linker and not linker.startswith(result.KIND):
|
2018-05-09 14:53:16 +03:00
|
|
|
die("Could not use {} as linker".format(linker))
|
2018-04-26 14:27:36 +03:00
|
|
|
|
2018-06-07 02:46:31 +03:00
|
|
|
return result
|
2017-07-05 12:27:56 +03:00
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("LINKER_KIND", select_linker.KIND)
|
2018-12-13 11:01:23 +03:00
|
|
|
|
|
|
|
|
|
|
|
@depends_if(select_linker, macos_sdk)
|
|
|
|
def linker_ldflags(linker, macos_sdk):
|
2020-07-07 05:13:35 +03:00
|
|
|
flags = list((linker and linker.LINKER_FLAG) or [])
|
2018-12-13 11:01:23 +03:00
|
|
|
if macos_sdk:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if linker and linker.KIND == "ld64":
|
|
|
|
flags.append("-Wl,-syslibroot,%s" % macos_sdk)
|
2018-12-13 11:01:23 +03:00
|
|
|
else:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
flags.append("-Wl,--sysroot=%s" % macos_sdk)
|
2018-12-13 11:01:23 +03:00
|
|
|
|
|
|
|
return flags
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
add_old_configure_assignment("LINKER_LDFLAGS", linker_ldflags)
|
2017-10-05 19:30:26 +03:00
|
|
|
|
2017-10-26 01:12:10 +03:00
|
|
|
|
2018-10-17 22:46:03 +03:00
|
|
|
# There's a wrinkle with MinGW: linker configuration is not enabled, so
|
|
|
|
# `select_linker` is never invoked. Hard-code around it.
|
|
|
|
@depends(select_linker, target, c_compiler)
|
|
|
|
def gcc_use_gnu_ld(select_linker, target, c_compiler):
|
|
|
|
if select_linker is not None:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
return select_linker.KIND in ("bfd", "gold", "lld")
|
|
|
|
if target.kernel == "WINNT" and c_compiler.type == "clang":
|
2018-10-17 22:46:03 +03:00
|
|
|
return True
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
# GCC_USE_GNU_LD=1 means the linker is command line compatible with GNU ld.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("GCC_USE_GNU_LD", gcc_use_gnu_ld)
|
|
|
|
add_old_configure_assignment("GCC_USE_GNU_LD", gcc_use_gnu_ld)
|
2018-10-17 22:46:03 +03:00
|
|
|
|
2018-10-04 03:29:29 +03:00
|
|
|
# Assembler detection
|
|
|
|
# ==============================================================
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option(env="AS", nargs=1, help="Path to the assembler")
|
|
|
|
|
2018-10-04 03:29:29 +03:00
|
|
|
|
|
|
|
@depends(target, c_compiler)
|
|
|
|
def as_info(target, c_compiler):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if c_compiler.type == "clang-cl":
|
2018-10-04 03:29:29 +03:00
|
|
|
ml = {
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"x86": "ml.exe",
|
|
|
|
"x86_64": "ml64.exe",
|
|
|
|
"aarch64": "armasm64.exe",
|
2018-10-04 03:29:29 +03:00
|
|
|
}.get(target.cpu)
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
return namespace(type="masm", names=(ml,))
|
2019-02-15 00:45:27 +03:00
|
|
|
# When building with anything but clang-cl, we just use the C compiler as the assembler.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
return namespace(type="gcc", names=(c_compiler.compiler,))
|
|
|
|
|
2018-10-04 03:29:29 +03:00
|
|
|
|
|
|
|
# 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
|
|
|
|
# the same way as CC: a program + a list of argument flags. We might as well
|
|
|
|
# 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`.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
provided_assembler = provided_program("AS")
|
|
|
|
assembler = check_prog(
|
|
|
|
"_AS",
|
|
|
|
input=provided_assembler.program,
|
|
|
|
what="the assembler",
|
|
|
|
progs=as_info.names,
|
|
|
|
paths=toolchain_search_path,
|
|
|
|
)
|
|
|
|
|
2018-10-04 03:29:29 +03:00
|
|
|
|
|
|
|
@depends(as_info, assembler, provided_assembler, c_compiler)
|
|
|
|
def as_with_flags(as_info, assembler, provided_assembler, c_compiler):
|
|
|
|
if provided_assembler:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
return provided_assembler.wrapper + [assembler] + provided_assembler.flags
|
2018-10-04 03:29:29 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if as_info.type == "masm":
|
2018-10-04 03:29:29 +03:00
|
|
|
return assembler
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
assert as_info.type == "gcc"
|
2018-10-04 03:29:29 +03:00
|
|
|
|
|
|
|
# Need to add compiler wrappers and flags as appropriate.
|
|
|
|
return c_compiler.wrapper + [assembler] + c_compiler.flags
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
add_old_configure_assignment("AS", as_with_flags)
|
|
|
|
add_old_configure_assignment("ac_cv_prog_AS", as_with_flags)
|
2018-10-04 03:29:29 +03:00
|
|
|
|
2018-10-04 03:29:29 +03:00
|
|
|
|
|
|
|
@depends(assembler, c_compiler, extra_toolchain_flags)
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@imports("subprocess")
|
|
|
|
@imports(_from="os", _import="devnull")
|
2018-10-04 03:29:29 +03:00
|
|
|
def gnu_as(assembler, c_compiler, toolchain_flags):
|
|
|
|
# clang uses a compatible GNU assembler.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if c_compiler.type == "clang":
|
2018-10-04 03:29:29 +03:00
|
|
|
return True
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if c_compiler.type == "gcc":
|
2018-10-04 03:29:29 +03:00
|
|
|
cmd = [assembler] + c_compiler.flags
|
|
|
|
if toolchain_flags:
|
|
|
|
cmd += toolchain_flags
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
cmd += ["-Wa,--version", "-c", "-o", devnull, "-x", "assembler", "-"]
|
2018-10-04 03:29:29 +03:00
|
|
|
# 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.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if "GNU" in check_cmd_output(*cmd, stdin=subprocess.PIPE, onerror=lambda: ""):
|
2018-10-04 03:29:29 +03:00
|
|
|
return True
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("GNU_AS", gnu_as)
|
|
|
|
add_old_configure_assignment("GNU_AS", gnu_as)
|
2018-10-04 03:29:29 +03:00
|
|
|
|
|
|
|
|
2018-10-04 03:29:29 +03:00
|
|
|
@depends(as_info, target)
|
|
|
|
def as_dash_c_flag(as_info, target):
|
|
|
|
# armasm64 doesn't understand -c.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if as_info.type == "masm" and target.cpu == "aarch64":
|
|
|
|
return ""
|
2018-10-04 03:29:29 +03:00
|
|
|
else:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
return "-c"
|
2018-10-04 03:29:29 +03:00
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("AS_DASH_C_FLAG", as_dash_c_flag)
|
2018-10-04 03:29:29 +03:00
|
|
|
|
2018-10-04 03:29:29 +03:00
|
|
|
|
|
|
|
@depends(as_info, target)
|
|
|
|
def as_outoption(as_info, target):
|
|
|
|
# The uses of ASOUTOPTION depend on the spacing for -o/-Fo.
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if as_info.type == "masm" and target.cpu != "aarch64":
|
|
|
|
return "-Fo"
|
2018-10-04 03:29:29 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
return "-o "
|
2018-10-04 03:29:29 +03:00
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("ASOUTOPTION", as_outoption)
|
2018-10-04 03:29:29 +03:00
|
|
|
|
2018-10-04 03:29:29 +03:00
|
|
|
# clang plugin handling
|
|
|
|
# ==============================================================
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option(
|
|
|
|
"--enable-clang-plugin",
|
|
|
|
env="ENABLE_CLANG_PLUGIN",
|
|
|
|
help="Enable building with the Clang plugin (gecko specific static analyzers)",
|
|
|
|
)
|
2017-10-26 01:12:10 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
add_old_configure_assignment(
|
|
|
|
"ENABLE_CLANG_PLUGIN", depends_if("--enable-clang-plugin")(lambda _: True)
|
|
|
|
)
|
2017-10-26 01:12:10 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
|
|
|
|
@depends(host_c_compiler, c_compiler, when="--enable-clang-plugin")
|
2020-10-08 01:36:49 +03:00
|
|
|
def llvm_config(host_c_compiler, c_compiler):
|
|
|
|
clang = None
|
|
|
|
for compiler in (host_c_compiler, c_compiler):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if compiler and compiler.type == "clang":
|
2020-10-08 01:36:49 +03:00
|
|
|
clang = compiler.compiler
|
|
|
|
break
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
elif compiler and compiler.type == "clang-cl":
|
|
|
|
clang = os.path.join(os.path.dirname(compiler.compiler), "clang")
|
2020-10-08 01:36:49 +03:00
|
|
|
break
|
|
|
|
|
|
|
|
if not clang:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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)
|
2020-10-08 01:36:49 +03:00
|
|
|
if out:
|
|
|
|
llvm_config = out.rstrip()
|
|
|
|
return (llvm_config,)
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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)
|
2020-10-08 01:36:49 +03:00
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option(
|
|
|
|
"--enable-clang-plugin-alpha",
|
|
|
|
env="ENABLE_CLANG_PLUGIN_ALPHA",
|
|
|
|
help="Enable static analysis with clang-plugin alpha checks.",
|
|
|
|
)
|
2020-10-08 01:36:49 +03:00
|
|
|
|
2020-03-17 10:01:09 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends("--enable-clang-plugin", "--enable-clang-plugin-alpha")
|
2020-03-17 10:01:09 +03:00
|
|
|
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.")
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
add_old_configure_assignment("ENABLE_CLANG_PLUGIN_ALPHA", check_clang_plugin_alpha)
|
|
|
|
set_define("MOZ_CLANG_PLUGIN_ALPHA", check_clang_plugin_alpha)
|
2017-11-10 02:04:33 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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)
|
|
|
|
)
|
2017-11-10 02:04:33 +03:00
|
|
|
|
2018-06-12 08:28:40 +03:00
|
|
|
# Libstdc++ compatibility hacks
|
|
|
|
# ==============================================================
|
|
|
|
#
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option(
|
|
|
|
"--enable-stdcxx-compat",
|
|
|
|
env="MOZ_STDCXX_COMPAT",
|
|
|
|
help="Enable compatibility with older libstdc++",
|
|
|
|
)
|
2018-06-12 08:28:40 +03:00
|
|
|
|
|
|
|
|
|
|
|
@template
|
2019-03-14 01:24:20 +03:00
|
|
|
def libstdcxx_version(var, compiler):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends(compiler, when="--enable-stdcxx-compat")
|
2019-03-10 03:11:09 +03:00
|
|
|
@checking(var, lambda v: v and "GLIBCXX_%s" % v.dotted)
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@imports(_from="mozbuild.configure.libstdcxx", _import="find_version")
|
|
|
|
@imports(_from="__builtin__", _import="Exception")
|
2019-03-14 01:24:20 +03:00
|
|
|
def version(compiler):
|
2019-03-10 03:11:09 +03:00
|
|
|
try:
|
|
|
|
result = find_version(
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
compiler.wrapper + [compiler.compiler] + compiler.flags
|
|
|
|
)
|
2019-03-10 03:11:09 +03:00
|
|
|
except Exception:
|
|
|
|
die("Couldn't determine libstdc++ version")
|
2018-06-12 08:28:40 +03:00
|
|
|
if result:
|
2019-03-10 03:11:09 +03:00
|
|
|
return namespace(
|
|
|
|
dotted=result[0],
|
|
|
|
encoded=str(result[1]),
|
|
|
|
)
|
2018-06-12 08:28:40 +03:00
|
|
|
|
2019-03-10 03:11:09 +03:00
|
|
|
set_config(var, version.encoded)
|
2018-06-12 08:28:40 +03:00
|
|
|
return version
|
|
|
|
|
|
|
|
|
|
|
|
add_gcc_flag(
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"-D_GLIBCXX_USE_CXX11_ABI=0",
|
|
|
|
cxx_compiler,
|
|
|
|
when=libstdcxx_version("MOZ_LIBSTDCXX_TARGET_VERSION", cxx_compiler),
|
|
|
|
)
|
2018-06-12 08:28:40 +03:00
|
|
|
add_gcc_flag(
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"-D_GLIBCXX_USE_CXX11_ABI=0",
|
|
|
|
host_cxx_compiler,
|
|
|
|
when=libstdcxx_version("MOZ_LIBSTDCXX_HOST_VERSION", host_cxx_compiler),
|
|
|
|
)
|
2018-06-12 08:28:40 +03:00
|
|
|
|
|
|
|
|
2019-04-23 22:15:17 +03:00
|
|
|
# Support various fuzzing options
|
|
|
|
# ==============================================================
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option("--enable-fuzzing", help="Enable fuzzing support")
|
|
|
|
|
2019-04-23 22:15:17 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@depends("--enable-fuzzing")
|
2019-04-23 22:15:17 +03:00
|
|
|
def enable_fuzzing(value):
|
|
|
|
if value:
|
|
|
|
return True
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
|
|
|
|
@depends(
|
|
|
|
try_compile(
|
|
|
|
body="__AFL_COMPILER;", check_msg="for AFL compiler", when="--enable-fuzzing"
|
|
|
|
)
|
|
|
|
)
|
2019-04-23 22:15:17 +03:00
|
|
|
def enable_aflfuzzer(afl):
|
|
|
|
if afl:
|
|
|
|
return True
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
|
|
|
|
@depends(enable_fuzzing, enable_aflfuzzer, c_compiler, target)
|
2019-04-23 22:15:17 +03:00
|
|
|
def enable_libfuzzer(fuzzing, afl, c_compiler, target):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if fuzzing and not afl and c_compiler.type == "clang" and target.os != "Android":
|
2019-04-23 22:15:17 +03:00
|
|
|
return True
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
|
|
|
|
@depends(enable_fuzzing, enable_aflfuzzer, enable_libfuzzer)
|
2019-04-23 22:15:17 +03:00
|
|
|
def enable_fuzzing_interfaces(fuzzing, afl, libfuzzer):
|
|
|
|
if fuzzing and (afl or libfuzzer):
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
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)
|
2019-04-23 22:15:17 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("FUZZING_INTERFACES", enable_fuzzing_interfaces)
|
|
|
|
set_define("FUZZING_INTERFACES", enable_fuzzing_interfaces)
|
|
|
|
add_old_configure_assignment("FUZZING_INTERFACES", enable_fuzzing_interfaces)
|
2019-04-23 22:15:17 +03:00
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
@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,
|
|
|
|
)
|
2019-10-29 17:03:40 +03:00
|
|
|
def libfuzzer_flags(value, tsan):
|
|
|
|
if tsan:
|
|
|
|
# With ThreadSanitizer, we should not use any libFuzzer instrumentation because
|
|
|
|
# it is incompatible (e.g. there are races on global sanitizer coverage counters).
|
|
|
|
# Instead we use an empty set of flags here but still build the fuzzing targets.
|
|
|
|
# With this setup, we can still run files through these targets in TSan builds,
|
|
|
|
# e.g. those obtained from regular fuzzing.
|
|
|
|
# This code can be removed once libFuzzer has been made compatible with TSan.
|
|
|
|
return namespace(no_link_flag_supported=False, use_flags=[])
|
|
|
|
|
2018-05-24 22:11:46 +03:00
|
|
|
if value:
|
2018-09-21 00:21:38 +03:00
|
|
|
no_link_flag_supported = True
|
|
|
|
# recommended for (and only supported by) clang >= 6
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
use_flags = ["-fsanitize=fuzzer-no-link"]
|
2018-09-21 00:21:38 +03:00
|
|
|
else:
|
|
|
|
no_link_flag_supported = False
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
use_flags = ["-fsanitize-coverage=trace-pc-guard,trace-cmp"]
|
2018-05-24 22:11:46 +03:00
|
|
|
|
2018-09-21 00:21:38 +03:00
|
|
|
return namespace(
|
|
|
|
no_link_flag_supported=no_link_flag_supported,
|
|
|
|
use_flags=use_flags,
|
|
|
|
)
|
2018-05-24 22:11:46 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
|
|
|
|
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)
|
2018-09-19 17:03:42 +03:00
|
|
|
|
|
|
|
# Shared library building
|
|
|
|
# ==============================================================
|
|
|
|
|
|
|
|
# XXX: The use of makefile constructs in these variables is awful.
|
|
|
|
@depends(target, c_compiler)
|
|
|
|
def make_shared_library(target, compiler):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if target.os == "WINNT":
|
|
|
|
if compiler.type == "gcc":
|
2018-09-19 17:03:42 +03:00
|
|
|
return namespace(
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
mkshlib=["$(CXX)", "$(DSO_LDOPTS)", "-o", "$@"],
|
|
|
|
mkcshlib=["$(CC)", "$(DSO_LDOPTS)", "-o", "$@"],
|
2018-09-19 17:03:42 +03:00
|
|
|
)
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
elif compiler.type == "clang":
|
2018-10-17 17:38:52 +03:00
|
|
|
return namespace(
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
mkshlib=[
|
|
|
|
"$(CXX)",
|
|
|
|
"$(DSO_LDOPTS)",
|
|
|
|
"-Wl,-pdb,$(LINK_PDBFILE)",
|
|
|
|
"-o",
|
|
|
|
"$@",
|
|
|
|
],
|
|
|
|
mkcshlib=[
|
|
|
|
"$(CC)",
|
|
|
|
"$(DSO_LDOPTS)",
|
|
|
|
"-Wl,-pdb,$(LINK_PDBFILE)",
|
|
|
|
"-o",
|
|
|
|
"$@",
|
|
|
|
],
|
2018-10-17 17:38:52 +03:00
|
|
|
)
|
2018-09-19 17:03:42 +03:00
|
|
|
else:
|
|
|
|
linker = [
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
"$(LINKER)",
|
|
|
|
"-NOLOGO",
|
|
|
|
"-DLL",
|
|
|
|
"-OUT:$@",
|
|
|
|
"-PDB:$(LINK_PDBFILE)",
|
|
|
|
"$(DSO_LDOPTS)",
|
2018-09-19 17:03:42 +03:00
|
|
|
]
|
|
|
|
return namespace(
|
|
|
|
mkshlib=linker,
|
|
|
|
mkcshlib=linker,
|
|
|
|
)
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
cc = ["$(CC)", "$(COMPUTED_C_LDFLAGS)"]
|
|
|
|
cxx = ["$(CXX)", "$(COMPUTED_CXX_LDFLAGS)"]
|
|
|
|
flags = ["$(PGO_CFLAGS)", "$(DSO_PIC_CFLAGS)", "$(DSO_LDOPTS)"]
|
|
|
|
output = ["-o", "$@"]
|
2018-09-19 17:03:42 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if target.kernel == "Darwin":
|
2018-09-19 17:03:42 +03:00
|
|
|
soname = []
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
elif target.os == "NetBSD":
|
|
|
|
soname = ["-Wl,-soname,$(DSO_SONAME)"]
|
2018-09-19 17:03:42 +03:00
|
|
|
else:
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
assert compiler.type in ("gcc", "clang")
|
2018-09-19 17:03:42 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
soname = ["-Wl,-h,$(DSO_SONAME)"]
|
2018-09-19 17:03:42 +03:00
|
|
|
|
|
|
|
return namespace(
|
|
|
|
mkshlib=cxx + flags + soname + output,
|
|
|
|
mkcshlib=cc + flags + soname + output,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("MKSHLIB", make_shared_library.mkshlib)
|
|
|
|
set_config("MKCSHLIB", make_shared_library.mkcshlib)
|
2018-12-21 01:25:24 +03:00
|
|
|
|
|
|
|
|
|
|
|
@depends(c_compiler, toolchain_prefix, when=target_is_windows)
|
|
|
|
def rc_names(c_compiler, toolchain_prefix):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if c_compiler.type in ("gcc", "clang"):
|
|
|
|
return tuple("%s%s" % (p, "windres") for p in ("",) + (toolchain_prefix or ()))
|
|
|
|
return ("llvm-rc",)
|
2018-12-21 01:25:24 +03:00
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
check_prog("RC", rc_names, paths=toolchain_search_path, when=target_is_windows)
|
2018-12-22 01:53:53 +03:00
|
|
|
|
|
|
|
|
2019-11-13 14:48:25 +03:00
|
|
|
@depends(link, toolchain_prefix, c_compiler)
|
|
|
|
def ar_config(link, toolchain_prefix, c_compiler):
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if c_compiler.type == "clang-cl" and link:
|
2019-11-13 14:48:25 +03:00
|
|
|
# if LINKER is set, it's either for lld-link or link
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
if "lld-link" in link:
|
2018-12-22 01:53:53 +03:00
|
|
|
return namespace(
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
names=("llvm-lib",),
|
|
|
|
flags=("-llvmlibthin", "-out:$@"),
|
2018-12-22 01:53:53 +03:00
|
|
|
)
|
|
|
|
else:
|
|
|
|
return namespace(
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
names=("lib",),
|
|
|
|
flags=("-NOLOGO", "-OUT:$@"),
|
2018-12-22 01:53:53 +03:00
|
|
|
)
|
|
|
|
return namespace(
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
names=tuple("%s%s" % (p, "ar") for p in (toolchain_prefix or ()) + ("",)),
|
|
|
|
flags=("crs", "$@"),
|
2018-12-22 01:53:53 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
ar = check_prog("AR", ar_config.names, paths=toolchain_search_path)
|
2018-12-22 01:53:53 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
add_old_configure_assignment("AR", ar)
|
2018-12-22 01:53:53 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
set_config("AR_FLAGS", ar_config.flags)
|
2020-05-22 01:38:46 +03:00
|
|
|
|
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
option("--enable-cpp-rtti", help="Enable C++ RTTI")
|
2020-05-22 01:38:46 +03:00
|
|
|
|
Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.
To produce this patch I did all of the following:
1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.
2. Run ./mach lint --linter black --fix
3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.
4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).
# ignore-this-changeset
Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-22 00:27:27 +03:00
|
|
|
add_old_configure_assignment("_MOZ_USE_RTTI", "1", when="--enable-cpp-rtti")
|