зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1415618: Allow specifying extra paths to search for config files mozharness. r=jlund
MozReview-Commit-ID: 3xkUaDwYB6v --HG-- extra : rebase_source : e80f0f20213e76ee68e62757eab8c788b7d398c6 extra : source : 780f67a36d6d91d4ee35070dc7f8d8c598106929
This commit is contained in:
Родитель
f7c1abbee7
Коммит
af723fa237
|
@ -280,6 +280,10 @@ class BaseConfig(object):
|
|||
type="string", default=os.getcwd(),
|
||||
help="Specify the absolute path of the parent of the working directory"
|
||||
)
|
||||
self.config_parser.add_option(
|
||||
"--extra-config-path", action='extend', dest="config_paths",
|
||||
type="string", help="Specify additional paths to search for config files.",
|
||||
)
|
||||
self.config_parser.add_option(
|
||||
"-c", "--config-file", "--cfg", action="extend", dest="config_files",
|
||||
type="string", help="Specify a config file; can be repeated"
|
||||
|
@ -433,6 +437,7 @@ class BaseConfig(object):
|
|||
way that self.config is made up. See
|
||||
`mozharness.mozilla.building.buildbase.BuildingConfig` for an example.
|
||||
"""
|
||||
config_paths = options.config_paths or ['.']
|
||||
all_cfg_files_and_dicts = []
|
||||
for cf in all_config_files:
|
||||
try:
|
||||
|
@ -444,7 +449,9 @@ class BaseConfig(object):
|
|||
(file_path, parse_config_file(file_path, search_path=["."]))
|
||||
)
|
||||
else:
|
||||
all_cfg_files_and_dicts.append((cf, parse_config_file(cf)))
|
||||
all_cfg_files_and_dicts.append(
|
||||
(cf, parse_config_file(cf, search_path=config_paths + [DEFAULT_CONFIG_PATH]))
|
||||
)
|
||||
except Exception:
|
||||
if cf in options.opt_config_files:
|
||||
print(
|
||||
|
|
|
@ -399,9 +399,6 @@ class BuildOptionParser(object):
|
|||
# TODO add nosetests for this class
|
||||
platform = None
|
||||
bits = None
|
||||
config_file_search_path = [
|
||||
DEFAULT_CONFIG_PATH,
|
||||
]
|
||||
|
||||
# add to this list and you can automagically do things like
|
||||
# --custom-build-variant-cfg asan
|
||||
|
@ -521,9 +518,15 @@ class BuildOptionParser(object):
|
|||
# now let's see if we were given a valid pathname
|
||||
valid_variant_cfg_path = value
|
||||
else:
|
||||
# FIXME: We should actually wait until we have parsed all arguments
|
||||
# before looking at this, otherwise the behavior will depend on the
|
||||
# order of arguments. But that isn't a problem as long as --extra-config-path
|
||||
# is always passed first.
|
||||
extra_config_paths = parser.values.config_paths or []
|
||||
config_paths = extra_config_paths + [DEFAULT_CONFIG_PATH]
|
||||
# let's take our prospective_cfg_path and see if we can
|
||||
# determine an existing file
|
||||
for path in cls.config_file_search_path:
|
||||
for path in config_paths:
|
||||
if os.path.exists(os.path.join(path, prospective_cfg_path)):
|
||||
# success! we found a config file
|
||||
valid_variant_cfg_path = os.path.join(path,
|
||||
|
|
Загрузка…
Ссылка в новой задаче