commit speedtest-cli for openSUSE:Factory
Hello community, here is the log from the commit of package speedtest-cli for openSUSE:Factory checked in at 2017-03-31 15:09:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/speedtest-cli (Old) and /work/SRC/openSUSE:Factory/.speedtest-cli.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "speedtest-cli" Fri Mar 31 15:09:22 2017 rev:6 rq:482594 version:1.0.2 Changes: -------- --- /work/SRC/openSUSE:Factory/speedtest-cli/speedtest-cli.changes 2016-11-24 21:25:20.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.speedtest-cli.new/speedtest-cli.changes 2017-03-31 15:09:59.968041567 +0200 @@ -1,0 +2,6 @@ +Fri Mar 24 18:42:45 UTC 2017 - mpluskal@suse.com + +- Update to version 1.0.2: + * No upstream changelog available + +------------------------------------------------------------------- Old: ---- speedtest-cli-1.0.0.tar.gz New: ---- speedtest-cli-1.0.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ speedtest-cli.spec ++++++ --- /var/tmp/diff_new_pack.em3onn/_old 2017-03-31 15:10:00.579955054 +0200 +++ /var/tmp/diff_new_pack.em3onn/_new 2017-03-31 15:10:00.583954489 +0200 @@ -1,7 +1,7 @@ # # spec file for package speedtest-cli # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %define oname speedtest_cli Name: speedtest-cli -Version: 1.0.0 +Version: 1.0.2 Release: 0 Summary: Command line interface for testing internet bandwidth License: Apache-2.0 ++++++ speedtest-cli-1.0.0.tar.gz -> speedtest-cli-1.0.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/speedtest-cli-1.0.0/speedtest.py new/speedtest-cli-1.0.2/speedtest.py --- old/speedtest-cli-1.0.0/speedtest.py 2016-11-17 18:20:19.000000000 +0100 +++ new/speedtest-cli-1.0.2/speedtest.py 2017-01-18 21:10:02.000000000 +0100 @@ -36,7 +36,7 @@ gzip = None GZIP_BASE = object -__version__ = '1.0.0' +__version__ = '1.0.2' class FakeShutdownEvent(object): @@ -225,6 +225,10 @@ """Base exception for this module""" +class SpeedtestCLIError(SpeedtestException): + """Generic exception for raising errors during CLI operation""" + + class SpeedtestHTTPError(SpeedtestException): """Base HTTP exception for this module""" @@ -293,7 +297,13 @@ raise SpeedtestHTTPError('HTTP response body is gzip encoded, ' 'but gzip support is not available') IO = BytesIO or StringIO - self.io = IO(response.read()) + self.io = IO() + while 1: + chunk = response.read(1024) + if len(chunk) == 0: + break + self.io.write(chunk) + self.io.seek(0) gzip.GzipFile.__init__(self, mode='rb', fileobj=self.io) def close(self): @@ -303,6 +313,13 @@ self.io.close() +def get_exception(): + """Helper function to work with py2.4-py3 for getting the current + exception in a try/except block + """ + return sys.exc_info()[1] + + def bound_socket(*args, **kwargs): """Bind socket to a specified source IP address""" @@ -398,7 +415,7 @@ uh = urlopen(request) return uh, False except HTTP_ERRORS: - e = sys.exc_info()[1] + e = get_exception() return None, e @@ -710,7 +727,7 @@ stream = get_response_stream(uh) while 1: - configxml.append(stream.read(10240)) + configxml.append(stream.read(1024)) if len(configxml[-1]) == 0: break stream.close() @@ -822,7 +839,7 @@ serversxml = [] while 1: - serversxml.append(stream.read(10240)) + serversxml.append(stream.read(1024)) if len(serversxml[-1]) == 0: break @@ -982,7 +999,7 @@ r = h.getresponse() total = (timeit.default_timer() - start) except HTTP_ERRORS: - e = sys.exc_info()[1] + e = get_exception() printer('%r' % e, debug=True) cum.append(3600) continue @@ -1082,11 +1099,13 @@ for i, size in enumerate(sizes): # We set ``0`` for ``start`` and handle setting the actual # ``start`` in ``HTTPUploader`` to get better measurements - data = HTTPUploaderData(size, 0, self.config['length']['upload']) - data._create_data() requests.append( ( - build_request(self.best['url'], data), + build_request( + self.best['url'], + HTTPUploaderData(size, 0, + self.config['length']['upload']) + ), size ) ) @@ -1308,16 +1327,16 @@ printer('Retrieving speedtest.net configuration...', quiet) try: speedtest = Speedtest() - except ConfigRetrievalError: + except (ConfigRetrievalError, HTTP_ERRORS): printer('Cannot retrieve speedtest configuration') - sys.exit(1) + raise SpeedtestCLIError(get_exception()) if args.list: try: speedtest.get_servers() - except ServersRetrievalError: + except (ServersRetrievalError, HTTP_ERRORS): print_('Cannot retrieve speedtest server list') - sys.exit(1) + raise SpeedtestCLIError(get_exception()) for _, servers in sorted(speedtest.servers.items()): for server in servers: @@ -1326,7 +1345,7 @@ try: print_(line) except IOError: - e = sys.exc_info()[1] + e = get_exception() if e.errno != errno.EPIPE: raise sys.exit(0) @@ -1344,14 +1363,13 @@ try: speedtest.get_servers(servers) except NoMatchedServers: - print_('No matched servers: %s' % args.server) - sys.exit(1) - except ServersRetrievalError: + raise SpeedtestCLIError('No matched servers: %s' % args.server) + except (ServersRetrievalError, HTTP_ERRORS): print_('Cannot retrieve speedtest server list') - sys.exit(1) + raise SpeedtestCLIError(get_exception()) except InvalidServerIDType: - print_('%s is an invalid server type, must be int' % args.server) - sys.exit(1) + raise SpeedtestCLIError('%s is an invalid server type, must ' + 'be an int' % args.server) printer('Selecting best server based on ping...', quiet) speedtest.get_best_server() @@ -1401,7 +1419,7 @@ except KeyboardInterrupt: print_('\nCancelling...') except (SpeedtestException, SystemExit): - e = sys.exc_info()[1] + e = get_exception() if getattr(e, 'code', 1) != 0: raise SystemExit('ERROR: %s' % e)
participants (1)
-
root@hilbert.suse.de