summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/recipetool/edit.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/scripts/lib/recipetool/edit.py b/scripts/lib/recipetool/edit.py
new file mode 100644
index 0000000000..c4789a9994
--- /dev/null
+++ b/scripts/lib/recipetool/edit.py
@@ -0,0 +1,54 @@
1# Recipe creation tool - edit plugin
2#
3# This sub-command edits the recipe and appends for the specified target
4#
5# Example: recipetool edit busybox
6#
7# Copyright (C) 2018 Mentor Graphics Corporation
8#
9# This program is free software; you can redistribute it and/or modify
10# it under the terms of the GNU General Public License version 2 as
11# published by the Free Software Foundation.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License along
19# with this program; if not, write to the Free Software Foundation, Inc.,
20# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
22import argparse
23import errno
24import logging
25import os
26import re
27import subprocess
28import sys
29import scriptutils
30
31
32logger = logging.getLogger('recipetool')
33tinfoil = None
34
35
36def tinfoil_init(instance):
37 global tinfoil
38 tinfoil = instance
39
40
41def edit(args):
42 import oe.recipeutils
43
44 recipe_path = tinfoil.get_recipe_file(args.target)
45 appends = tinfoil.get_file_appends(recipe_path)
46
47 return scriptutils.run_editor([recipe_path] + appends, logger)
48
49
50def register_commands(subparsers):
51 parser = subparsers.add_parser('edit',
52 help='Edit the recipe and appends for the specified target. This obeys $VISUAL if set, otherwise $EDITOR, otherwise vi.')
53 parser.add_argument('target', help='Target recipe/provide to edit')
54 parser.set_defaults(func=edit, parserecipes=True)