1 |
The --context option accepts an optional argument, but only if it is |
2 |
passed via --context=arg. The argparse module does not deal with this |
3 |
properly. |
4 |
|
5 |
To work around this, have argparse ignore this option, and filter out |
6 |
any remaining arguments that start with a hyphen. |
7 |
|
8 |
Bug: https://bugs.gentoo.org/699548 |
9 |
Signed-off-by: Mike Gilbert <floppym@g.o> |
10 |
--- |
11 |
bin/install.py | 8 +------- |
12 |
1 file changed, 1 insertion(+), 7 deletions(-) |
13 |
|
14 |
diff --git a/bin/install.py b/bin/install.py |
15 |
index d3789ed96..e56475ff1 100755 |
16 |
--- a/bin/install.py |
17 |
+++ b/bin/install.py |
18 |
@@ -111,12 +111,6 @@ def parse_args(args): |
19 |
action="store_true", |
20 |
dest="no_target_directory" |
21 |
) |
22 |
- parser.add_argument( |
23 |
- "--context", |
24 |
- "-Z", |
25 |
- action="store", |
26 |
- dest="context" |
27 |
- ) |
28 |
parser.add_argument( |
29 |
"--verbose", |
30 |
"-v", |
31 |
@@ -147,7 +141,7 @@ def parse_args(args): |
32 |
|
33 |
opts = parsed_args[0] |
34 |
files = parsed_args[1] |
35 |
- files = [f for f in files if f != "--"] # filter out "--" |
36 |
+ files = [f for f in files if not f.startswith("-")] # filter unknown options |
37 |
|
38 |
return (opts, files) |
39 |
|
40 |
-- |
41 |
2.24.0 |