build_env.py 981 B

123456789101112131415161718192021222324252627282930
  1. # SPDX-License-Identifier: AGPL-3.0-or-later
  2. """build environment used by shell scripts
  3. """
  4. # set path
  5. import sys
  6. from os.path import realpath, dirname, join, sep
  7. repo_root = realpath(dirname(realpath(__file__)) + sep + '..')
  8. sys.path.insert(0, repo_root)
  9. from searx import brand
  10. name_val = [
  11. ('SEARX_URL' , brand.SEARX_URL),
  12. ('GIT_URL' , brand.GIT_URL),
  13. ('GIT_BRANCH' , brand.GIT_BRANCH),
  14. ('ISSUE_URL' , brand.ISSUE_URL),
  15. ('DOCS_URL' , brand.DOCS_URL),
  16. ('PUBLIC_INSTANCES' , brand.PUBLIC_INSTANCES),
  17. ('CONTACT_URL' , brand.CONTACT_URL),
  18. ('WIKI_URL' , brand.WIKI_URL),
  19. ('TWITTER_URL' , brand.TWITTER_URL),
  20. ]
  21. brand_env = 'utils' + sep + 'brand.env'
  22. print('build %s' % brand_env)
  23. with open(repo_root + sep + brand_env, 'w', encoding='utf-8') as f:
  24. for name, val in name_val:
  25. print("export %s='%s'" % (name, val), file=f)