|
1 | 1 | # -*- coding: utf-8 -*- |
2 | 2 | """Installer for Searx package.""" |
3 | 3 |
|
4 | | -from setuptools import setup |
5 | | -from setuptools import find_packages |
6 | | - |
7 | 4 | import os |
8 | 5 | import sys |
9 | 6 |
|
10 | | -from searx.version import VERSION_STRING |
11 | | -from searx import brand |
| 7 | +from setuptools import find_packages, setup |
| 8 | + |
| 9 | + |
| 10 | +version_ns = {} |
| 11 | +with open(os.path.join('searx', 'version.py')) as f: |
| 12 | + exec(f.read(), version_ns) |
| 13 | +VERSION_STRING = version_ns.get('VERSION_STRING', '') |
| 14 | + |
| 15 | +brand = {} |
| 16 | +with open(os.path.join('utils', 'brand.env')) as f: |
| 17 | + for line in f: |
| 18 | + line = line.strip() |
| 19 | + |
| 20 | + if not line or line.startswith('#'): |
| 21 | + continue |
| 22 | + |
| 23 | + if line.startswith('export '): |
| 24 | + line = line[len('export '):] |
| 25 | + |
| 26 | + if '=' in line: |
| 27 | + key, val = line.split('=', 1) |
| 28 | + key = key.strip() |
| 29 | + val = val.strip().strip("'").strip('"') |
| 30 | + brand[key] = val |
12 | 31 |
|
13 | 32 | with open('README.rst', encoding='utf-8') as f: |
14 | 33 | long_description = f.read() |
|
24 | 43 | version=VERSION_STRING, |
25 | 44 | description="A privacy-respecting, hackable metasearch engine", |
26 | 45 | long_description=long_description, |
27 | | - url=brand.DOCS_URL, |
| 46 | + url=brand.get("DOCS_URL", ""), |
28 | 47 | project_urls={ |
29 | | - "Code": brand.GIT_URL, |
30 | | - "Issue tracker": brand.ISSUE_URL |
| 48 | + "Code": brand.get("GIT_URL", ""), |
| 49 | + "Issue tracker": brand.get("ISSUE_URL", ""), |
31 | 50 | }, |
32 | 51 | classifiers=[ |
33 | 52 | "Development Status :: 4 - Beta", |
|
0 commit comments