diff --git a/fetch.py b/fetch.py index ea745d178..cf34404e4 100755 --- a/fetch.py +++ b/fetch.py @@ -7,15 +7,15 @@ Tool to perform checkouts in one easy command line! Usage: - fetch [--property=value [--property2=value2 ...]] + fetch [--property=value [--property2=value2 ...]] This script is a wrapper around various version control and repository -checkout commands. It requires a |recipe| name, fetches data from that -recipe in depot_tools/recipes, and then performs all necessary inits, +checkout commands. It requires a |config| name, fetches data from that +config in depot_tools/fetch_configs, and then performs all necessary inits, checkouts, pulls, fetches, etc. Optional arguments may be passed on the command line in key-value pairs. -These parameters will be passed through to the recipe's main method. +These parameters will be passed through to the config's main method. """ import json @@ -39,10 +39,10 @@ class Checkout(object): Attributes: |base|: the absolute path of the directory in which this script is run. - |spec|: the spec for this checkout as returned by the recipe. Different + |spec|: the spec for this checkout as returned by the config. Different subclasses will expect different keys in this dictionary. |root|: the directory into which the checkout will be performed, as returned - by the recipe. This is a relative path from |base|. + by the config. This is a relative path from |base|. """ def __init__(self, options, spec, root): self.base = os.getcwd() @@ -222,7 +222,7 @@ def usage(msg=None): print 'Error:', msg print textwrap.dedent("""\ - usage: %s [options] [--property=value [--property2=value2 ...]] + usage: %s [options] [--property=value [--property2=value2 ...]] This script can be used to download the Chromium sources. See http://www.chromium.org/developers/how-tos/get-the-code @@ -234,21 +234,21 @@ def usage(msg=None): -n, --dry-run Don't run commands, only print them. --no-history Perform shallow clones, don't fetch the full git history. - Valid fetch recipes:""") % os.path.basename(sys.argv[0]) + Valid fetch configs:""") % os.path.basename(sys.argv[0]) - recipes_dir = os.path.join(SCRIPT_PATH, 'recipes') - recipes = [f[:-3] for f in os.listdir(recipes_dir) if f.endswith('.py')] - recipes.sort() - for fname in recipes: + configs_dir = os.path.join(SCRIPT_PATH, 'fetch_configs') + configs = [f[:-3] for f in os.listdir(configs_dir) if f.endswith('.py')] + configs.sort() + for fname in configs: print ' ' + fname sys.exit(bool(msg)) def handle_args(argv): - """Gets the recipe name from the command line arguments.""" + """Gets the config name from the command line arguments.""" if len(argv) <= 1: - usage('Must specify a recipe.') + usage('Must specify a config.') if argv[1] in ('-h', '--help', 'help'): usage() @@ -276,32 +276,33 @@ def handle_args(argv): if bad_parms: usage('Got bad arguments %s' % bad_parms) - recipe = argv[1] + config = argv[1] props = argv[2:] return ( optparse.Values( {'dry_run':dry_run, 'nohooks':nohooks, 'no_history': no_history }), - recipe, + config, props) -def run_recipe_fetch(recipe, props, aliased=False): - """Invoke a recipe's fetch method with the passed-through args +def run_config_fetch(config, props, aliased=False): + """Invoke a config's fetch method with the passed-through args and return its json output as a python object.""" - recipe_path = os.path.abspath(os.path.join(SCRIPT_PATH, 'recipes', recipe)) - if not os.path.exists(recipe_path + '.py'): - print "Could not find a recipe for %s" % recipe + config_path = os.path.abspath( + os.path.join(SCRIPT_PATH, 'fetch_configs', config)) + if not os.path.exists(config_path + '.py'): + print "Could not find a config for %s" % config sys.exit(1) - cmd = [sys.executable, recipe_path + '.py', 'fetch'] + props + cmd = [sys.executable, config_path + '.py', 'fetch'] + props result = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] spec = json.loads(result) if 'alias' in spec: assert not aliased - return run_recipe_fetch( - spec['alias']['recipe'], spec['alias']['props'] + props, aliased=True) - cmd = [sys.executable, recipe_path + '.py', 'root'] + return run_config_fetch( + spec['alias']['config'], spec['alias']['props'] + props, aliased=True) + cmd = [sys.executable, config_path + '.py', 'root'] result = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] root = json.loads(result) return spec, root @@ -312,7 +313,7 @@ def run(options, spec, root): Args: options: Options instance. - spec: Checkout configuration returned by the the recipe's fetch_spec + spec: Checkout configuration returned by the the config's fetch_spec method (checkout type, repository url, etc.). root: The directory into which the repo expects to be checkout out. """ @@ -335,8 +336,8 @@ def run(options, spec, root): def main(): - options, recipe, props = handle_args(sys.argv) - spec, root = run_recipe_fetch(recipe, props) + options, config, props = handle_args(sys.argv) + spec, root = run_config_fetch(config, props) return run(options, spec, root) diff --git a/recipes/android.py b/fetch_configs/android.py similarity index 78% rename from recipes/android.py rename to fetch_configs/android.py index 24739a2c7..226347090 100644 --- a/recipes/android.py +++ b/fetch_configs/android.py @@ -4,19 +4,19 @@ import sys -import recipe_util # pylint: disable=F0401 +import config_util # pylint: disable=F0401 # This class doesn't need an __init__ method, so we disable the warning # pylint: disable=W0232 -class Android(recipe_util.Recipe): - """Basic Recipe alias for Android -> Chromium.""" +class Android(config_util.Config): + """Basic Config alias for Android -> Chromium.""" @staticmethod def fetch_spec(props): return { 'alias': { - 'recipe': 'chromium', + 'config': 'chromium', 'props': ['--target_os=android'], }, } diff --git a/recipes/breakpad.py b/fetch_configs/breakpad.py similarity index 92% rename from recipes/breakpad.py rename to fetch_configs/breakpad.py index de4316bdc..7b47b4f35 100644 --- a/recipes/breakpad.py +++ b/fetch_configs/breakpad.py @@ -4,12 +4,12 @@ import sys -import recipe_util # pylint: disable=F0401 +import config_util # pylint: disable=F0401 # This class doesn't need an __init__ method, so we disable the warning # pylint: disable=W0232 -class Breakpad(recipe_util.Recipe): +class Breakpad(config_util.Config): @staticmethod def fetch_spec(props): url = 'https://chromium.googlesource.com/breakpad/breakpad.git' diff --git a/recipes/chromium.py b/fetch_configs/chromium.py similarity index 90% rename from recipes/chromium.py rename to fetch_configs/chromium.py index 6416ee0bb..d461aa0fc 100644 --- a/recipes/chromium.py +++ b/fetch_configs/chromium.py @@ -4,13 +4,13 @@ import sys -import recipe_util # pylint: disable=F0401 +import config_util # pylint: disable=F0401 # This class doesn't need an __init__ method, so we disable the warning # pylint: disable=W0232 -class Chromium(recipe_util.Recipe): - """Basic Recipe class for Chromium.""" +class Chromium(config_util.Config): + """Basic Config class for Chromium.""" @staticmethod def fetch_spec(props): diff --git a/recipes/recipe_util.py b/fetch_configs/config_util.py similarity index 92% rename from recipes/recipe_util.py rename to fetch_configs/config_util.py index 50429ae24..9207d39a2 100644 --- a/recipes/recipe_util.py +++ b/fetch_configs/config_util.py @@ -2,13 +2,13 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -"""This module holds utilities which make writing recipes easier.""" +"""This module holds utilities which make writing configs easier.""" import json -class Recipe(object): - """Base class for all recipes. +class Config(object): + """Base class for all configs. Provides methods that are expected to be overridden by child classes. Also provides an command-line parsing method that converts the unified command-line diff --git a/recipes/crashpad.py b/fetch_configs/crashpad.py similarity index 81% rename from recipes/crashpad.py rename to fetch_configs/crashpad.py index 7342300be..d50992b3d 100644 --- a/recipes/crashpad.py +++ b/fetch_configs/crashpad.py @@ -4,13 +4,13 @@ import sys -import recipe_util # pylint: disable=F0401 +import config_util # pylint: disable=F0401 # This class doesn't need an __init__ method, so we disable the warning # pylint: disable=W0232 -class CrashpadRecipe(recipe_util.Recipe): - """Basic Recipe class for Crashpad.""" +class CrashpadConfig(config_util.Config): + """Basic Config class for Crashpad.""" @staticmethod def fetch_spec(props): @@ -34,7 +34,7 @@ class CrashpadRecipe(recipe_util.Recipe): def main(argv=None): - return CrashpadRecipe().handle_args(argv) + return CrashpadConfig().handle_args(argv) if __name__ == '__main__': diff --git a/recipes/dart.py b/fetch_configs/dart.py similarity index 89% rename from recipes/dart.py rename to fetch_configs/dart.py index 2b4d78c0f..2500324d9 100644 --- a/recipes/dart.py +++ b/fetch_configs/dart.py @@ -4,13 +4,13 @@ import sys -import recipe_util # pylint: disable=F0401 +import config_util # pylint: disable=F0401 # This class doesn't need an __init__ method, so we disable the warning # pylint: disable=W0232 -class Dart(recipe_util.Recipe): - """Basic Recipe class for Dart.""" +class Dart(config_util.Config): + """Basic Config class for Dart.""" @staticmethod def fetch_spec(props): diff --git a/recipes/dartium.py b/fetch_configs/dartium.py similarity index 89% rename from recipes/dartium.py rename to fetch_configs/dartium.py index d026533e8..230b8a5c7 100644 --- a/recipes/dartium.py +++ b/fetch_configs/dartium.py @@ -4,13 +4,13 @@ import sys -import recipe_util # pylint: disable=F0401 +import config_util # pylint: disable=F0401 # This class doesn't need an __init__ method, so we disable the warning # pylint: disable=W0232 -class Dart(recipe_util.Recipe): - """Basic Recipe class for Dart.""" +class Dart(config_util.Config): + """Basic Config class for Dart.""" @staticmethod def fetch_spec(props): diff --git a/recipes/depot_tools.py b/fetch_configs/depot_tools.py similarity index 89% rename from recipes/depot_tools.py rename to fetch_configs/depot_tools.py index 7c3b91cec..f94864974 100644 --- a/recipes/depot_tools.py +++ b/fetch_configs/depot_tools.py @@ -4,13 +4,13 @@ import sys -import recipe_util # pylint: disable=F0401 +import config_util # pylint: disable=F0401 # This class doesn't need an __init__ method, so we disable the warning # pylint: disable=W0232 -class DepotTools(recipe_util.Recipe): - """Basic Recipe class for DepotTools.""" +class DepotTools(config_util.Config): + """Basic Config class for DepotTools.""" @staticmethod def fetch_spec(props): diff --git a/recipes/fletch.py b/fetch_configs/fletch.py similarity index 88% rename from recipes/fletch.py rename to fetch_configs/fletch.py index 1938ea7e4..071d59231 100644 --- a/recipes/fletch.py +++ b/fetch_configs/fletch.py @@ -4,12 +4,12 @@ import sys -import recipe_util # pylint: disable=F0401 +import config_util # pylint: disable=F0401 # This class doesn't need an __init__ method, so we disable the warning # pylint: disable=W0232 -class Fletch(recipe_util.Recipe): - """Basic Recipe class for Fletch.""" +class Fletch(config_util.Config): + """Basic Config class for Fletch.""" @staticmethod def fetch_spec(props): diff --git a/recipes/gyp.py b/fetch_configs/gyp.py similarity index 87% rename from recipes/gyp.py rename to fetch_configs/gyp.py index 3973756d3..f4661c0f4 100644 --- a/recipes/gyp.py +++ b/fetch_configs/gyp.py @@ -4,13 +4,13 @@ import sys -import recipe_util # pylint: disable=F0401 +import config_util # pylint: disable=F0401 # This class doesn't need an __init__ method, so we disable the warning # pylint: disable=W0232 -class Chromium(recipe_util.Recipe): - """Basic Recipe class for Chromium.""" +class Chromium(config_util.Config): + """Basic Config class for Chromium.""" @staticmethod def fetch_spec(props): diff --git a/recipes/infra.py b/fetch_configs/infra.py similarity index 85% rename from recipes/infra.py rename to fetch_configs/infra.py index f9698a6d1..12e5c9646 100644 --- a/recipes/infra.py +++ b/fetch_configs/infra.py @@ -4,13 +4,13 @@ import sys -import recipe_util # pylint: disable=F0401 +import config_util # pylint: disable=F0401 # This class doesn't need an __init__ method, so we disable the warning # pylint: disable=W0232 -class Infra(recipe_util.Recipe): - """Basic Recipe class for the Infrastructure repositories.""" +class Infra(config_util.Config): + """Basic Config class for the Infrastructure repositories.""" @staticmethod def fetch_spec(_props): diff --git a/recipes/infra_internal.py b/fetch_configs/infra_internal.py similarity index 86% rename from recipes/infra_internal.py rename to fetch_configs/infra_internal.py index ad6afb9c3..5643fc111 100644 --- a/recipes/infra_internal.py +++ b/fetch_configs/infra_internal.py @@ -4,13 +4,13 @@ import sys -import recipe_util # pylint: disable=F0401 +import config_util # pylint: disable=F0401 # This class doesn't need an __init__ method, so we disable the warning # pylint: disable=W0232 -class InfraInternal(recipe_util.Recipe): - """Basic Recipe class for the whole set of Infrastructure repositories.""" +class InfraInternal(config_util.Config): + """Basic Config class for the whole set of Infrastructure repositories.""" @staticmethod def fetch_spec(_props): diff --git a/recipes/ios.py b/fetch_configs/ios.py similarity index 79% rename from recipes/ios.py rename to fetch_configs/ios.py index 7c4eee05d..57f5a695f 100644 --- a/recipes/ios.py +++ b/fetch_configs/ios.py @@ -4,19 +4,19 @@ import sys -import recipe_util # pylint: disable=F0401 +import config_util # pylint: disable=F0401 # This class doesn't need an __init__ method, so we disable the warning # pylint: disable=W0232 -class IOS(recipe_util.Recipe): - """Basic Recipe alias for iOS -> Chromium.""" +class IOS(config_util.Config): + """Basic Config alias for iOS -> Chromium.""" @staticmethod def fetch_spec(props): return { 'alias': { - 'recipe': 'chromium', + 'config': 'chromium', 'props': ['--target_os=ios', '--target_os_only=True'], }, } diff --git a/recipes/mojo.py b/fetch_configs/mojo.py similarity index 89% rename from recipes/mojo.py rename to fetch_configs/mojo.py index f7316ace9..e34c8e2fe 100644 --- a/recipes/mojo.py +++ b/fetch_configs/mojo.py @@ -4,13 +4,13 @@ import sys -import recipe_util # pylint: disable=F0401 +import config_util # pylint: disable=F0401 # This class doesn't need an __init__ method, so we disable the warning # pylint: disable=W0232 -class Mojo(recipe_util.Recipe): - """Basic Recipe class for Mojo.""" +class Mojo(config_util.Config): + """Basic Config class for Mojo.""" @staticmethod def fetch_spec(props): diff --git a/recipes/nacl.py b/fetch_configs/nacl.py similarity index 90% rename from recipes/nacl.py rename to fetch_configs/nacl.py index 59c824c24..3c0fff3ea 100644 --- a/recipes/nacl.py +++ b/fetch_configs/nacl.py @@ -4,13 +4,13 @@ import sys -import recipe_util # pylint: disable=F0401 +import config_util # pylint: disable=F0401 # This class doesn't need an __init__ method, so we disable the warning # pylint: disable=W0232 -class NaCl(recipe_util.Recipe): - """Basic Recipe class for NaCl.""" +class NaCl(config_util.Config): + """Basic Config class for NaCl.""" @staticmethod def fetch_spec(props): diff --git a/recipes/naclports.py b/fetch_configs/naclports.py similarity index 89% rename from recipes/naclports.py rename to fetch_configs/naclports.py index 10a0b28fb..e631f2254 100644 --- a/recipes/naclports.py +++ b/fetch_configs/naclports.py @@ -4,13 +4,13 @@ import sys -import recipe_util # pylint: disable=F0401 +import config_util # pylint: disable=F0401 # This class doesn't need an __init__ method, so we disable the warning # pylint: disable=W0232 -class Naclports(recipe_util.Recipe): - """Basic Recipe class for naclports.""" +class Naclports(config_util.Config): + """Basic Config class for naclports.""" @staticmethod def fetch_spec(props): diff --git a/recipes/pdfium.py b/fetch_configs/pdfium.py similarity index 81% rename from recipes/pdfium.py rename to fetch_configs/pdfium.py index b3c237cfd..a8400c182 100644 --- a/recipes/pdfium.py +++ b/fetch_configs/pdfium.py @@ -4,13 +4,13 @@ import sys -import recipe_util # pylint: disable=F0401 +import config_util # pylint: disable=F0401 # This class doesn't need an __init__ method, so we disable the warning # pylint: disable=W0232 -class PdfiumRecipe(recipe_util.Recipe): - """Basic Recipe class for pdfium.""" +class PdfiumConfig(config_util.Config): + """Basic Config class for pdfium.""" @staticmethod def fetch_spec(props): @@ -33,7 +33,7 @@ class PdfiumRecipe(recipe_util.Recipe): def main(argv=None): - return PdfiumRecipe().handle_args(argv) + return PdfiumConfig().handle_args(argv) if __name__ == '__main__': diff --git a/recipes/skia.py b/fetch_configs/skia.py similarity index 86% rename from recipes/skia.py rename to fetch_configs/skia.py index 171157c43..930173a0c 100644 --- a/recipes/skia.py +++ b/fetch_configs/skia.py @@ -4,13 +4,13 @@ import sys -import recipe_util # pylint: disable=F0401 +import config_util # pylint: disable=F0401 # This class doesn't need an __init__ method, so we disable the warning # pylint: disable=W0232 -class Skia(recipe_util.Recipe): - """Basic Recipe class for the Skia repository.""" +class Skia(config_util.Config): + """Basic Config class for the Skia repository.""" @staticmethod def fetch_spec(_props): diff --git a/recipes/skia_buildbot.py b/fetch_configs/skia_buildbot.py similarity index 84% rename from recipes/skia_buildbot.py rename to fetch_configs/skia_buildbot.py index 42b6c8dad..0e7f2d043 100644 --- a/recipes/skia_buildbot.py +++ b/fetch_configs/skia_buildbot.py @@ -4,13 +4,13 @@ import sys -import recipe_util # pylint: disable=F0401 +import config_util # pylint: disable=F0401 # This class doesn't need an __init__ method, so we disable the warning # pylint: disable=W0232 -class SkiaBuildbot(recipe_util.Recipe): - """Basic Recipe class for the Skia Buildbot repository.""" +class SkiaBuildbot(config_util.Config): + """Basic Config class for the Skia Buildbot repository.""" @staticmethod def fetch_spec(_props): diff --git a/recipes/v8.py b/fetch_configs/v8.py similarity index 89% rename from recipes/v8.py rename to fetch_configs/v8.py index b2270d024..b6e6ca099 100644 --- a/recipes/v8.py +++ b/fetch_configs/v8.py @@ -4,13 +4,13 @@ import sys -import recipe_util # pylint: disable=F0401 +import config_util # pylint: disable=F0401 # This class doesn't need an __init__ method, so we disable the warning # pylint: disable=W0232 -class V8(recipe_util.Recipe): - """Basic Recipe class for V8.""" +class V8(config_util.Config): + """Basic Config class for V8.""" @staticmethod def fetch_spec(props): diff --git a/recipes/webrtc.py b/fetch_configs/webrtc.py similarity index 89% rename from recipes/webrtc.py rename to fetch_configs/webrtc.py index e409d2fed..fbced5efd 100644 --- a/recipes/webrtc.py +++ b/fetch_configs/webrtc.py @@ -4,13 +4,13 @@ import sys -import recipe_util # pylint: disable=F0401 +import config_util # pylint: disable=F0401 # This class doesn't need an __init__ method, so we disable the warning # pylint: disable=W0232 -class WebRTC(recipe_util.Recipe): - """Basic Recipe class for WebRTC.""" +class WebRTC(config_util.Config): + """Basic Config class for WebRTC.""" @staticmethod def fetch_spec(props): diff --git a/recipes/webrtc_android.py b/fetch_configs/webrtc_android.py similarity index 78% rename from recipes/webrtc_android.py rename to fetch_configs/webrtc_android.py index 6d6018a86..5b53235d6 100644 --- a/recipes/webrtc_android.py +++ b/fetch_configs/webrtc_android.py @@ -4,19 +4,19 @@ import sys -import recipe_util # pylint: disable=F0401 +import config_util # pylint: disable=F0401 # This class doesn't need an __init__ method, so we disable the warning # pylint: disable=W0232 -class WebRTCAndroid(recipe_util.Recipe): - """Basic Recipe alias for Android -> WebRTC.""" +class WebRTCAndroid(config_util.Config): + """Basic Config alias for Android -> WebRTC.""" @staticmethod def fetch_spec(props): return { 'alias': { - 'recipe': 'webrtc', + 'config': 'webrtc', 'props': ['--target_os=android,unix'], }, } diff --git a/recipes/webrtc_ios.py b/fetch_configs/webrtc_ios.py similarity index 78% rename from recipes/webrtc_ios.py rename to fetch_configs/webrtc_ios.py index 550ad8d3f..f51fe22d0 100644 --- a/recipes/webrtc_ios.py +++ b/fetch_configs/webrtc_ios.py @@ -4,19 +4,19 @@ import sys -import recipe_util # pylint: disable=F0401 +import config_util # pylint: disable=F0401 # This class doesn't need an __init__ method, so we disable the warning # pylint: disable=W0232 -class WebRTCIOS(recipe_util.Recipe): - """Basic Recipe alias for iOS -> WebRTC.""" +class WebRTCIOS(config_util.Config): + """Basic Config alias for iOS -> WebRTC.""" @staticmethod def fetch_spec(props): return { 'alias': { - 'recipe': 'webrtc', + 'config': 'webrtc', 'props': ['--target_os=ios,mac'], }, }