ngxtop-0.0.2-py3.patch 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. diff --git a/ngxtop/config_parser.py b/ngxtop/config_parser.py
  2. index f6999cf..7c0d79a 100644
  3. --- a/ngxtop/config_parser.py
  4. +++ b/ngxtop/config_parser.py
  5. @@ -106,7 +106,7 @@ def detect_log_config(arguments):
  6. log_formats = dict(get_log_formats(config_str))
  7. if len(access_logs) == 1:
  8. - log_path, format_name = access_logs.items()[0]
  9. + log_path, format_name = list(access_logs.items())[0]
  10. if format_name == 'combined':
  11. return log_path, LOG_FORMAT_COMBINED
  12. if format_name not in log_formats:
  13. @@ -115,7 +115,7 @@ def detect_log_config(arguments):
  14. # multiple access logs configured, offer to select one
  15. print('Multiple access logs detected in configuration:')
  16. - log_path = choose_one(access_logs.keys(), 'Select access log file to process: ')
  17. + log_path = choose_one(list(access_logs.keys()), 'Select access log file to process: ')
  18. format_name = access_logs[log_path]
  19. if format_name not in log_formats:
  20. error_exit('Incorrect format name set in config for access log file "%s"' % log_path)
  21. diff --git a/ngxtop/ngxtop.py b/ngxtop/ngxtop.py
  22. old mode 100755
  23. new mode 100644
  24. diff --git a/ngxtop/utils.py b/ngxtop/utils.py
  25. index ef61072..7bd9a2a 100644
  26. --- a/ngxtop/utils.py
  27. +++ b/ngxtop/utils.py
  28. @@ -5,6 +5,8 @@ def choose_one(choices, prompt):
  29. for idx, choice in enumerate(choices):
  30. print('%d. %s' % (idx + 1, choice))
  31. selected = None
  32. + if sys.version[0] == '3':
  33. + raw_input = input
  34. while not selected or selected <= 0 or selected > len(choices):
  35. selected = raw_input(prompt)
  36. try:
  37. @@ -16,4 +18,4 @@ def choose_one(choices, prompt):
  38. def error_exit(msg, status=1):
  39. sys.stderr.write('Error: %s\n' % msg)
  40. - sys.exit(status)
  41. \ No newline at end of file
  42. + sys.exit(status)