summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool/utilcmds.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-02-19 22:38:50 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-21 09:32:42 +0000
commite54f9c159d5d9f9f424e1878ad7fedda13201f59 (patch)
tree078b647539598880a5fb67aa6575744b30ba7a60 /scripts/lib/devtool/utilcmds.py
parentdd35f69340c399f54759482fc2865874e2f8ab09 (diff)
downloadpoky-e54f9c159d5d9f9f424e1878ad7fedda13201f59.tar.gz
devtool / recipetool: use common code for launching editor
Looking at Chris Larson's code for starting the user's editor for "recipetool newappend" it was slightly better than what I wrote for "devtool edit-recipe" in that it checks VISUAL as well as EDITOR and defaults to vi if neither are set, so break this out to its own function and call it from both places. The broken out version passes shell=True however in case it's a more complicated command rather than just a name of an executable. (From OE-Core rev: 184a256931e8cdc7bea97a905c4e67a435964de0) 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/utilcmds.py')
-rw-r--r--scripts/lib/devtool/utilcmds.py13
1 files changed, 2 insertions, 11 deletions
diff --git a/scripts/lib/devtool/utilcmds.py b/scripts/lib/devtool/utilcmds.py
index a8f5e97833..18eddb78b0 100644
--- a/scripts/lib/devtool/utilcmds.py
+++ b/scripts/lib/devtool/utilcmds.py
@@ -24,6 +24,7 @@ import tempfile
24import logging 24import logging
25import argparse 25import argparse
26import subprocess 26import subprocess
27import scriptutils
27from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, DevtoolError 28from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, DevtoolError
28from devtool import parse_recipe 29from devtool import parse_recipe
29 30
@@ -48,17 +49,7 @@ def edit_recipe(args, config, basepath, workspace):
48 raise DevtoolError("Recipe file for %s is not under the workspace" % 49 raise DevtoolError("Recipe file for %s is not under the workspace" %
49 args.recipename) 50 args.recipename)
50 51
51 editor = os.environ.get('EDITOR', None) 52 return scriptutils.run_editor(recipefile)
52 if not editor:
53 raise DevtoolError("EDITOR environment variable not set")
54
55 import subprocess
56 try:
57 subprocess.check_call('%s "%s"' % (editor, recipefile), shell=True)
58 except subprocess.CalledProcessError as e:
59 return e.returncode
60
61 return 0
62 53
63 54
64def configure_help(args, config, basepath, workspace): 55def configure_help(args, config, basepath, workspace):