diff options
author | Christopher Larson <chris_larson@mentor.com> | 2018-06-22 02:09:34 +0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-07-04 00:02:16 +0100 |
commit | c9812c91febbedb6157e98a8276964616d31e60c (patch) | |
tree | 6bf160fe5441061dd677a5b7d110e76dd8496a93 /scripts/lib/recipetool/edit.py | |
parent | bba7c19eeb22cbbadc5219edf938bec55bbc117a (diff) | |
download | poky-c9812c91febbedb6157e98a8276964616d31e60c.tar.gz |
recipetool: add 'edit' subcommand
This edits the recipe and any bbappends for the specified target.
(From OE-Core rev: 7aece42c6b4744c54a8eb05ff90bd3bf4fbb14a3)
Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/recipetool/edit.py')
-rw-r--r-- | scripts/lib/recipetool/edit.py | 54 |
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 | |||
22 | import argparse | ||
23 | import errno | ||
24 | import logging | ||
25 | import os | ||
26 | import re | ||
27 | import subprocess | ||
28 | import sys | ||
29 | import scriptutils | ||
30 | |||
31 | |||
32 | logger = logging.getLogger('recipetool') | ||
33 | tinfoil = None | ||
34 | |||
35 | |||
36 | def tinfoil_init(instance): | ||
37 | global tinfoil | ||
38 | tinfoil = instance | ||
39 | |||
40 | |||
41 | def 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 | |||
50 | def 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) | ||