mirror of
https://github.com/searxng/searxng.git
synced 2025-07-12 15:59:21 +02:00
[mod] get rid of searx/brand.py
Removes module searx/brand.py and creates a namespace at searx.brand. 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 <markus.heiser@darmarit.de>
This commit is contained in:
parent
9485179064
commit
9e53470b4c
5 changed files with 62 additions and 39 deletions
|
@ -8,35 +8,23 @@ from os.path import realpath, dirname, join, sep
|
|||
repo_root = realpath(dirname(realpath(__file__)) + sep + '..')
|
||||
sys.path.insert(0, repo_root)
|
||||
|
||||
from searx.settings_loader import load_settings
|
||||
|
||||
settings, settings_load_message = load_settings()
|
||||
print(settings_load_message)
|
||||
|
||||
brand_env = 'utils' + sep + 'brand.env'
|
||||
brand_py = 'searx' + sep + 'brand.py'
|
||||
|
||||
def get_val(group, name, default=''):
|
||||
return settings[group].get(name, False) or ''
|
||||
from searx import brand
|
||||
|
||||
name_val = [
|
||||
('SEARX_URL' , get_val('server', 'base_url')),
|
||||
('GIT_URL' , get_val('general','git_url')),
|
||||
('GIT_BRANCH' , get_val('general','git_branch')),
|
||||
('ISSUE_URL' , get_val('general','issue_url')),
|
||||
('DOCS_URL' , get_val('general','docs_url')),
|
||||
('PUBLIC_INSTANCES' , get_val('general','public_instances')),
|
||||
('CONTACT_URL' , get_val('general','contact_url')),
|
||||
('WIKI_URL' , get_val('general','wiki_url')),
|
||||
('TWITTER_URL' , get_val('general','twitter_url')),
|
||||
('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),
|
||||
]
|
||||
|
||||
brand_env = 'utils' + sep + 'brand.env'
|
||||
|
||||
print('build %s' % brand_env)
|
||||
with open(repo_root + sep + brand_env, 'w', encoding='utf-8') as f:
|
||||
for name, val in name_val:
|
||||
print("export %s='%s'" % (name, val), file=f)
|
||||
|
||||
print('build %s' % brand_py)
|
||||
with open(repo_root + sep + brand_py, 'w', encoding='utf-8') as f:
|
||||
for name, val in name_val:
|
||||
print("%s = '%s'" % (name, val), file=f)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue