diff options
Diffstat (limited to 'scripts/lib/wic/ksparser.py')
-rw-r--r-- | scripts/lib/wic/ksparser.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py index c73a456766..3722799b51 100644 --- a/scripts/lib/wic/ksparser.py +++ b/scripts/lib/wic/ksparser.py | |||
@@ -25,11 +25,12 @@ | |||
25 | # Ed Bartosh <ed.bartosh> (at] linux.intel.com> | 25 | # Ed Bartosh <ed.bartosh> (at] linux.intel.com> |
26 | 26 | ||
27 | 27 | ||
28 | 28 | import os | |
29 | import shlex | 29 | import shlex |
30 | from argparse import ArgumentParser, ArgumentError, ArgumentTypeError | 30 | from argparse import ArgumentParser, ArgumentError, ArgumentTypeError |
31 | 31 | ||
32 | from wic.partition import Partition | 32 | from wic.partition import Partition |
33 | from wic.utils.misc import find_canned | ||
33 | 34 | ||
34 | class KickStartError(Exception): | 35 | class KickStartError(Exception): |
35 | pass | 36 | pass |
@@ -78,6 +79,17 @@ def overheadtype(arg): | |||
78 | 79 | ||
79 | return result | 80 | return result |
80 | 81 | ||
82 | def cannedpathtype(arg): | ||
83 | """ | ||
84 | Custom type for ArgumentParser | ||
85 | Tries to find file in the list of canned wks paths | ||
86 | """ | ||
87 | scripts_path = os.path.abspath(os.path.dirname(__file__) + '../../..') | ||
88 | result = find_canned(scripts_path, arg) | ||
89 | if not result: | ||
90 | raise ArgumentTypeError("file not found: %s" % arg) | ||
91 | return result | ||
92 | |||
81 | class KickStart(object): | 93 | class KickStart(object): |
82 | def __init__(self, confpath): | 94 | def __init__(self, confpath): |
83 | 95 | ||
@@ -117,7 +129,7 @@ class KickStart(object): | |||
117 | bootloader.add_argument('--source') | 129 | bootloader.add_argument('--source') |
118 | 130 | ||
119 | include = subparsers.add_parser('include') | 131 | include = subparsers.add_parser('include') |
120 | include.add_argument('path') | 132 | include.add_argument('path', type=cannedpathtype) |
121 | 133 | ||
122 | self._parse(parser, confpath) | 134 | self._parse(parser, confpath) |
123 | 135 | ||