Archived
1
0

Show names during probing.

This commit is contained in:
Markus Birth 2018-03-02 18:56:11 +01:00
parent bde616fc60
commit c5cc3234df
Signed by: mbirth
GPG Key ID: A9928D7A098C3A9A
2 changed files with 9 additions and 2 deletions

View File

@ -14,6 +14,11 @@ if SYSTEM == "Windows":
pass
UP_DEL = u"\u001b[F\u001b[K"
SCP = u"\u001b[s"
RCP = u"\u001b[u"
EL = u"\u001b[K"
EL_LEFT = u"\u001b[1K"
EL_ALL = u"\u001b[2K"
BLACK = u"\u001b[0;30m"
RED_DARK = u"\u001b[0;31m"
GREEN_DARK = u"\u001b[0;32m"

View File

@ -79,14 +79,16 @@ def try_url_probing(url: str, current_codename: str) -> list:
test_set = codenames + codenames_okay
valid_matches = []
for codename in test_set:
mcodename = mutate_codename(current_codename, codename)
print(ansi.SCP + mcodename, end="", flush=True)
for filename in ["InRelease", "Release", "Release.gpg"]:
mcodename = mutate_codename(current_codename, codename)
try_url = "{}/{}/{}".format(url, mcodename, filename)
print(".", end="", flush=True)
result = requests.get(try_url)
if result.status_code == 200:
valid_matches.append(mcodename)
break
print(ansi.RCP + ansi.EL, end="", flush=True)
probe_cache[cache_key] = valid_matches
return probe_cache[cache_key]
@ -105,7 +107,7 @@ for src in check_sources:
test_url = src.uri + "/dists"
more_options = try_fetch_dirlisting(test_url)
if not more_options:
print("Listing failed. Probing", end="", flush=True)
print("Listing failed. Probing: ", end="", flush=True)
more_options = try_url_probing(test_url, src.dist)
print(" OK")
print(ansi.UP_DEL, end="")