diff options
-rw-r--r-- | src/util.py | 5 | ||||
-rw-r--r-- | src/verbs/install.py | 7 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/util.py b/src/util.py index cef5529..d911ce8 100644 --- a/src/util.py +++ b/src/util.py @@ -45,11 +45,13 @@ def get_unit(n): elif n > base**3: return base**3, "GB" elif n > base**2: return base**2, "MB" elif n > base**1: return base**1, "KB" + else: return 1, "B" def curl_to_file(url, path, text=""): with requests.get(url, stream=True) as r: r.raise_for_status() - length = int(r.headers['content-length']) + + length = int(r.headers['content-length']) if "content-length" in r.headers else 1000 with open(path, "wb") as f: c_size = 4096 @@ -66,7 +68,6 @@ def curl_to_file(url, path, text=""): if text: divisor, unit = get_unit(length) loading_bar(int(done/divisor), int(length/divisor), "Downloaded " + text, unit=unit) - print(colors.RESET) return r.status_code, path diff --git a/src/verbs/install.py b/src/verbs/install.py index b5555a7..34974a0 100644 --- a/src/verbs/install.py +++ b/src/verbs/install.py @@ -106,6 +106,8 @@ def retrieve_package(sources, package_info, package_name, config, for source in get_best_source(sources_list=sources_list): url = sources[source] + if verbose: + print(colors.LIGHT_BLACK + f"using source {source} at {url}") package_url = util.add_path(url, package_name + ".xipkg") package_dir = util.add_path(cache_dir, source) @@ -120,6 +122,7 @@ def retrieve_package(sources, package_info, package_name, config, if verify_signature(package_path, package_info, cache_dir=cache_dir, keychain_dir=keychain_dir, verbose=verbose): + print(colors.RESET) return package_path elif verbose: print(colors.RED @@ -130,9 +133,9 @@ def retrieve_package(sources, package_info, package_name, config, + f"Checksum verification failed for {package_name} in {source}" + colors.RESET) else: + print(colors.RESET) return package_path - if verbose: - print(colors.RED + f"No valid packages found" + colors.RESET) + print(colors.RESET + colors.RED + f"No valid packages found for {package_name}" + colors.RESET) return "" def parse_package_info(packageinfo): |