| LEFT | RIGHT |
| (no file at all) | |
| 1 # This file is part of the Adblock Plus web scripts, | 1 # This file is part of the Adblock Plus web scripts, |
| 2 # Copyright (C) 2006-present eyeo GmbH | 2 # Copyright (C) 2006-present eyeo GmbH |
| 3 # | 3 # |
| 4 # Adblock Plus is free software: you can redistribute it and/or modify | 4 # Adblock Plus is free software: you can redistribute it and/or modify |
| 5 # it under the terms of the GNU General Public License version 3 as | 5 # it under the terms of the GNU General Public License version 3 as |
| 6 # published by the Free Software Foundation. | 6 # published by the Free Software Foundation. |
| 7 # | 7 # |
| 8 # Adblock Plus is distributed in the hope that it will be useful, | 8 # Adblock Plus is distributed in the hope that it will be useful, |
| 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 def __init__(self, path): | 45 def __init__(self, path): |
| 46 self._inner_file = None | 46 self._inner_file = None |
| 47 self._processes = [] | 47 self._processes = [] |
| 48 | 48 |
| 49 parseresult = urlparse.urlparse(path) | 49 parseresult = urlparse.urlparse(path) |
| 50 if parseresult.scheme == 'ssh' and parseresult.username and parseresult.
hostname and parseresult.path: | 50 if parseresult.scheme == 'ssh' and parseresult.username and parseresult.
hostname and parseresult.path: |
| 51 command = [ | 51 command = [ |
| 52 'ssh', '-q', '-o', 'NumberOfPasswordPrompts 0', '-T', '-k', | 52 'ssh', '-q', '-o', 'NumberOfPasswordPrompts 0', '-T', '-k', |
| 53 '-l', parseresult.username, | 53 '-l', parseresult.username, |
| 54 parseresult.hostname, | 54 parseresult.hostname, |
| 55 parseresult.path.lstrip('/') | 55 parseresult.path.lstrip('/'), |
| 56 ] | 56 ] |
| 57 if parseresult.port: | 57 if parseresult.port: |
| 58 command[1:1] = ['-P', str(parseresult.port)] | 58 command[1:1] = ['-P', str(parseresult.port)] |
| 59 ssh_process = subprocess.Popen(command, stdout=subprocess.PIPE) | 59 ssh_process = subprocess.Popen(command, stdout=subprocess.PIPE) |
| 60 self._processes.append(ssh_process) | 60 self._processes.append(ssh_process) |
| 61 self._file = ssh_process.stdout | 61 self._file = ssh_process.stdout |
| 62 elif parseresult.scheme in ('http', 'https'): | 62 elif parseresult.scheme in ('http', 'https'): |
| 63 self._file = urllib.urlopen(path) | 63 self._file = urllib.urlopen(path) |
| 64 elif os.path.exists(path): | 64 elif os.path.exists(path): |
| 65 self._file = open(path, 'rb') | 65 self._file = open(path, 'rb') |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 parser.add_argument('mirror_name', nargs='?', help='Name of the mirror serve
r that the file belongs to') | 594 parser.add_argument('mirror_name', nargs='?', help='Name of the mirror serve
r that the file belongs to') |
| 595 parser.add_argument('server_type', nargs='?', help='Server type like downloa
d, update or subscription') | 595 parser.add_argument('server_type', nargs='?', help='Server type like downloa
d, update or subscription') |
| 596 parser.add_argument('log_file', nargs='?', help='Log file path, can be a loc
al file path, http:// or ssh:// URL') | 596 parser.add_argument('log_file', nargs='?', help='Log file path, can be a loc
al file path, http:// or ssh:// URL') |
| 597 args = parser.parse_args() | 597 args = parser.parse_args() |
| 598 | 598 |
| 599 if args.mirror_name and args.server_type and args.log_file: | 599 if args.mirror_name and args.server_type and args.log_file: |
| 600 sources = [(args.mirror_name, args.server_type, args.log_file)] | 600 sources = [(args.mirror_name, args.server_type, args.log_file)] |
| 601 else: | 601 else: |
| 602 sources = get_stats_files() | 602 sources = get_stats_files() |
| 603 parse_sources(sources, args.factor, args.verbose) | 603 parse_sources(sources, args.factor, args.verbose) |
| LEFT | RIGHT |