Unification of the sorting of the sources.
authorfunilrys <redacted>
Tue, 21 Apr 2020 20:37:37 +0000 (22:37 +0200)
committerfunilrys <redacted>
Tue, 21 Apr 2020 20:54:25 +0000 (22:54 +0200)
commit665dc981919f640c77bb3292961589a1f40515dd
treea04dc471a552674305b5a02d4728e3c092066fff
parent6548b1af252f753e2ff0286eccaf80f8eeb87f20
Unification of the sorting of the sources.

Before this patch, there was no proper sorting and the sources.

As @XhmikosR mentioned in StevenBlack/hosts#1166, without this patch,
the output is totally different in Windows. But let's be honest, if it
is like that under Windows, chances are that the same behavior happens
across different OSes or machines around the globe.

Another reason behind this patch is that - desperate the fact that we
certainly trust @StevenBlack - the integrity of the generated files
could not be guarenteed because of the sorting which may be completely
different from an OS to another and a machine to another.

For those reasons, this patch introduces a unification of the sorting of
all sources.

The idea behind this patch is to have @StevenBlack's ad-hoc hosts
file always on top (1st) and the rest of the sources sorted
alphabetically based on the name of the folder inside the `data`
or `extensions` directory.

This will ensure that we get the same result everywhere.

Concretely speaking, I just added the function (`sort_sources`) which
sorts a given list of sources files. And later on, call the new function
everywhere it was necessary. Tests of the newly introduced function
are also included.

Contributors:
  * @ScriptTiger
  * @XhmikosR

Notes:
  * This patch fix (completely ?) ScriptTiger/hosts#1
  * This patch fix https://github.com/StevenBlack/hosts/issues/1166#issuecomment-590511086
testUpdateHostsFile.py
updateHostsFile.py
git clone https://git.99rst.org/PROJECT