From d4d5a38b20bbc39938d14217e34663dfb012c742 Mon Sep 17 00:00:00 2001 From: fhdk Date: Mon, 15 May 2017 08:58:17 +0200 Subject: [PATCH] Fix issue #98 --- CHANGELOG.md | 3 ++ pacman_mirrors/__init__.py | 2 +- pacman_mirrors/pacman_mirrors.py | 50 ++++++++++++++++---------------- 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8865e77..187421c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Change Log All notable changes to this project will be documented in this file. +## [4.1.2] 2017-05-15 +- Fix: ranking breaks when --interactive is used with --default [#98](https://github.com/manjaro/pacman-mirrors/issues/98) + ## [4.1.1] 2017-05-01 - Added `-u` / `--update` option * Run `pacman -Syy` after mirrorlist generation diff --git a/pacman_mirrors/__init__.py b/pacman_mirrors/__init__.py index 72aa758..13ffcf4 100644 --- a/pacman_mirrors/__init__.py +++ b/pacman_mirrors/__init__.py @@ -1 +1 @@ -__version__ = "4.1.1" +__version__ = "4.1.2" diff --git a/pacman_mirrors/pacman_mirrors.py b/pacman_mirrors/pacman_mirrors.py index 5a61b5d..db7dac2 100644 --- a/pacman_mirrors/pacman_mirrors.py +++ b/pacman_mirrors/pacman_mirrors.py @@ -504,32 +504,32 @@ def test_mirrors(self, worklist): ssl_wait = self.max_wait_time * 2 ssl_verify = self.config["ssl_verify"] for mirror in worklist: - pos = mirror["url"].find(":") - url = mirror["url"][pos:] - for idx, proto in enumerate(mirror["protocols"]): - mirror["url"] = "{}{}".format(proto, url) + # pos = mirror["url"].find(":") + # url = mirror["url"][pos:] + # for idx, proto in enumerate(mirror["protocols"]): + # mirror["url"] = "{}{}".format(proto, url) + if not self.quiet: + message = " ..... {:<15}: {}".format(mirror["country"], + mirror["url"]) + print("{:.{}}".format(message, cols), end="") + sys.stdout.flush() + # https sometimes takes a short while for handshake + if proto == "https" or proto == "ftps": + self.max_wait_time = ssl_wait + else: + self.max_wait_time = http_wait + # let's see how responsive you are + resp_time = httpfn.get_mirror_response(mirror["url"], + maxwait=self.max_wait_time, + quiet=self.quiet, + ssl_verify=ssl_verify) + mirror["resp_time"] = resp_time + if float(resp_time) >= self.max_wait_time: if not self.quiet: - message = " ..... {:<15}: {}".format(mirror["country"], - mirror["url"]) - print("{:.{}}".format(message, cols), end="") - sys.stdout.flush() - # https sometimes takes a short while for handshake - if proto == "https" or proto == "ftps": - self.max_wait_time = ssl_wait - else: - self.max_wait_time = http_wait - # let's see how responsive you are - resp_time = httpfn.get_mirror_response(mirror["url"], - maxwait=self.max_wait_time, - quiet=self.quiet, - ssl_verify=ssl_verify) - mirror["resp_time"] = resp_time - if float(resp_time) >= self.max_wait_time: - if not self.quiet: - print("\r") - else: - if not self.quiet: - print("\r {:<5}{}{} ".format(txt.GS, resp_time, txt.CE)) + print("\r") + else: + if not self.quiet: + print("\r {:<5}{}{} ".format(txt.GS, resp_time, txt.CE)) return worklist def run(self):