Gentoo Archives: gentoo-commits

From: "Justin Lecher (jlec)" <jlec@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in app-admin/ngxtop/files: ngxtop-0.0.2-py3.patch
Date: Sat, 07 Jun 2014 20:33:45
Message-Id: 20140607203340.6B8A42004F@flycatcher.gentoo.org
1 jlec 14/06/07 20:33:40
2
3 Modified: ngxtop-0.0.2-py3.patch
4 Log:
5 app-admin/ngxtop: Add py3 compatibility, #512380
6
7 (Portage version: 2.2.10/cvs/Linux x86_64, signed Manifest commit with key B9D4F231BD1558AB!)
8
9 Revision Changes Path
10 1.2 app-admin/ngxtop/files/ngxtop-0.0.2-py3.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-admin/ngxtop/files/ngxtop-0.0.2-py3.patch?rev=1.2&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-admin/ngxtop/files/ngxtop-0.0.2-py3.patch?rev=1.2&content-type=text/plain
14 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-admin/ngxtop/files/ngxtop-0.0.2-py3.patch?r1=1.1&r2=1.2
15
16 Index: ngxtop-0.0.2-py3.patch
17 ===================================================================
18 RCS file: /var/cvsroot/gentoo-x86/app-admin/ngxtop/files/ngxtop-0.0.2-py3.patch,v
19 retrieving revision 1.1
20 retrieving revision 1.2
21 diff -u -r1.1 -r1.2
22 --- ngxtop-0.0.2-py3.patch 4 Jun 2014 13:08:29 -0000 1.1
23 +++ ngxtop-0.0.2-py3.patch 7 Jun 2014 20:33:40 -0000 1.2
24 @@ -1,20 +1,7 @@
25 - ngxtop/config_parser.py | 4 ++--
26 - ngxtop/ngxtop.py | 4 ++--
27 - 2 files changed, 4 insertions(+), 4 deletions(-)
28 -
29 diff --git a/ngxtop/config_parser.py b/ngxtop/config_parser.py
30 -index b8e4804..40b23c9 100644
31 +index f6999cf..7c0d79a 100644
32 --- a/ngxtop/config_parser.py
33 +++ b/ngxtop/config_parser.py
34 -@@ -8,7 +8,7 @@ import subprocess
35 - from pyparsing import Literal, Word, ZeroOrMore, OneOrMore, Group, \
36 - printables, quotedString, pythonStyleComment, removeQuotes
37 -
38 --from utils import choose_one, error_exit
39 -+from .utils import choose_one, error_exit
40 -
41 -
42 - REGEX_SPECIAL_CHARS = r'([\.\*\+\?\|\(\)\{\}\[\]])'
43 @@ -106,7 +106,7 @@ def detect_log_config(arguments):
44
45 log_formats = dict(get_log_formats(config_str))
46 @@ -24,18 +11,35 @@
47 if format_name == 'combined':
48 return log_path, LOG_FORMAT_COMBINED
49 if format_name not in log_formats:
50 -diff --git a/ngxtop/ngxtop.py b/ngxtop/ngxtop.py
51 -index afb5bc3..8667b8b 100755
52 ---- a/ngxtop/ngxtop.py
53 -+++ b/ngxtop/ngxtop.py
54 -@@ -74,8 +74,8 @@ except ImportError:
55 - from docopt import docopt
56 - import tabulate
57 +@@ -115,7 +115,7 @@ def detect_log_config(arguments):
58
59 --from config_parser import detect_log_config, detect_config_path, extract_variables, build_pattern
60 --from utils import error_exit
61 -+from .config_parser import detect_log_config, detect_config_path, extract_variables, build_pattern
62 -+from .utils import error_exit
63 -
64 -
65 - DEFAULT_QUERIES = [
66 + # multiple access logs configured, offer to select one
67 + print('Multiple access logs detected in configuration:')
68 +- log_path = choose_one(access_logs.keys(), 'Select access log file to process: ')
69 ++ log_path = choose_one(list(access_logs.keys()), 'Select access log file to process: ')
70 + format_name = access_logs[log_path]
71 + if format_name not in log_formats:
72 + error_exit('Incorrect format name set in config for access log file "%s"' % log_path)
73 +diff --git a/ngxtop/ngxtop.py b/ngxtop/ngxtop.py
74 +old mode 100755
75 +new mode 100644
76 +diff --git a/ngxtop/utils.py b/ngxtop/utils.py
77 +index ef61072..7bd9a2a 100644
78 +--- a/ngxtop/utils.py
79 ++++ b/ngxtop/utils.py
80 +@@ -5,6 +5,8 @@ def choose_one(choices, prompt):
81 + for idx, choice in enumerate(choices):
82 + print('%d. %s' % (idx + 1, choice))
83 + selected = None
84 ++ if sys.version[0] == '3':
85 ++ raw_input = input
86 + while not selected or selected <= 0 or selected > len(choices):
87 + selected = raw_input(prompt)
88 + try:
89 +@@ -16,4 +18,4 @@ def choose_one(choices, prompt):
90 +
91 + def error_exit(msg, status=1):
92 + sys.stderr.write('Error: %s\n' % msg)
93 +- sys.exit(status)
94 +\ No newline at end of file
95 ++ sys.exit(status)