Skip to content
Snippets Groups Projects
Commit 2f46a84d authored by Frede H's avatar Frede H :speech_balloon:
Browse files

refactored mirrorfile check

using filecmp.cmp() for better result
parent 8939ed64
No related branches found
No related tags found
No related merge requests found
......@@ -51,11 +51,12 @@ def download_mirrors(config):
with urlopen(config["url_mirrors_json"]) as response:
mirrorlist = json.loads(response.read().decode("utf8"), object_pairs_hook=collections.OrderedDict)
fetchmirrors = True
tempfile = "/tmp/mirrors.json"
tempfile = config["work_dir"] + "/temp.file"
jsonfn.json_dump_file(mirrorlist, tempfile)
if filefn.compare_files(tempfile, config["mirror_file"]):
os.remove(config["mirror_file"])
os.rename(tempfile, config["mirror_file"])
filecmp.clear_cache()
if not filecmp.cmp(tempfile, config["mirror_file"]):
jsonfn.json_dump_file(mirrorlist, config["mirror_file"])
os.remove(tempfile)
except (HTTPException, json.JSONDecodeError, URLError):
pass
try:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment