* [gentoo-commits] repo/gentoo:master commit in: net-analyzer/speedtest-cli/, net-analyzer/speedtest-cli/files/
@ 2023-05-07 12:34 Conrad Kostecki
0 siblings, 0 replies; only message in thread
From: Conrad Kostecki @ 2023-05-07 12:34 UTC (permalink / raw
To: gentoo-commits
commit: 2ca0c72fa042dc510f74b128fe513db0cb9a934c
Author: Conrad Kostecki <conikost <AT> gentoo <DOT> org>
AuthorDate: Sun May 7 12:33:35 2023 +0000
Commit: Conrad Kostecki <conikost <AT> gentoo <DOT> org>
CommitDate: Sun May 7 12:34:10 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2ca0c72f
net-analyzer/speedtest-cli: switch to json serverlist
Closes: https://bugs.gentoo.org/904968
Signed-off-by: Conrad Kostecki <conikost <AT> gentoo.org>
.../speedtest-cli-2.1.3-json-serverlist.patch | 88 ++++++++++++++++++++++
...1.3-r1.ebuild => speedtest-cli-2.1.3-r2.ebuild} | 2 +
2 files changed, 90 insertions(+)
diff --git a/net-analyzer/speedtest-cli/files/speedtest-cli-2.1.3-json-serverlist.patch b/net-analyzer/speedtest-cli/files/speedtest-cli-2.1.3-json-serverlist.patch
new file mode 100644
index 000000000000..455fd4bfd2eb
--- /dev/null
+++ b/net-analyzer/speedtest-cli/files/speedtest-cli-2.1.3-json-serverlist.patch
@@ -0,0 +1,88 @@
+diff --git a/speedtest.py b/speedtest.py
+index a33296d..e7490b1 100755
+--- a/speedtest.py
++++ b/speedtest.py
+@@ -20,6 +20,7 @@ import re
+ import csv
+ import sys
+ import math
++import json
+ import errno
+ import signal
+ import socket
+@@ -1250,10 +1251,7 @@ class Speedtest(object):
+ )
+
+ urls = [
+- '://www.speedtest.net/speedtest-servers-static.php',
+- 'http://c.speedtest.net/speedtest-servers-static.php',
+- '://www.speedtest.net/speedtest-servers.php',
+- 'http://c.speedtest.net/speedtest-servers.php',
++ "://www.speedtest.net/api/js/servers",
+ ]
+
+ headers = {}
+@@ -1296,53 +1294,31 @@ class Speedtest(object):
+ printer('Servers XML:\n%s' % serversxml, debug=True)
+
+ try:
+- try:
+- try:
+- root = ET.fromstring(serversxml)
+- except ET.ParseError:
+- e = get_exception()
+- raise SpeedtestServersError(
+- 'Malformed speedtest.net server list: %s' % e
+- )
+- elements = etree_iter(root, 'server')
+- except AttributeError:
+- try:
+- root = DOM.parseString(serversxml)
+- except ExpatError:
+- e = get_exception()
+- raise SpeedtestServersError(
+- 'Malformed speedtest.net server list: %s' % e
+- )
+- elements = root.getElementsByTagName('server')
+- except (SyntaxError, xml.parsers.expat.ExpatError):
++ elements = json.loads(serversxml)
++ except SyntaxError:
+ raise ServersRetrievalError()
+
+ for server in elements:
+- try:
+- attrib = server.attrib
+- except AttributeError:
+- attrib = dict(list(server.attributes.items()))
+-
+- if servers and int(attrib.get('id')) not in servers:
++ if servers and int(server.get('id')) not in servers:
+ continue
+
+- if (int(attrib.get('id')) in self.config['ignore_servers']
+- or int(attrib.get('id')) in exclude):
++ if (int(server.get('id')) in self.config['ignore_servers']
++ or int(server.get('id')) in exclude):
+ continue
+
+ try:
+ d = distance(self.lat_lon,
+- (float(attrib.get('lat')),
+- float(attrib.get('lon'))))
++ (float(server.get('lat')),
++ float(server.get('lon'))))
+ except Exception:
+ continue
+
+- attrib['d'] = d
++ server['d'] = d
+
+ try:
+- self.servers[d].append(attrib)
++ self.servers[d].append(server)
+ except KeyError:
+- self.servers[d] = [attrib]
++ self.servers[d] = [server]
+
+ break
+
diff --git a/net-analyzer/speedtest-cli/speedtest-cli-2.1.3-r1.ebuild b/net-analyzer/speedtest-cli/speedtest-cli-2.1.3-r2.ebuild
similarity index 91%
rename from net-analyzer/speedtest-cli/speedtest-cli-2.1.3-r1.ebuild
rename to net-analyzer/speedtest-cli/speedtest-cli-2.1.3-r2.ebuild
index 57075996b3fe..4fb0e2fc1022 100644
--- a/net-analyzer/speedtest-cli/speedtest-cli-2.1.3-r1.ebuild
+++ b/net-analyzer/speedtest-cli/speedtest-cli-2.1.3-r2.ebuild
@@ -19,6 +19,8 @@ KEYWORDS="amd64 ~arm ~arm64 ppc ppc64 x86"
DEPEND="dev-python/setuptools[${PYTHON_USEDEP}]"
RDEPEND="${DEPEND}"
+PATCHES=( "${FILESDIR}/${PN}-2.1.3-json-serverlist.patch" )
+
python_install_all() {
doman ${PN}.1
distutils-r1_python_install_all
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-05-07 12:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-07 12:34 [gentoo-commits] repo/gentoo:master commit in: net-analyzer/speedtest-cli/, net-analyzer/speedtest-cli/files/ Conrad Kostecki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox