Commit Graph
82 Commits
Author SHA1 Message Date
funilrys 73479bc632 Fix directory separtor under Windows.
This patch fix #1332.
2020-07-10 01:04:44 +02:00
funilrys 15df541200 Fix linting issue. 2020-06-07 20:11:57 +02:00
funilrys 5798b17132 Fix location issue under windows.
This patch fix https://github.com/StevenBlack/hosts/issues/1166#issuecomment-634686875
2020-06-07 18:28:32 +02:00
funilrys 6a216bf28d Merge remote-tracking branch 'upstream/master' into issue-1166-bis 2020-06-07 18:04:21 +02:00
funilrys a2008b78f9 First, format with black. 2020-05-27 21:59:34 +02:00
funilrys dd7904dcc8 Add forgotten sorting.
Indeed, I forgot to sort the content of the hosts file.
2020-04-21 23:54:01 +02:00
funilrys 665dc98191 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
2020-04-21 22:54:25 +02:00
funilrys aa4a0f7a46 Fix backslashes issue under Windows.
This patch fixes https://github.com/StevenBlack/hosts/pull/1165#issuecomment-590111613.

This patch simply, replace the `\` Windows directory separator, with the
universal `/` of the web convention.
2020-02-24 18:34:08 +01:00
funilrys 3abea87f37 Ensure that the readme is written in UTF-8.
This patch fixes #1166.

Indeed as stated in the documentation:

> In text mode, if encoding is not specified the encoding used is platform
> dependent: locale.getpreferredencoding(False) is called to get the
> current locale encoding.

That may explain the issue mentionned in #1166.

Docs link:
  * https://docs.python.org/3/library/functions.html#open
2020-02-24 18:18:17 +01:00
funilrys f22d7bc3f0 Fix link issue under Windows.
We never saw this, as we are not Windows user ourselves but there is
a real issue.

Indeed, as mentionned by @XhmikosR at
https://github.com/StevenBlack/hosts/pull/1163#issuecomment-590057635
the web links are not correctly formated. Indeed, as we use `sep` to
detect the right directory separator, it's also written into the
`readmeData.json` file.

This patch simply, replace the `\` of Windows, with the universal `/` of
the web convention.
2020-02-23 12:37:34 +01:00
funilrys 0843d83d09 It's stupid that it should be at the very top but yeah I fixed it... ¯\_(ツ)_/¯ 2019-07-13 21:06:30 +02:00
funilrys 9fbcff27e0 Fix typo for the ci tests 2019-07-13 20:16:55 +02:00
funilrys bd4df222c9 Introduction of a possible solution for the ci tests 2019-07-13 20:15:45 +02:00
funilrys f97458927c Introduction of the black badge.
More info at: https://github.com/python/black#show-your-style
2019-07-13 13:51:13 +02:00
funilrys b93b427a6e fix #744 #843 and disable E203 (flake8).
Indeed, before this patch, no `# Title: XYZ` was describing our generated
host file. This patch fixes that.

Indeed, we now do the following:

- If no extension is included we add:
    - `# Title: StevenBlack/hosts`
- If exactly one extension is included we add:
    - `# Title: StevenBlack/hosts with the extension_name extension`
- If more than one extension is included we add (in one line):
    - `# Title: StevenBlack/hosts with the extname1,
      extname2 and extname3 extensions`

Please also note that I disable E203 (whitespace before ':') for flake8
at line 773.

Since we use Black for code formatting let me redirect you to
the documentation of Black which explain what I did.

https://black.readthedocs.io/en/stable/the_black_code_style.html#slices :

> Since E203 is not PEP 8 compliant, you should tell
> Flake8 to ignore these warnings.
2019-07-13 13:41:36 +02:00
funilrys 05dad7e657 Introduction of Black: The uncompromising Python code formatter.
Please find more about it there:
* https://github.com/python/black
* https://black.readthedocs.io/en/stable/
2019-07-13 13:40:13 +02:00
funilrys 90420ae751 Fix issue when we meet something like 0.0.0.0
This patch fix StevenBlack/hosts#904
2019-01-30 01:08:59 +01:00
funilrys c0d661f388 Review of the notion of keepdomaincomments
This patch fix StevenBlack/hosts#777

This patch:
  * Change the default state of keepdomaincomments.
    * Indeed, comments are now displayed by default.
    * But if you don't need comments, feel free to use the argument.
  * Delete the requirement input when calling the `-k` argument.
  * Update tests case regarding the new state of keepdomaincomments.
2018-09-14 00:15:56 +02:00
funilrys ec362d81c5 Deletion of the extra \n after each (and especially commented) line.
This patch partially fix StevenBlack/hosts#777 .
2018-09-13 09:17:45 +02:00
funilrys 0d0ee1bcdc Deletion of mock as it is now built-in 2018-09-05 23:53:58 -04:00
funilrys 39e829b716 Introduction of python 3.7 into the CI tests
Signed-off-by: funilrys <contact@funilrys.com>
2018-09-05 23:53:58 -04:00
funilrys 0782145b8e Deletion of python2 related information 2018-09-05 23:53:58 -04:00
funilrys e2be45842b Deletion of unneeded comments 2018-09-05 23:53:58 -04:00
funilrys f54a27103c Exlicitly set the python interpreter to use 2018-09-05 23:53:58 -04:00
funilrys 9ef1e4a1fc Deletion of unneeded comment 2018-09-05 23:53:58 -04:00
funilrys 7c2da6044e Deletion of unneeded comment 2018-09-05 23:53:57 -04:00
funilrys 782a178596 This patch fix https://github.com/StevenBlack/hosts/pull/730#discussion_r205657347 2018-09-05 23:53:57 -04:00
funilrys f5ef7e02d7 Fixing flake8 issues 2018-09-05 23:53:57 -04:00
funilrys e246960c43 Fixing flake8 issues 2018-09-05 23:53:57 -04:00
funilrys a49fc7af44 Deletion of sys as it is unuseed
Also:

  * Fixing flake8 issue
2018-09-05 23:53:57 -04:00
funilrys deed6786ef Fix syntax error produced by last commit 2018-09-05 23:53:57 -04:00
funilrys 62ccd5b084 Deletion of decode_line() as it is not required anymore in python 3
Also:
  * Deletion of any PY3 references
2018-09-05 23:53:57 -04:00
funilrys 58db5143ed Deletion of future dependencies
Also:
  * deletion of raw_input
2018-09-05 23:53:35 -04:00
funilrys d60754db68 Update of the version of beautifulsoup4 2018-09-05 23:53:34 -04:00
funilrys abeb28e6fa Deletion of mock as it is now built-inÃ. 2018-09-05 23:53:34 -04:00
funilrys 95529c9b1e Update of the version of lxml
This patch fix StevenBlack/hosts#751
2018-09-05 23:53:34 -04:00
funilrys edb4f57da4 Fix flake8 issue.
This patch is related to https://github.com/StevenBlack/hosts/issues/729
2018-09-05 23:53:11 -04:00
funilrys eb37488a16 Sorting and update of imports && deletion of Python2 related logic
This patch is related to https://github.com/StevenBlack/hosts/issues/729
2018-09-05 23:53:11 -04:00
funilrys bcb1434ecd Introduction of an exception saying that we do not support Python 2 anymore.
This patch is the begining of https://github.com/StevenBlack/hosts/issues/729
2018-09-05 23:52:15 -04:00
funilrys 11d8c064ac Deletion of unneeded comment 2018-09-05 23:51:29 -04:00
funilrys 52e25bf7b9 This patch fix https://github.com/StevenBlack/hosts/pull/730#discussion_r205657347 2018-09-05 23:51:29 -04:00
funilrys 4d6f1d9065 Fixing flake8 issues 2018-09-05 23:51:29 -04:00
funilrys 816bc35f99 Reformating of lint.sh as ${PYTHON_VERSION} should not have a 2.x version (cf: .travis.yml) 2018-09-05 23:51:29 -04:00
funilrys 6a28f41fdc Fixing flake8 issues 2018-09-05 23:51:29 -04:00
funilrys cce40a8cc4 Deletion of sys as it is unuseed
Also:

  * Fixing flake8 issue
2018-09-05 23:51:29 -04:00
funilrys 9cc719fd72 Fix syntax error produced by last commit 2018-09-05 23:51:29 -04:00
funilrys 4b92652576 Sorting of the dependencies 2018-09-05 23:51:28 -04:00
funilrys 4cd4b8167a Deletion of decode_line() as it is not required anymore in python 3
Also:
  * Deletion of any PY3 references
2018-09-05 23:51:28 -04:00
funilrys 1692f5b759 Sorting of the dependencies 2018-09-05 23:51:28 -04:00
funilrys 928bb5201c Deletion of future dependencies
Also:
  * deletion of raw_input
2018-09-05 23:51:28 -04:00
funilrys 8f9e80422b Update of the version of beautifulsoup4 2018-09-05 23:51:28 -04:00
funilrys ddf80f064b Deletion of mock as it is now built-inÃ. 2018-09-05 23:51:28 -04:00
funilrys 261555716e Update of the version of lxml
This patch fix StevenBlack/hosts#751
2018-09-05 23:51:28 -04:00
funilrys d93e67db63 Deletion of python 2 reference in the readme_template.md
This patch is related to https://github.com/StevenBlack/hosts/issues/729
2018-09-05 23:51:27 -04:00
funilrys 03bc1636b2 Deletion of the Python 2 requirements.txt
This patch is related to https://github.com/StevenBlack/hosts/issues/729
2018-09-05 23:51:27 -04:00
funilrys 8ebad236c6 Fix flake8 issue.
This patch is related to https://github.com/StevenBlack/hosts/issues/729
2018-09-05 23:51:27 -04:00
funilrys d526f3356f Deletion of Python 2.7 from the CI tests.
This patch is related to https://github.com/StevenBlack/hosts/issues/729
2018-09-05 23:51:27 -04:00
funilrys 05c2c6c825 Sorting and update of imports && deletion of Python2 related logic
This patch is related to https://github.com/StevenBlack/hosts/issues/729
2018-09-05 23:51:27 -04:00
funilrys 943d0d732d Introduction of an exception saying that we do not support Python 2 anymore.
This patch is the begining of https://github.com/StevenBlack/hosts/issues/729
2018-09-05 23:51:27 -04:00
funilrys 6de96c5537 Introduction of Start xx and End xxx
This patch fix #644
2018-06-09 11:35:48 +02:00
funilrys 0166642e00 Merge remote-tracking branch 'upstream/master' into encoding-review 2018-03-04 11:19:36 +01:00
funilrys 318389b08f Introduction of more tests cases
Please note that this patch introduce more tests cases
in order to avoid future issue when calling `domains_to_idna()`
2018-03-04 11:18:50 +01:00
funilrys 8405f87edb Review of domain_to_idna() to support more tests cases
Please note this patch comes after an issue reported by @FadeMind
which I could reproduce in 1/3 computer.
2018-03-04 11:17:38 +01:00
funilrys 1e64d1287a Review of readme_template.md
Please note that this patch mothe the unit tests paragraph after dependencies installation.
2018-03-03 21:09:45 +01:00
funilrys 93748698d5 Update of readme_template.md
Please note that this patch explitly set which `pip` version to use according
to the user Python version.
2018-03-03 20:34:10 +01:00
funilrys 50fde09ed7 Fix grammar.
This patch fix: https://github.com/StevenBlack/hosts/pull/520/files/d98b31fb921ff35fb1a421243fa4876504cf676e#r171971716

Thanks to @gfyoung
2018-03-02 22:56:32 +01:00
funilrys 6e62383b28 Review of Notes indentation
This patch fix : https://github.com/StevenBlack/hosts/pull/520#discussion_r171971481
+ It also fix (forgoten coma) : https://github.com/StevenBlack/hosts/pull/520#discussion_r171971574
2018-03-02 22:53:15 +01:00
funilrys bebf7744ca Review of the domain_to_idna() notes.
This patch fix : https://github.com/StevenBlack/hosts/pull/520#discussion_r171971574
2018-03-02 22:51:10 +01:00
funilrys d06bea8fb8 Introduction of dependencies installation instructions 2018-03-02 22:49:15 +01:00
funilrys d98b31fb92 Removing of condescending line.
This patch fix : https://github.com/StevenBlack/hosts/pull/520/files/4798710029b1cfc23130a0588c3a2c7e59171f86#r171969863
2018-03-02 22:43:24 +01:00
funilrys 4798710029 Introduction of domain_to_idna() tests. 2018-03-02 22:23:21 +01:00
funilrys 780e47ffe5 Review of domain_to_idna()
This patch review the way we get the comment at the end of a line.
I also did an application of DRY (Do not Repeat Yourself)
and/or KISS (Keep It Simple, Stupid) by refactoring the 2 `else`
statements into one line.
2018-03-02 22:07:11 +01:00
funilrys 8f00cb4d76 Deletion of a trailing '#'.
Please note that I have added that '#' by mistake.
2018-03-02 21:43:52 +01:00
funilrys 1141823bc8 Fix tests issues.
This patch introduce the installation of dependencies needed my the main commit.

This patch fixes:
 * https://travis-ci.org/funilrys/hosts/jobs/347504195#L592
 * https://travis-ci.org/funilrys/hosts/jobs/347504195#L598
2018-02-28 23:29:18 +01:00
funilrys 3403b10e50 Fix tests issues.
This patch fixes:
 * https://travis-ci.org/funilrys/hosts/jobs/347500695#L400
 * https://travis-ci.org/funilrys/hosts/jobs/347500695#L401
2018-02-28 23:24:58 +01:00
funilrys f5c8ac58b2 Fix tests issue.
This patch fix https://travis-ci.org/funilrys/hosts/jobs/347500695#L399
2018-02-28 23:23:30 +01:00
funilrys 079d5ddd7f Fix tests issue
This patch fix https://travis-ci.org/funilrys/hosts/jobs/347500695#L397

Please also note that I introduced that patch because
we do not directly use lxml but it is required by
BeautifulSup() to parse the HTML.
2018-02-28 23:22:32 +01:00
funilrys 1fea720034 Fix tests issue
This patch fix https://travis-ci.org/funilrys/hosts/jobs/347500695#L398
2018-02-28 23:20:01 +01:00
funilrys d3ef85df17 Review typo + fix test issue.
This patch fix https://travis-ci.org/funilrys/hosts/jobs/347497718#L749
2018-02-28 23:15:01 +01:00
funilrys 079ad6b674 Fix test issue.
This patch fix https://travis-ci.org/funilrys/hosts/jobs/347497718#L748
2018-02-28 23:13:13 +01:00
funilrys ff58bbd1f2 Introduction of requirements.txt
Please note that those file can be used to install
dependencies with 'pip install -r requirements.txt'
2018-02-28 23:08:45 +01:00
funilrys c82f691952 Review of get_file_by_url()
Please note that this patch also introduce
which is in charge of converting a domain in a line into
IDNA and/or UTF-8 format.

Also note the introduction of BeautifulSoup() which helps
us to decode data from the downloaded URL.

Fixes (issue(s)/protocol(s) I was able to reproduce):
 * https://github.com/StevenBlack/hosts/issues/514#issuecomment-368932152

Possible fix of (issue(s)/protocol(s) I wasn't able to reproduce):
 * https://github.com/StevenBlack/hosts/issues/514#issue-300048106
 * https://github.com/StevenBlack/hosts/issues/494#issue-296166492
 * https://github.com/StevenBlack/hosts/issues/420#issue-267453114
 * https://github.com/StevenBlack/hosts/issues/372#issue-246927047
 * https://github.com/StevenBlack/hosts/issues/382#issuecomment-322010562
2018-02-28 23:06:58 +01:00