Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/mirrors.py
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-11-06 10:47:19 +0100
committerAnton Hvornum <anton@hvornum.se>2021-11-06 10:47:19 +0100
commit129326b93fc58a00d15ed89fe4e701d07b0385bf (patch)
tree7c86893ab3776a6806241a74a75052e448c6cad3 /archinstall/lib/mirrors.py
parent97a91aab6019d6efb500de1240bc58b4165ab02d (diff)
parent17fe62c641607cc460e6c6590192ad8de0a21b1a (diff)
Merge branch 'master' of https://github.com/archlinux/archinstall into torxed-fix-109
Diffstat (limited to 'archinstall/lib/mirrors.py')
-rw-r--r--archinstall/lib/mirrors.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/archinstall/lib/mirrors.py b/archinstall/lib/mirrors.py
index ed34b5d5..5fad6cb6 100644
--- a/archinstall/lib/mirrors.py
+++ b/archinstall/lib/mirrors.py
@@ -1,8 +1,9 @@
+import logging
import urllib.error
import urllib.request
from typing import Union, Mapping, Iterable
-from .general import *
+from .general import SysCommand
from .output import log
def sort_mirrorlist(raw_data :bytes, sort_order=["https", "http"]) -> bytes:
@@ -26,7 +27,7 @@ def sort_mirrorlist(raw_data :bytes, sort_order=["https", "http"]) -> bytes:
"""
comments_and_whitespaces = b""
- categories = {key: [] for key in sort_order+["Unknown"]}
+ categories = {key: [] for key in sort_order + ["Unknown"]}
for line in raw_data.split(b"\n"):
if line[0:2] in (b'##', b''):
comments_and_whitespaces += line + b'\n'
@@ -35,16 +36,15 @@ def sort_mirrorlist(raw_data :bytes, sort_order=["https", "http"]) -> bytes:
opening, url = opening.strip(), url.strip()
if (category := url.split(b'://',1)[0].decode('UTF-8')) in categories:
categories[category].append(comments_and_whitespaces)
- categories[category].append(opening+b' = '+url+b'\n')
+ categories[category].append(opening + b' = ' + url + b'\n')
else:
categories["Unknown"].append(comments_and_whitespaces)
- categories["Unknown"].append(opening+b' = '+url+b'\n')
+ categories["Unknown"].append(opening + b' = ' + url + b'\n')
comments_and_whitespaces = b""
-
new_raw_data = b''
- for category in sort_order+["Unknown"]:
+ for category in sort_order + ["Unknown"]:
for line in categories[category]:
new_raw_data += line
@@ -115,7 +115,7 @@ def insert_mirrors(mirrors, *args, **kwargs):
def use_mirrors(
regions: Mapping[str, Iterable[str]],
- destination: str ='/etc/pacman.d/mirrorlist'
+ destination: str = '/etc/pacman.d/mirrorlist'
) -> None:
log(f'A new package mirror-list has been created: {destination}', level=logging.INFO)
with open(destination, 'w') as mirrorlist: