diff --git a/.github/workflows/data-update.yml b/.github/workflows/data-update.yml index 86df5d59c..b0fd6e1db 100644 --- a/.github/workflows/data-update.yml +++ b/.github/workflows/data-update.yml @@ -39,7 +39,7 @@ jobs: - name: Fetch data env: - FETCH_SCRIPT: ./searx_extra/update/${{ matrix.fetch }} + FETCH_SCRIPT: ./searxng_extra/update/${{ matrix.fetch }} run: | V=1 ./manage pyenv.cmd python "$FETCH_SCRIPT" diff --git a/docs/index.rst b/docs/index.rst index 38b3f4c40..20b1848ca 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -32,7 +32,7 @@ If you don't trust anyone, you can set up your own, see :ref:`installation`. user/index admin/index dev/index - searx_extra/index + searxng_extra/index utils/index src/index diff --git a/docs/searx_extra/standalone_searx.py.rst b/docs/searx_extra/standalone_searx.py.rst deleted file mode 100644 index ff4b53387..000000000 --- a/docs/searx_extra/standalone_searx.py.rst +++ /dev/null @@ -1,9 +0,0 @@ - -.. _standalone_searx.py: - -=================================== -``searx_extra/standalone_searx.py`` -=================================== - -.. automodule:: searx_extra.standalone_searx - :members: diff --git a/docs/searx_extra/index.rst b/docs/searxng_extra/index.rst similarity index 58% rename from docs/searx_extra/index.rst rename to docs/searxng_extra/index.rst index 64d0b9047..a98c358f2 100644 --- a/docs/searx_extra/index.rst +++ b/docs/searxng_extra/index.rst @@ -1,10 +1,10 @@ -.. _searx_extra: +.. _searxng_extra: ====================================================== -Tooling box ``searx_extra`` for developers and users +Tooling box ``searxng_extra`` for developers and users ====================================================== -In the folder :origin:`searx_extra/` we maintain some tools useful for +In the folder :origin:`searxng_extra/` we maintain some tools useful for developers and users. .. toctree:: diff --git a/docs/searxng_extra/standalone_searx.py.rst b/docs/searxng_extra/standalone_searx.py.rst new file mode 100644 index 000000000..7cbbccfde --- /dev/null +++ b/docs/searxng_extra/standalone_searx.py.rst @@ -0,0 +1,9 @@ + +.. _standalone_searx.py: + +===================================== +``searxng_extra/standalone_searx.py`` +===================================== + +.. automodule:: searxng_extra.standalone_searx + :members: diff --git a/manage b/manage index b02128df9..16539a02c 100755 --- a/manage +++ b/manage @@ -25,7 +25,7 @@ pylint.FILES() { # These py files are linted by test.pylint(), all other files are linted by # test.pep8() - grep -l -r --include \*.py '^#[[:blank:]]*lint:[[:blank:]]*pylint' searx searx_extra tests + grep -l -r --include \*.py '^#[[:blank:]]*lint:[[:blank:]]*pylint' searx searxng_extra tests } YAMLLINT_FILES=() @@ -328,11 +328,11 @@ data.all() { data.useragents data.osm_keys_tags build_msg DATA "update searx/data/ahmia_blacklist.txt" - python searx_extra/update/update_ahmia_blacklist.py + python searxng_extra/update/update_ahmia_blacklist.py build_msg DATA "update searx/data/wikidata_units.json" - python searx_extra/update/update_wikidata_units.py + python searxng_extra/update/update_wikidata_units.py build_msg DATA "update searx/data/currencies.json" - python searx_extra/update/update_currencies.py + python searxng_extra/update/update_currencies.py ) } @@ -341,7 +341,7 @@ data.languages() { ( set -e pyenv.activate build_msg ENGINES "fetch languages .." - python searx_extra/update/update_languages.py + python searxng_extra/update/update_languages.py build_msg ENGINES "update update searx/languages.py" build_msg DATA "update searx/data/engines_languages.json" ) @@ -350,13 +350,13 @@ data.languages() { data.useragents() { build_msg DATA "update searx/data/useragents.json" - pyenv.cmd python searx_extra/update/update_firefox_version.py + pyenv.cmd python searxng_extra/update/update_firefox_version.py dump_return $? } data.osm_keys_tags() { build_msg DATA "update searx/data/osm_keys_tags.json" - pyenv.cmd python searx_extra/update/update_osm_keys_tags.py + pyenv.cmd python searxng_extra/update/update_osm_keys_tags.py dump_return $? } @@ -524,8 +524,8 @@ node.clean() { } pygments.less() { - build_msg PYGMENTS "searx_extra/update/update_pygments.py" - if ! pyenv.cmd python searx_extra/update/update_pygments.py; then + build_msg PYGMENTS "searxng_extra/update/update_pygments.py" + if ! pyenv.cmd python searxng_extra/update/update_pygments.py; then build_msg PYGMENTS "building LESS files for pygments failed" return 1 fi diff --git a/searx/data/__init__.py b/searx/data/__init__.py index 9c9d74129..5937ea557 100644 --- a/searx/data/__init__.py +++ b/searx/data/__init__.py @@ -31,7 +31,7 @@ def ahmia_blacklist_loader(): """Load data from `ahmia_blacklist.txt` and return a list of MD5 values of onion names. The MD5 values are fetched by:: - searx_extra/update/update_ahmia_blacklist.py + searxng_extra/update/update_ahmia_blacklist.py This function is used by :py:mod:`searx.plugins.ahmia_filter`. diff --git a/searx/static/themes/oscar/css/logicodev-dark.css b/searx/static/themes/oscar/css/logicodev-dark.css index 3a73378a1..43f465812 100644 --- a/searx/static/themes/oscar/css/logicodev-dark.css +++ b/searx/static/themes/oscar/css/logicodev-dark.css @@ -383,7 +383,7 @@ width: 10rem; } /* - this file is generated automatically by searx_extra/update/update_pygments.py + this file is generated automatically by searxng_extra/update/update_pygments.py using pygments version 2.10.0 */ .code-highlight .linenos { diff --git a/searx/static/themes/oscar/css/logicodev-dark.min.css.map b/searx/static/themes/oscar/css/logicodev-dark.min.css.map index 2793202e1..32293f3a4 100644 Binary files a/searx/static/themes/oscar/css/logicodev-dark.min.css.map and b/searx/static/themes/oscar/css/logicodev-dark.min.css.map differ diff --git a/searx/static/themes/oscar/css/logicodev.css b/searx/static/themes/oscar/css/logicodev.css index 76883b577..bbcefc507 100644 --- a/searx/static/themes/oscar/css/logicodev.css +++ b/searx/static/themes/oscar/css/logicodev.css @@ -383,7 +383,7 @@ width: 10rem; } /* - this file is generated automatically by searx_extra/update/update_pygments.py + this file is generated automatically by searxng_extra/update/update_pygments.py using pygments version 2.10.0 */ .code-highlight .linenos { diff --git a/searx/static/themes/oscar/css/logicodev.min.css.map b/searx/static/themes/oscar/css/logicodev.min.css.map index bb3d8a1d8..52840b8ad 100644 Binary files a/searx/static/themes/oscar/css/logicodev.min.css.map and b/searx/static/themes/oscar/css/logicodev.min.css.map differ diff --git a/searx/static/themes/oscar/css/pointhi.css b/searx/static/themes/oscar/css/pointhi.css index 5a4839fac..c0bcc73f8 100644 --- a/searx/static/themes/oscar/css/pointhi.css +++ b/searx/static/themes/oscar/css/pointhi.css @@ -383,7 +383,7 @@ width: 10rem; } /* - this file is generated automatically by searx_extra/update/update_pygments.py + this file is generated automatically by searxng_extra/update/update_pygments.py using pygments version 2.10.0 */ .code-highlight .linenos { diff --git a/searx/static/themes/oscar/src/generated/pygments-logicodev.less b/searx/static/themes/oscar/src/generated/pygments-logicodev.less index 92a5bc830..1a16015dc 100644 --- a/searx/static/themes/oscar/src/generated/pygments-logicodev.less +++ b/searx/static/themes/oscar/src/generated/pygments-logicodev.less @@ -1,5 +1,5 @@ /* - this file is generated automatically by searx_extra/update/update_pygments.py + this file is generated automatically by searxng_extra/update/update_pygments.py using pygments version 2.10.0 */ diff --git a/searx/static/themes/oscar/src/generated/pygments-pointhi.less b/searx/static/themes/oscar/src/generated/pygments-pointhi.less index 869b44329..827d2ecb7 100644 --- a/searx/static/themes/oscar/src/generated/pygments-pointhi.less +++ b/searx/static/themes/oscar/src/generated/pygments-pointhi.less @@ -1,5 +1,5 @@ /* - this file is generated automatically by searx_extra/update/update_pygments.py + this file is generated automatically by searxng_extra/update/update_pygments.py using pygments version 2.10.0 */ diff --git a/searx/static/themes/simple/css/searxng-rtl.css b/searx/static/themes/simple/css/searxng-rtl.css index 47131118d..bb771d23e 100644 --- a/searx/static/themes/simple/css/searxng-rtl.css +++ b/searx/static/themes/simple/css/searxng-rtl.css @@ -829,7 +829,7 @@ template { border: inherit; } /* - this file is generated automatically by searx_extra/update/update_pygments.py + this file is generated automatically by searxng_extra/update/update_pygments.py using pygments version 2.10.0 */ .code-highlight .linenos { diff --git a/searx/static/themes/simple/css/searxng.css b/searx/static/themes/simple/css/searxng.css index 7ec28152b..6e2bc5843 100644 --- a/searx/static/themes/simple/css/searxng.css +++ b/searx/static/themes/simple/css/searxng.css @@ -829,7 +829,7 @@ template { border: inherit; } /* - this file is generated automatically by searx_extra/update/update_pygments.py + this file is generated automatically by searxng_extra/update/update_pygments.py using pygments version 2.10.0 */ .code-highlight .linenos { diff --git a/searx/static/themes/simple/src/generated/pygments.less b/searx/static/themes/simple/src/generated/pygments.less index 869b44329..827d2ecb7 100644 --- a/searx/static/themes/simple/src/generated/pygments.less +++ b/searx/static/themes/simple/src/generated/pygments.less @@ -1,5 +1,5 @@ /* - this file is generated automatically by searx_extra/update/update_pygments.py + this file is generated automatically by searxng_extra/update/update_pygments.py using pygments version 2.10.0 */ diff --git a/searx_extra/__init__.py b/searxng_extra/__init__.py similarity index 100% rename from searx_extra/__init__.py rename to searxng_extra/__init__.py diff --git a/searx_extra/google_search.py b/searxng_extra/google_search.py similarity index 95% rename from searx_extra/google_search.py rename to searxng_extra/google_search.py index cad32eeca..34b40c0f2 100644 --- a/searx_extra/google_search.py +++ b/searxng_extra/google_search.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: AGPL-3.0-or-later + from sys import argv, exit if not len(argv) > 1: diff --git a/searx_extra/standalone_searx.py b/searxng_extra/standalone_searx.py similarity index 87% rename from searx_extra/standalone_searx.py rename to searxng_extra/standalone_searx.py index b30762d3f..e243d9cb1 100755 --- a/searx_extra/standalone_searx.py +++ b/searxng_extra/standalone_searx.py @@ -1,5 +1,11 @@ #!/usr/bin/env python -"""Script to run searx from terminal. +# lint: pylint + +# SPDX-License-Identifier: AGPL-3.0-or-later +# (C) Copyright Contributors to the SearXNG project. +# (C) Copyright Contributors to the searx project (2014 - 2021) + +"""Script to run SearXNG from terminal. Getting categories without initiate the engine will only return `['general']` @@ -15,7 +21,7 @@ Example to use this script: .. code:: bash - $ python3 searx_extra/standalone_searx.py rain + $ python3 searxng_extra/standalone_searx.py rain Example to run it from python: @@ -31,7 +37,7 @@ Example to run it from python: ... engine_cs = list(searx.engines.categories.keys()) ... # load module ... spec = importlib.util.spec_from_file_location( -... 'utils.standalone_searx', 'searx_extra/standalone_searx.py') +... 'utils.standalone_searx', 'searxng_extra/standalone_searx.py') ... sas = importlib.util.module_from_spec(spec) ... spec.loader.exec_module(sas) ... # use function from module @@ -56,25 +62,8 @@ Example to run it from python: }, "suggestions": [...] } -""" # noqa: E501 -# pylint: disable=pointless-string-statement -''' -searx is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. +""" # pylint: disable=line-too-long -searx is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with searx. If not, see < http://www.gnu.org/licenses/ >. - -(C) 2016- by Alexandre Flament, -''' -# pylint: disable=wrong-import-position import argparse import sys from datetime import datetime diff --git a/searx_extra/update/__init__.py b/searxng_extra/update/__init__.py similarity index 100% rename from searx_extra/update/__init__.py rename to searxng_extra/update/__init__.py diff --git a/searx_extra/update/update_ahmia_blacklist.py b/searxng_extra/update/update_ahmia_blacklist.py similarity index 94% rename from searx_extra/update/update_ahmia_blacklist.py rename to searxng_extra/update/update_ahmia_blacklist.py index f645880e6..f7695deae 100755 --- a/searx_extra/update/update_ahmia_blacklist.py +++ b/searxng_extra/update/update_ahmia_blacklist.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# SPDX-License-Identifier: AGPL-3.0-or-later # This script saves Ahmia's blacklist for onion sites. # More info in https://ahmia.fi/blacklist/ diff --git a/searx_extra/update/update_currencies.py b/searxng_extra/update/update_currencies.py similarity index 99% rename from searx_extra/update/update_currencies.py rename to searxng_extra/update/update_currencies.py index 063801645..93ac15aa5 100755 --- a/searx_extra/update/update_currencies.py +++ b/searxng_extra/update/update_currencies.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# SPDX-License-Identifier: AGPL-3.0-or-later import re import unicodedata diff --git a/searx_extra/update/update_engine_descriptions.py b/searxng_extra/update/update_engine_descriptions.py similarity index 99% rename from searx_extra/update/update_engine_descriptions.py rename to searxng_extra/update/update_engine_descriptions.py index 57646f07c..59a9a72a0 100755 --- a/searx_extra/update/update_engine_descriptions.py +++ b/searxng_extra/update/update_engine_descriptions.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# SPDX-License-Identifier: AGPL-3.0-or-later import json from urllib.parse import urlparse diff --git a/searx_extra/update/update_external_bangs.py b/searxng_extra/update/update_external_bangs.py similarity index 98% rename from searx_extra/update/update_external_bangs.py rename to searxng_extra/update/update_external_bangs.py index e6331d47c..27882bb24 100755 --- a/searx_extra/update/update_external_bangs.py +++ b/searxng_extra/update/update_external_bangs.py @@ -1,5 +1,6 @@ #!/usr/bin/env python # lint: pylint +# SPDX-License-Identifier: AGPL-3.0-or-later """ Update searx/data/external_bangs.json using the duckduckgo bangs. diff --git a/searx_extra/update/update_firefox_version.py b/searxng_extra/update/update_firefox_version.py similarity index 97% rename from searx_extra/update/update_firefox_version.py rename to searxng_extra/update/update_firefox_version.py index 6acfe76ce..6a446947c 100755 --- a/searx_extra/update/update_firefox_version.py +++ b/searxng_extra/update/update_firefox_version.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# SPDX-License-Identifier: AGPL-3.0-or-later import json import requests @@ -16,7 +17,7 @@ NORMAL_REGEX = re.compile('^[0-9]+\.[0-9](\.[0-9])?$') # BETA_REGEX = re.compile('.*[0-9]b([0-9\-a-z]+)$') # ESR_REGEX = re.compile('^[0-9]+\.[0-9](\.[0-9])?esr$') -# +# useragents = { "versions": (), "os": ('Windows NT 10.0; WOW64', diff --git a/searx_extra/update/update_languages.py b/searxng_extra/update/update_languages.py similarity index 99% rename from searx_extra/update/update_languages.py rename to searxng_extra/update/update_languages.py index 3f8a989eb..e05dced69 100755 --- a/searx_extra/update/update_languages.py +++ b/searxng_extra/update/update_languages.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# SPDX-License-Identifier: AGPL-3.0-or-later # This script generates languages.py from intersecting each engine's supported languages. # diff --git a/searx_extra/update/update_osm_keys_tags.py b/searxng_extra/update/update_osm_keys_tags.py similarity index 99% rename from searx_extra/update/update_osm_keys_tags.py rename to searxng_extra/update/update_osm_keys_tags.py index be76dc40c..77c715ba7 100755 --- a/searx_extra/update/update_osm_keys_tags.py +++ b/searxng_extra/update/update_osm_keys_tags.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # lint: pylint -# pylint: disable=missing-function-docstring +# SPDX-License-Identifier: AGPL-3.0-or-later """Fetch OSM keys and tags. To get the i18n names, the scripts uses `Wikidata Query Service`_ instead of for diff --git a/searx_extra/update/update_pygments.py b/searxng_extra/update/update_pygments.py similarity index 97% rename from searx_extra/update/update_pygments.py rename to searxng_extra/update/update_pygments.py index de27abcce..3b1c525a5 100755 --- a/searx_extra/update/update_pygments.py +++ b/searxng_extra/update/update_pygments.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# SPDX-License-Identifier: AGPL-3.0-or-later """ Update pygments style @@ -111,7 +112,7 @@ def get_output_filename(relative_name): def get_css(cssclass, style): result = f"""/* - this file is generated automatically by searx_extra/update/update_pygments.py + this file is generated automatically by searxng_extra/update/update_pygments.py using pygments version {pygments.__version__} */\n\n""" css_text = HtmlFormatter(style=style).get_style_defs(cssclass) diff --git a/searx_extra/update/update_wikidata_units.py b/searxng_extra/update/update_wikidata_units.py similarity index 90% rename from searx_extra/update/update_wikidata_units.py rename to searxng_extra/update/update_wikidata_units.py index ddde4c135..43a872b1b 100755 --- a/searx_extra/update/update_wikidata_units.py +++ b/searxng_extra/update/update_wikidata_units.py @@ -1,4 +1,7 @@ #!/usr/bin/env python +# SPDX-License-Identifier: AGPL-3.0-or-later +# lint: pylint +# pylint: disable=missing-module-docstring import json import collections @@ -51,5 +54,5 @@ def get_wikidata_units_filename(): return join(join(searx_dir, "data"), "wikidata_units.json") -with open(get_wikidata_units_filename(), 'w') as f: +with open(get_wikidata_units_filename(), 'w', encoding="utf8") as f: json.dump(get_data(), f, indent=4, ensure_ascii=False) diff --git a/setup.py b/setup.py index 92eb8e14e..19d780359 100644 --- a/setup.py +++ b/setup.py @@ -38,7 +38,7 @@ setup( author='Adam Tauber', author_email='asciimoo@gmail.com', license='GNU Affero General Public License', - packages=find_packages(exclude=["tests*", "searx_extra"]), + packages=find_packages(exclude=["tests*", "searxng_extra"]), zip_safe=False, install_requires=requirements, extras_require={ diff --git a/tests/unit/test_standalone_searx.py b/tests/unit/test_standalone_searx.py index a5f17c08f..c81598160 100644 --- a/tests/unit/test_standalone_searx.py +++ b/tests/unit/test_standalone_searx.py @@ -8,7 +8,7 @@ from mock import Mock, patch from nose2.tools import params from searx.search import SearchQuery, EngineRef, initialize -from searx_extra import standalone_searx as sas +from searxng_extra import standalone_searx as sas from tests import SearxTestCase