Gentoo Archives: gentoo-commits

From: Julian Ospald <hasufell@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/gentoolkit:gentoolkit commit in: pym/gentoolkit/equery/
Date: Fri, 01 Nov 2013 18:15:53
Message-Id: 1383329274.07c7d909a9f36e2cccda406adb97091631f71f25.hasufell@gentoo
1 commit: 07c7d909a9f36e2cccda406adb97091631f71f25
2 Author: Julian Ospald <hasufell <AT> gentoo <DOT> org>
3 AuthorDate: Fri Nov 1 18:07:54 2013 +0000
4 Commit: Julian Ospald <hasufell <AT> gentoo <DOT> org>
5 CommitDate: Fri Nov 1 18:07:54 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=07c7d909
7
8 equery: add --ignore-linguas switch to 'equery uses'
9
10 ---
11 pym/gentoolkit/equery/uses.py | 16 ++++++++++++----
12 1 file changed, 12 insertions(+), 4 deletions(-)
13
14 diff --git a/pym/gentoolkit/equery/uses.py b/pym/gentoolkit/equery/uses.py
15 index 22e6488..cedac96 100644
16 --- a/pym/gentoolkit/equery/uses.py
17 +++ b/pym/gentoolkit/equery/uses.py
18 @@ -34,7 +34,7 @@ from gentoolkit.flag import get_flags, reduce_flags
19 # Globals
20 # =======
21
22 -QUERY_OPTS = {"all_versions" : False}
23 +QUERY_OPTS = {"all_versions" : False, "ignore_linguas" : False}
24
25 # =========
26 # Functions
27 @@ -55,7 +55,8 @@ def print_help(with_description=True):
28 print(pp.command("options"))
29 print(format_options((
30 (" -h, --help", "display this help message"),
31 - (" -a, --all", "include all package versions")
32 + (" -a, --all", "include all package versions"),
33 + (" -i, --ignore-linguas", "don't show linguas USE flags")
34 )))
35
36
37 @@ -183,6 +184,11 @@ def get_output_descriptions(pkg, global_usedesc):
38 usevar = reduce_flags(iuse)
39 usevar.sort()
40
41 + if QUERY_OPTS['ignore_linguas']:
42 + for a in usevar[:]:
43 + if a.startswith("linguas_"):
44 + usevar.remove(a)
45 +
46
47 if pkg.is_installed():
48 used_flags = pkg.use().split()
49 @@ -235,6 +241,8 @@ def parse_module_options(module_opts):
50 sys.exit(0)
51 elif opt in ('-a', '--all'):
52 QUERY_OPTS['all_versions'] = True
53 + elif opt in ('-i', '--ignore-linguas'):
54 + QUERY_OPTS['ignore_linguas'] = True
55
56
57 def print_legend():
58 @@ -249,8 +257,8 @@ def print_legend():
59 def main(input_args):
60 """Parse input and run the program"""
61
62 - short_opts = "ha"
63 - long_opts = ('help', 'all')
64 + short_opts = "hai"
65 + long_opts = ('help', 'all', 'ignore-linguas')
66
67 try:
68 module_opts, queries = gnu_getopt(input_args, short_opts, long_opts)