From 3e50e8de3e669972da194b3d416f7913e75da9f4 Mon Sep 17 00:00:00 2001
From: Markus Heiser
Date: Sat, 17 Jul 2021 19:03:54 +0200
Subject: [PATCH 1/7] [mod] drop usage of the searx.brand namespace (python
procs)
Added function searx.get_setting(name, default=_unset):
Returns the value to which ``name`` point. If there is no such name in the
settings and the ``default`` is unset, a KeyError exception is raised.
In all the python processes ..
- make docs
- make buildenv
- make install (setup.py)
the usage of the 'brand.*' name space is replaced by 'searx.get_setting'
function.
- brand.SEARX_URL --> get_setting('server.base_url')
- brand.GIT_URL --> get_setting('brand.git_url')
- brand.GIT_BRANCH' --> get_setting('server.base_url')
- brand.ISSUE_URL --> get_setting('brand.issue_url')
- brand.DOCS_URL --> get_setting('brand.docs_url')
- brand.PUBLIC_INSTANCES --> get_setting('brand.public_instances')
- brand.CONTACT_URL --> get_setting('general.contact_url', '')
- brand.WIKI_URL --> get_setting('brand.wiki_url')
- brand.TWITTER_URL --> get_setting('brand.twitter_url', '')
Signed-off-by: Markus Heiser
---
docs/conf.py | 41 +++++++++++--------
searx/__init__.py | 21 ++++++++++
setup.py | 8 ++--
utils/build_env.py | 28 ++++++++-----
.../etc/searx/use_default_settings.yml | 2 +-
5 files changed, 68 insertions(+), 32 deletions(-)
diff --git a/docs/conf.py b/docs/conf.py
index 09cc2287..04c8aa20 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -4,7 +4,7 @@
import sys, os
from pallets_sphinx_themes import ProjectLink
-from searx import brand
+from searx import get_setting
from searx.version import VERSION_STRING
# Project --------------------------------------------------------------
@@ -14,6 +14,15 @@ copyright = u'2015-2020, Adam Tauber, Noémi Ványi'
author = u'Adam Tauber'
release, version = VERSION_STRING, VERSION_STRING
+SEARX_URL = get_setting('server.base_url') or 'https://example.org/searx'
+GIT_URL = get_setting('brand.git_url')
+GIT_BRANCH = get_setting('brand.git_branch')
+ISSUE_URL = get_setting('brand.issue_url')
+DOCS_URL = get_setting('brand.docs_url')
+PUBLIC_INSTANCES = get_setting('brand.public_instances')
+CONTACT_URL = get_setting('general.contact_url')
+WIKI_URL = get_setting('brand.wiki_url')
+
# hint: sphinx.ext.viewcode won't highlight when 'highlight_language' [1] is set
# to string 'none' [2]
#
@@ -49,10 +58,10 @@ extlinks['pull'] = ('https://github.com/searxng/searxng/pull/%s', 'PR ')
extlinks['pull-searx'] = ('https://github.com/searx/searx/pull/%s', 'PR ')
# links to custom brand
-extlinks['origin'] = (brand.GIT_URL + '/blob/' + brand.GIT_BRANCH + '/%s', 'git://')
-extlinks['patch'] = (brand.GIT_URL + '/commit/%s', '#')
-extlinks['search'] = (brand.SEARX_URL + '/%s', '#')
-extlinks['docs'] = (brand.DOCS_URL + '/%s', 'docs: ')
+extlinks['origin'] = (GIT_URL + '/blob/' + GIT_BRANCH + '/%s', 'git://')
+extlinks['patch'] = (GIT_URL + '/commit/%s', '#')
+extlinks['search'] = (SEARX_URL + '/%s', '#')
+extlinks['docs'] = (DOCS_URL + '/%s', 'docs: ')
extlinks['pypi'] = ('https://pypi.org/project/%s', 'PyPi: ')
extlinks['man'] = ('https://manpages.debian.org/jump?q=%s', '')
#extlinks['role'] = (
@@ -108,18 +117,16 @@ imgmath_font_size = 14
html_theme_options = {"index_sidebar_logo": True}
html_context = {"project_links": [] }
-if brand.GIT_URL:
- html_context["project_links"].append(ProjectLink("Source", brand.GIT_URL))
-if brand.WIKI_URL:
- html_context["project_links"].append(ProjectLink("Wiki", brand.WIKI_URL))
-if brand.PUBLIC_INSTANCES:
- html_context["project_links"].append(ProjectLink("Public instances", brand.PUBLIC_INSTANCES))
-if brand.TWITTER_URL:
- html_context["project_links"].append(ProjectLink("Twitter", brand.TWITTER_URL))
-if brand.ISSUE_URL:
- html_context["project_links"].append(ProjectLink("Issue Tracker", brand.ISSUE_URL))
-if brand.CONTACT_URL:
- html_context["project_links"].append(ProjectLink("Contact", brand.CONTACT_URL))
+html_context["project_links"].append(ProjectLink("Source", GIT_URL + '/tree/' + GIT_BRANCH))
+
+if WIKI_URL:
+ html_context["project_links"].append(ProjectLink("Wiki", WIKI_URL))
+if PUBLIC_INSTANCES:
+ html_context["project_links"].append(ProjectLink("Public instances", PUBLIC_INSTANCES))
+if ISSUE_URL:
+ html_context["project_links"].append(ProjectLink("Issue Tracker", ISSUE_URL))
+if CONTACT_URL:
+ html_context["project_links"].append(ProjectLink("Contact", CONTACT_URL))
html_sidebars = {
"**": ["project.html", "relations.html", "searchbox.html"],
diff --git a/searx/__init__.py b/searx/__init__.py
index 8452dd7b..55f6bb46 100644
--- a/searx/__init__.py
+++ b/searx/__init__.py
@@ -32,6 +32,27 @@ if max_request_timeout is None:
else:
logger.info('max_request_timeout=%i second(s)', max_request_timeout)
+_unset = object()
+
+def get_setting(name, default=_unset):
+ """Returns the value to which ``name`` point. If there is no such name in the
+ settings and the ``default`` is unset, a :py:obj:`KeyError` is raised.
+
+ """
+ value = settings
+ for a in name.split('.'):
+ if isinstance(value, dict):
+ value = value.get(a, _unset)
+ else:
+ value = _unset
+
+ if value is _unset:
+ if default is _unset:
+ raise KeyError(name)
+ value = default
+ break
+
+ return value
class _brand_namespace: # pylint: disable=invalid-name
diff --git a/setup.py b/setup.py
index 61227d19..b320524d 100644
--- a/setup.py
+++ b/setup.py
@@ -8,7 +8,7 @@ import os
import sys
from searx.version import VERSION_STRING
-from searx import brand
+from searx import get_setting
with open('README.rst', encoding='utf-8') as f:
long_description = f.read()
@@ -24,10 +24,10 @@ setup(
version=VERSION_STRING,
description="A privacy-respecting, hackable metasearch engine",
long_description=long_description,
- url=brand.DOCS_URL,
+ url=get_setting('brand.docs_url'),
project_urls={
- "Code": brand.GIT_URL,
- "Issue tracker": brand.ISSUE_URL
+ "Code": get_setting('brand.git_url'),
+ "Issue tracker": get_setting('brand.issue_url')
},
classifiers=[
"Development Status :: 4 - Beta",
diff --git a/utils/build_env.py b/utils/build_env.py
index ffb2689e..58d58d56 100644
--- a/utils/build_env.py
+++ b/utils/build_env.py
@@ -16,18 +16,26 @@ os.environ['SEARX_SETTINGS_PATH'] = abspath(dirname(__file__) + '/settings.yml')
# from /etc/searx/settings.yml.
os.environ['SEARX_SETTINGS_PATH'] = abspath(dirname(__file__) + sep + 'settings.yml')
-from searx import brand
+from searx import get_setting
+
+def _env(*arg, **kwargs):
+ val = get_setting(*arg, **kwargs)
+ if val is True:
+ val = '1'
+ elif val is False:
+ val = ''
+ return val
name_val = [
- ('SEARX_URL' , brand.SEARX_URL),
- ('GIT_URL' , brand.GIT_URL),
- ('GIT_BRANCH' , brand.GIT_BRANCH),
- ('ISSUE_URL' , brand.ISSUE_URL),
- ('DOCS_URL' , brand.DOCS_URL),
- ('PUBLIC_INSTANCES' , brand.PUBLIC_INSTANCES),
- ('CONTACT_URL' , brand.CONTACT_URL),
- ('WIKI_URL' , brand.WIKI_URL),
- ('TWITTER_URL' , brand.TWITTER_URL),
+ ('SEARX_URL' , _env('server.base_url','')),
+ ('GIT_URL' , _env('brand.git_url', '')),
+ ('GIT_BRANCH' , _env('brand.git_branch', '')),
+ ('ISSUE_URL' , _env('brand.issue_url', '')),
+ ('DOCS_URL' , _env('brand.docs_url', '')),
+ ('PUBLIC_INSTANCES' , _env('brand.public_instances', '')),
+ ('CONTACT_URL' , _env('general.contact_url', '')),
+ ('WIKI_URL' , _env('brand.wiki_url', '')),
+ ('TWITTER_URL' , _env('brand.twitter_url', '')),
]
brand_env = 'utils' + sep + 'brand.env'
diff --git a/utils/templates/etc/searx/use_default_settings.yml b/utils/templates/etc/searx/use_default_settings.yml
index f805373f..1e7530cd 100644
--- a/utils/templates/etc/searx/use_default_settings.yml
+++ b/utils/templates/etc/searx/use_default_settings.yml
@@ -25,7 +25,7 @@ server:
secret_key: "ultrasecretkey" # change this!
# Set custom base_url. Possible values:
# false or "https://your.custom.host/location/"
- base_url: https://darmarit.org/searx
+ # base_url: https://example.org/searx
# Proxying image results through searx
image_proxy: false
From 2a2b6c4d57958dd60cc59c80e5669d41b714c701 Mon Sep 17 00:00:00 2001
From: Markus Heiser
Date: Sat, 17 Jul 2021 19:34:18 +0200
Subject: [PATCH 2/7] [fix] add missing brand options to the settings SCHEMA
Signed-off-by: Markus Heiser
---
searx/settings_defaults.py | 8 ++++++++
searx/settings_robot.yml | 9 +++++++++
2 files changed, 17 insertions(+)
diff --git a/searx/settings_defaults.py b/searx/settings_defaults.py
index 8350d92b..05df3344 100644
--- a/searx/settings_defaults.py
+++ b/searx/settings_defaults.py
@@ -130,6 +130,14 @@ SCHEMA = {
'contact_url': SettingsValue((None, False, str), None),
},
'brand': {
+ 'git_url': SettingsValue(str),
+ 'git_branch': SettingsValue(str),
+ 'issue_url': SettingsValue(str, None),
+ 'new_issue_url': SettingsValue(str, None),
+ 'docs_url': SettingsValue(str, None),
+ 'public_instances': SettingsValue(str, None),
+ 'wiki_url': SettingsValue(str, None),
+ 'twitter_url': SettingsValue(str, None),
},
'search': {
'safe_search': SettingsValue((0,1,2), 0),
diff --git a/searx/settings_robot.yml b/searx/settings_robot.yml
index 00dcb8da..ca65449f 100644
--- a/searx/settings_robot.yml
+++ b/searx/settings_robot.yml
@@ -2,6 +2,15 @@ general:
debug: false
instance_name: "searx_test"
+brand:
+ git_url: https://github.com/searxng/searxng
+ git_branch: master
+ issue_url: https://github.com/searxng/searxng/issues
+ new_issue_url: https://github.com/searxng/searxng/issues/new
+ docs_url: https://searxng.github.io/searxng
+ public_instances: https://searx.space
+ wiki_url: https://github.com/searxng/searxng/wiki
+
search:
language: "all"
From c9220de690f0081777cf43acb547f2b3818fd8fe Mon Sep 17 00:00:00 2001
From: Markus Heiser
Date: Sat, 17 Jul 2021 19:37:22 +0200
Subject: [PATCH 3/7] [mod] drop unused setting option brand:twitter_url
Signed-off-by: Markus Heiser
---
docs/admin/engines/settings.rst | 3 ---
searx/__init__.py | 5 -----
searx/settings_defaults.py | 1 -
utils/brand.env | 1 -
utils/build_env.py | 1 -
5 files changed, 11 deletions(-)
diff --git a/docs/admin/engines/settings.rst b/docs/admin/engines/settings.rst
index 1fe083a9..7335b9a2 100644
--- a/docs/admin/engines/settings.rst
+++ b/docs/admin/engines/settings.rst
@@ -73,9 +73,6 @@ Global Settings
``wiki_url``:
Link to your wiki (or ``false``)
-``twitter_url``:
- Link to your tweets (or ``false``)
-
``server:``
-----------
diff --git a/searx/__init__.py b/searx/__init__.py
index 55f6bb46..2b6a8412 100644
--- a/searx/__init__.py
+++ b/searx/__init__.py
@@ -96,9 +96,4 @@ class _brand_namespace: # pylint: disable=invalid-name
def WIKI_URL(self):
return self.get_val('brand', 'wiki_url')
- @property
- def TWITTER_URL(self):
- return self.get_val('brand', 'twitter_url')
-
-
brand = _brand_namespace()
diff --git a/searx/settings_defaults.py b/searx/settings_defaults.py
index 05df3344..d034cb1c 100644
--- a/searx/settings_defaults.py
+++ b/searx/settings_defaults.py
@@ -137,7 +137,6 @@ SCHEMA = {
'docs_url': SettingsValue(str, None),
'public_instances': SettingsValue(str, None),
'wiki_url': SettingsValue(str, None),
- 'twitter_url': SettingsValue(str, None),
},
'search': {
'safe_search': SettingsValue((0,1,2), 0),
diff --git a/utils/brand.env b/utils/brand.env
index 9cc52051..e0c670a0 100644
--- a/utils/brand.env
+++ b/utils/brand.env
@@ -6,4 +6,3 @@ export DOCS_URL='https://searxng.github.io/searxng'
export PUBLIC_INSTANCES='https://searx.space'
export CONTACT_URL=''
export WIKI_URL='https://github.com/searxng/searxng/wiki'
-export TWITTER_URL=''
diff --git a/utils/build_env.py b/utils/build_env.py
index 58d58d56..c52111e8 100644
--- a/utils/build_env.py
+++ b/utils/build_env.py
@@ -35,7 +35,6 @@ name_val = [
('PUBLIC_INSTANCES' , _env('brand.public_instances', '')),
('CONTACT_URL' , _env('general.contact_url', '')),
('WIKI_URL' , _env('brand.wiki_url', '')),
- ('TWITTER_URL' , _env('brand.twitter_url', '')),
]
brand_env = 'utils' + sep + 'brand.env'
From 3f638ed196cdd98d933d6e70dffe374e2d2456dc Mon Sep 17 00:00:00 2001
From: Markus Heiser
Date: Sun, 18 Jul 2021 15:38:52 +0200
Subject: [PATCH 4/7] [mod] drop usage of the searx.brand namespace (templates
& /config)
In the templates and the /config (JSON) the usage of the 'brand.*' name
space is replaced by 'searx.get_setting' function.
- new_issue_url --> get_setting('brand.new_issue_url')
- brand.GIT_URL --> get_setting('brand.git_url')
- brand.PUBLIC_INSTANCES --> get_setting('brand.public_instances')
- brand.DOCS_URL --> get_setting('brand.docs_url')
- brand.ISSUE_URL --> get_setting('brand.issue_url')
- brand.CONTACT_URL --> get_setting('general.contact_url', '')
The macro 'new_issue' from searx/templates/*/messages/no_results.html
is now imported with context::
{% from '__common__/new_issue.html' import new_issue with context %}
To get *public instances URL* from context's 'get_setting()' function::
get_setting('brand.public_instances','')
Macro's prototype does no longer need the 'new_issue_url' argument and has been
changed to::
macro new_issue(engine_name, engine_reliability)
Signed-off-by: Markus Heiser
---
searx/templates/__common__/about.html | 14 ++++++++------
searx/templates/__common__/new_issue.html | 6 +++---
searx/templates/oscar/base.html | 10 +++++-----
searx/templates/oscar/messages/no_results.html | 2 +-
searx/templates/oscar/stats.html | 4 ++--
searx/templates/simple/base.html | 8 ++++----
searx/templates/simple/messages/no_results.html | 2 +-
searx/templates/simple/stats.html | 4 ++--
searx/webapp.py | 14 ++++++--------
9 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/searx/templates/__common__/about.html b/searx/templates/__common__/about.html
index 72c7b133..96ebab28 100644
--- a/searx/templates/__common__/about.html
+++ b/searx/templates/__common__/about.html
@@ -11,7 +11,7 @@
More about SearXNG ...
@@ -30,7 +30,8 @@
SearXNG is free software, the code is 100% open and you can help to make
- it better. See more on github.
+ it better. See more on SearXNG sources.
@@ -80,10 +81,11 @@
SearXNG appreciates your concern regarding logs, so take the code from
- the SearXNG project and run it yourself!
+ the SearXNG project and
+ run it yourself!
- Add your instance to this list of
+ Add your instance to this list of
public instances to help other people reclaim their privacy and make the
Internet freer! The more decentralized the Internet is, the more freedom we
have!
@@ -92,8 +94,8 @@
Where are the docs & code of this instance?
- See the {{ brand.DOCS_URL }}
- and {{ brand.GIT_URL }}
+ See the SearXNG docs
+ and SearXNG sources
diff --git a/searx/templates/__common__/new_issue.html b/searx/templates/__common__/new_issue.html
index 1b28804a..c741a049 100644
--- a/searx/templates/__common__/new_issue.html
+++ b/searx/templates/__common__/new_issue.html
@@ -1,5 +1,5 @@
-{% macro new_issue(new_issue_url, engine_name, engine_reliability) %}
-
{% endmacro %}
diff --git a/searx/templates/oscar/base.html b/searx/templates/oscar/base.html
index b85f69fa..cc716e62 100644
--- a/searx/templates/oscar/base.html
+++ b/searx/templates/oscar/base.html
@@ -82,11 +82,11 @@
{% endblock %}
- {{ _('Powered by') }} searxng - {{ searx_version }} - {{ _('a privacy-respecting, hackable metasearch engine') }}
- {{ _('Source code') }} |
- {{ _('Issue tracker') }} |
- {{ _('Public instances') }}{% if brand.CONTACT_URL %} |
- {{ _('Contact instance maintainer') }}{% endif %}
+ {{ _('Powered by') }} SearXNG - {{ searx_version }} - {{ _('a privacy-respecting, hackable metasearch engine') }}
+ {{ _('Source code') }} |
+ {{ _('Issue tracker') }} |
+ {{ _('Public instances') }}{% if get_setting('general.contact_url') %} |
+ {{ _('Contact instance maintainer') }}{% endif %}
diff --git a/searx/templates/oscar/messages/no_results.html b/searx/templates/oscar/messages/no_results.html
index 7ad6423c..fe8e39d3 100644
--- a/searx/templates/oscar/messages/no_results.html
+++ b/searx/templates/oscar/messages/no_results.html
@@ -10,7 +10,7 @@
){{- '' -}}
{%- endfor -%}
- {{ _('Please, try again later or find another searx instance.') }} ({{ _('Public instances') }})
+ {{ _('Please, try again later or find another searx instance.') }} ({{ _('Public instances') }})
{% else %}
diff --git a/searx/templates/oscar/stats.html b/searx/templates/oscar/stats.html
index d9b2ab68..4be8043f 100644
--- a/searx/templates/oscar/stats.html
+++ b/searx/templates/oscar/stats.html
@@ -1,5 +1,5 @@
{% extends 'oscar/base.html' %}
-{% from '__common__/new_issue.html' import new_issue %}
+{% from '__common__/new_issue.html' import new_issue with context %}
{% block title %}{{ _('stats') }} - {% if selected_engine_name %} {{ selected_engine_name }} - {% endif %}{% endblock %}
@@ -148,7 +148,7 @@
{% endfor %}
{% endif %}
- {{ new_issue(brand.NEW_ISSUE_URL, selected_engine_name, engine_reliabilities[selected_engine_name]) }}
+ {{ new_issue(selected_engine_name, engine_reliabilities[selected_engine_name]) }}
{% endif %}
diff --git a/searx/templates/simple/base.html b/searx/templates/simple/base.html
index 50cea045..edf0eb6e 100644
--- a/searx/templates/simple/base.html
+++ b/searx/templates/simple/base.html
@@ -51,10 +51,10 @@
diff --git a/searx/templates/simple/messages/no_results.html b/searx/templates/simple/messages/no_results.html
index b7f02167..845f3e21 100644
--- a/searx/templates/simple/messages/no_results.html
+++ b/searx/templates/simple/messages/no_results.html
@@ -11,7 +11,7 @@
{%- endfor %}
- {{ _('Please, try again later or find another searx instance.') }} ({{ _('Public instances') }})
+ {{ _('Please, try again later or find another searx instance.') }} ({{ _('Public instances') }})
{% else %}
diff --git a/searx/templates/simple/stats.html b/searx/templates/simple/stats.html
index 7058d04d..f423b686 100644
--- a/searx/templates/simple/stats.html
+++ b/searx/templates/simple/stats.html
@@ -1,5 +1,5 @@
{% from 'simple/macros.html' import icon %}
-{% from '__common__/new_issue.html' import new_issue %}
+{% from '__common__/new_issue.html' import new_issue with context %}
{% extends "simple/base.html" %}
@@ -147,7 +147,7 @@
{% endfor %}
{% endif %}
- {{ new_issue(brand.NEW_ISSUE_URL, selected_engine_name, engine_reliabilities[selected_engine_name]) }}
+ {{ new_issue(selected_engine_name, engine_reliabilities[selected_engine_name]) }}
{% endif %}
diff --git a/searx/webapp.py b/searx/webapp.py
index 4d838062..09c0643b 100755
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -50,7 +50,7 @@ from flask_babel import (
)
from searx import logger
-from searx import brand
+from searx import get_setting
from searx import (
settings,
searx_debug,
@@ -473,11 +473,9 @@ def render(template_name, override_theme=None, **kwargs):
kwargs['search_formats'] = [
x for x in settings['search']['formats'] if x != 'html'
]
-
- # brand
- kwargs['instance_name'] = settings['general']['instance_name']
+ kwargs['instance_name'] = get_setting('general.instance_name')
kwargs['searx_version'] = VERSION_STRING
- kwargs['brand'] = brand
+ kwargs['get_setting'] = get_setting
# helpers to create links to other pages
kwargs['url_for'] = url_for_theme # override url_for function in templates
@@ -1323,9 +1321,9 @@ def config():
'default_theme': settings['ui']['default_theme'],
'version': VERSION_STRING,
'brand': {
- 'CONTACT_URL': brand.CONTACT_URL,
- 'GIT_URL': brand.GIT_URL,
- 'DOCS_URL': brand.DOCS_URL
+ 'CONTACT_URL': get_setting('general.contact_url'),
+ 'GIT_URL': get_setting('brand.git_url'),
+ 'DOCS_URL': get_setting('brand.docs_url'),
},
'doi_resolvers': list(settings['doi_resolvers'].keys()),
'default_doi_resolver': settings['default_doi_resolver'],
From 6fbf5180bf17b563c0ef9552ab6aaaf48bc375ae Mon Sep 17 00:00:00 2001
From: Markus Heiser
Date: Sun, 18 Jul 2021 17:26:56 +0200
Subject: [PATCH 5/7] [mod] drop obsolete searx.brand namespace
The usages of the searx.brand namespace has been removed, the searx.brand
namespace is now longer needed.
The searx.brand namespace was an interim solution which has been added in commit
9e53470b4, see commit message there ...
This patch is a first 'proof of concept'. Later we can decide to remove the
brand namespace entirely or not.
Signed-off-by: Markus Heiser
---
searx/__init__.py | 44 --------------------------------------------
1 file changed, 44 deletions(-)
diff --git a/searx/__init__.py b/searx/__init__.py
index 2b6a8412..0b73d520 100644
--- a/searx/__init__.py
+++ b/searx/__init__.py
@@ -53,47 +53,3 @@ def get_setting(name, default=_unset):
break
return value
-
-class _brand_namespace: # pylint: disable=invalid-name
-
- @classmethod
- def get_val(cls, group, name, default=''):
- return settings.get(group, {}).get(name) or default
-
- @property
- def SEARX_URL(self):
- return self.get_val('server', 'base_url')
-
- @property
- def CONTACT_URL(self):
- return self.get_val('general', 'contact_url')
-
- @property
- def GIT_URL(self):
- return self.get_val('brand', 'git_url')
-
- @property
- def GIT_BRANCH(self):
- return self.get_val('brand', 'git_branch')
-
- @property
- def ISSUE_URL(self):
- return self.get_val('brand', 'issue_url')
-
- @property
- def NEW_ISSUE_URL(self):
- return self.get_val('brand', 'new_issue_url')
-
- @property
- def DOCS_URL(self):
- return self.get_val('brand', 'docs_url')
-
- @property
- def PUBLIC_INSTANCES(self):
- return self.get_val('brand', 'public_instances')
-
- @property
- def WIKI_URL(self):
- return self.get_val('brand', 'wiki_url')
-
-brand = _brand_namespace()
From 51c06722c3c33338f62f237920be08c46b77999a Mon Sep 17 00:00:00 2001
From: Markus Heiser
Date: Sun, 18 Jul 2021 16:31:04 +0200
Subject: [PATCH 6/7] [mod] ./manage docker.buildx make variables local
The environment variables ..
- SEARX_GIT_VERSION
- VERSION_GITCOMMIT
- SEARX_PYTHON_VERSION
- GITHUB_USER
- SEARX_IMAGE_NAME
- BUILD
are local to the docker.buildx() function, other variables like GIT_URL are
comming from the utils/brand.env file (rebuild by: make buildenv).
Signed-off-by: Markus Heiser
---
manage | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/manage b/manage
index 6cf562b2..f0334383 100755
--- a/manage
+++ b/manage
@@ -177,6 +177,13 @@ docker.buildx() {
docker.build() {
pyenv.install
+ local SEARX_GIT_VERSION
+ local VERSION_GITCOMMIT
+ local SEARX_PYTHON_VERSION
+ local GITHUB_USER
+ local SEARX_IMAGE_NAME
+ local BUILD
+
build_msg DOCKER build
# run installation in a subprocess and activate pyenv
From 19abaf272def8faee5e7d3652d95413c3256d638 Mon Sep 17 00:00:00 2001
From: Markus Heiser
Date: Sun, 18 Jul 2021 17:20:37 +0200
Subject: [PATCH 7/7] [mod] make pyenv.OK() less verbose when pyenv is OK
Prompt the verbose messages ...
PYENV [check] import yaml --> OK
PYENV OK
only when environment $VERBOSE is active.
Signed-off-by: Markus Heiser
---
utils/lib.sh | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/utils/lib.sh b/utils/lib.sh
index 014d4a74..d2f5b757 100755
--- a/utils/lib.sh
+++ b/utils/lib.sh
@@ -606,9 +606,13 @@ pyenv.OK() {
return 1
fi
- pyenv.check \
- | "${PY_ENV_BIN}/python" 2>&1 \
- | prefix_stdout "${_Blue}PYENV ${_creset}[check] "
+ if [ "$VERBOSE" = "1" ]; then
+ pyenv.check \
+ | "${PY_ENV_BIN}/python" 2>&1 \
+ | prefix_stdout "${_Blue}PYENV ${_creset}[check] "
+ else
+ pyenv.check | "${PY_ENV_BIN}/python" 1>/dev/null
+ fi
local err=${PIPESTATUS[1]}
if [ "$err" -ne "0" ]; then
@@ -616,7 +620,7 @@ pyenv.OK() {
return "$err"
fi
- build_msg PYENV "OK"
+ [ "$VERBOSE" = "1" ] && build_msg PYENV "OK"
_pyenv_OK="OK"
return 0
}