summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool/standard.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-01-26 15:53:53 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-01-26 18:05:13 +0000
commite00eac862eb429f171b3263a624721bdf3a6171b (patch)
treeb4fa69e78c782137a3ec6ac0d62942d9613308d9 /scripts/lib/devtool/standard.py
parent6720bdac233099e9afe2f9510b1d401cd5b6f903 (diff)
downloadpoky-e00eac862eb429f171b3263a624721bdf3a6171b.tar.gz
devtool: move edit-recipe to a separate module
standard.py is getting a bit large; move the "utility" commands to another module. (From OE-Core rev: 5089b93f5b341dc28c343f7afe15efda2081ed36) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/devtool/standard.py')
-rw-r--r--scripts/lib/devtool/standard.py36
1 files changed, 0 insertions, 36 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index f19de27a86..83ec7d8efa 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -1258,36 +1258,6 @@ def reset(args, config, basepath, workspace):
1258 return 0 1258 return 0
1259 1259
1260 1260
1261def edit_recipe(args, config, basepath, workspace):
1262 """Entry point for the devtool 'edit-recipe' subcommand"""
1263 if args.any_recipe:
1264 tinfoil = setup_tinfoil(config_only=False, basepath=basepath)
1265 try:
1266 rd = parse_recipe(config, tinfoil, args.recipename, True)
1267 if not rd:
1268 return 1
1269 recipefile = rd.getVar('FILE', True)
1270 finally:
1271 tinfoil.shutdown()
1272 else:
1273 check_workspace_recipe(workspace, args.recipename)
1274 recipefile = workspace[args.recipename]['recipefile']
1275 if not recipefile:
1276 raise DevtoolError("Recipe file for %s is not under the workspace" %
1277 args.recipename)
1278
1279 editor = os.environ.get('EDITOR', None)
1280 if not editor:
1281 raise DevtoolError("EDITOR environment variable not set")
1282
1283 import subprocess
1284 try:
1285 subprocess.check_call('%s "%s"' % (editor, recipefile), shell=True)
1286 except subprocess.CalledProcessError as e:
1287 return e.returncode
1288
1289 return 0
1290
1291def get_default_srctree(config, recipename=''): 1261def get_default_srctree(config, recipename=''):
1292 """Get the default srctree path""" 1262 """Get the default srctree path"""
1293 srctreeparent = config.get('General', 'default_source_parent_dir', config.workspace_path) 1263 srctreeparent = config.get('General', 'default_source_parent_dir', config.workspace_path)
@@ -1365,9 +1335,3 @@ def register_commands(subparsers, context):
1365 parser_reset.add_argument('--all', '-a', action="store_true", help='Reset all recipes (clear workspace)') 1335 parser_reset.add_argument('--all', '-a', action="store_true", help='Reset all recipes (clear workspace)')
1366 parser_reset.add_argument('--no-clean', '-n', action="store_true", help='Don\'t clean the sysroot to remove recipe output') 1336 parser_reset.add_argument('--no-clean', '-n', action="store_true", help='Don\'t clean the sysroot to remove recipe output')
1367 parser_reset.set_defaults(func=reset) 1337 parser_reset.set_defaults(func=reset)
1368
1369 parser_edit_recipe = subparsers.add_parser('edit-recipe', help='Edit a recipe file in your workspace',
1370 description='Runs the default editor (as specified by the EDITOR variable) on the specified recipe. Note that the recipe file itself must be in the workspace (i.e. as a result of "devtool add" or "devtool upgrade"); you can override this with the -a/--any-recipe option.')
1371 parser_edit_recipe.add_argument('recipename', help='Recipe to edit')
1372 parser_edit_recipe.add_argument('--any-recipe', '-a', action="store_true", help='Edit any recipe, not just where the recipe file itself is in the workspace')
1373 parser_edit_recipe.set_defaults(func=edit_recipe)