From: funilrys Date: Tue, 21 Apr 2020 21:54:01 +0000 (+0200) Subject: Add forgotten sorting. X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=dd7904dcc89b9ebb31831b7c28c7b05b6463dbd2;p=stevenblack-hosts.git Add forgotten sorting. Indeed, I forgot to sort the content of the hosts file. --- diff --git a/updateHostsFile.py b/updateHostsFile.py index 6c417436b..e825453d7 100644 --- a/updateHostsFile.py +++ b/updateHostsFile.py @@ -772,7 +772,9 @@ def create_initial_file(): merge_file = tempfile.NamedTemporaryFile() # spin the sources for the base file - for source in recursive_glob(settings["datapath"], settings["hostfilename"]): + for source in sort_sources( + recursive_glob(settings["datapath"], settings["hostfilename"]) + ): start = "# Start {}\n\n".format(os.path.basename(os.path.dirname(source))) end = "# End {}\n\n".format(os.path.basename(os.path.dirname(source))) @@ -782,9 +784,11 @@ def create_initial_file(): # spin the sources for extensions to the base file for source in settings["extensions"]: - for filename in recursive_glob( - path_join_robust(settings["extensionspath"], source), - settings["hostfilename"], + for filename in sort_sources( + recursive_glob( + path_join_robust(settings["extensionspath"], source), + settings["hostfilename"], + ) ): with open(filename, "r") as curFile: write_data(merge_file, curFile.read())