| 
									
										
										
										
											2020-12-21 00:37:45 +01:00
										 |  |  | # SPDX-License-Identifier: AGPL-3.0-or-later | 
					
						
							|  |  |  | """build environment used by shell scripts
 | 
					
						
							|  |  |  | """
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # set path | 
					
						
							|  |  |  | import sys | 
					
						
							| 
									
										
										
										
											2021-01-11 22:56:15 +01:00
										 |  |  | import os | 
					
						
							|  |  |  | from os.path import realpath, dirname, join, sep, abspath | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-21 00:37:45 +01:00
										 |  |  | repo_root = realpath(dirname(realpath(__file__)) + sep + '..') | 
					
						
							|  |  |  | sys.path.insert(0, repo_root) | 
					
						
							| 
									
										
										
										
											2021-01-11 11:48:16 +01:00
										 |  |  | os.environ['SEARX_SETTINGS_PATH'] = abspath(dirname(__file__) + '/settings.yml') | 
					
						
							| 
									
										
										
										
											2020-12-21 00:37:45 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-11 22:56:15 +01:00
										 |  |  | # Under the assumption that a brand is always a fork assure that the settings | 
					
						
							|  |  |  | # file from reposetorie's working tree is used to generate the build_env, not | 
					
						
							|  |  |  | # from /etc/searx/settings.yml. | 
					
						
							|  |  |  | os.environ['SEARX_SETTINGS_PATH'] = abspath(dirname(__file__) + sep + 'settings.yml') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-27 14:39:48 +01:00
										 |  |  | from searx import brand | 
					
						
							| 
									
										
										
										
											2020-12-21 00:37:45 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | name_val = [ | 
					
						
							| 
									
										
										
										
											2020-12-27 14:39:48 +01:00
										 |  |  |     ('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), | 
					
						
							| 
									
										
										
										
											2020-12-21 00:37:45 +01:00
										 |  |  | ] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-27 14:39:48 +01:00
										 |  |  | brand_env = 'utils' + sep + 'brand.env' | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-21 00:37:45 +01:00
										 |  |  | 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) |