Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 866650 Details for
Bug 911183
app-portage/mirrorselect: parse the protocol from URI
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
0001-extractor.py-parse-proto-from-the-uri.patch
0001-extractor.py-parse-proto-from-the-uri.patch (text/plain), 1.63 KB, created by
Peter Levine
on 2023-07-30 09:02:57 UTC
(
hide
)
Description:
0001-extractor.py-parse-proto-from-the-uri.patch
Filename:
MIME Type:
Creator:
Peter Levine
Created:
2023-07-30 09:02:57 UTC
Size:
1.63 KB
patch
obsolete
>From 6c871c830ec1b0fe42bf2cda145168127964dc17 Mon Sep 17 00:00:00 2001 >From: Peter Levine <plevine457@gmail.com> >Date: Mon, 24 Jul 2023 18:40:02 -0400 >Subject: [PATCH] extractor.py: parse proto from the uri > >The protocol can be parsed from the URI so we can get rid of the >protocol tag altogether. > >Suggested-by: Florian Schmaus <flow@gentoo.org> >Suggested-by: Sam James <sam@gentoo.org> >Signed-off-by: Peter Levine <plevine457@gmail.com> >--- > mirrorselect/mirrorparser3.py | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/mirrorselect/mirrorparser3.py b/mirrorselect/mirrorparser3.py >index 089f949..5cb6ae8 100644 >--- a/mirrorselect/mirrorparser3.py >+++ b/mirrorselect/mirrorparser3.py >@@ -44,6 +44,22 @@ class MirrorParser3: > def _reset(self): > self._dict = {} > >+ def _get_proto(self, uri=None): >+ if not uri: # Don't parse if empty >+ return None; >+ try: >+ import sys; >+ if sys.version_info[0] >= 3: >+ from urllib.parse import urlparse >+ return urlparse(uri).scheme >+ else: >+ from urllib2 import Request >+ return Request(uri).get_type() >+ except Exception as e: # Add general exception to catch errors >+ from mirrorselect.output import Output >+ Output.write(('_get_proto(): Exception while parsing the protocol ' >+ 'for URI %s: %s\n')% (uri, e), 2) >+ > def parse(self, text): > self._reset() > for mirrorgroup in ET.XML(text): >@@ -60,7 +76,7 @@ class MirrorParser3: > "region": mirrorgroup.get("region"), > "ipv4": e.get("ipv4"), > "ipv6": e.get("ipv6"), >- "proto": e.get("protocol"), >+ "proto": e.get("protocol") or self._get_proto(uri), > } > > def tuples(self): > >-- >2.41.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 911183
:
866176
| 866650