This commit is contained in:
Alexandre Flament 2023-02-13 11:26:58 +01:00 committed by GitHub
commit eaad7ceb2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 108 additions and 86 deletions

8
pyproject.toml Normal file
View file

@ -0,0 +1,8 @@
[build-system]
requires = [
"setuptools>=45",
"setuptools_scm[toml]>=6.2",
"wheel",
"pyaml"
]
build-backend = "setuptools.build_meta"

View file

@ -1,22 +0,0 @@
mock==5.0.1
nose2[coverage_plugin]==0.12.0
cov-core==1.15.0
black==22.12.0
pylint==2.16.1
splinter==0.19.0
selenium==4.8.0
twine==4.0.2
Pallets-Sphinx-Themes==2.0.3
Sphinx==5.3.0
sphinx-issues==3.0.1
sphinx-jinja==2.0.2
sphinx-tabs==3.4.1
sphinxcontrib-programoutput==0.17
sphinx-autobuild==2021.3.14
sphinx-notfound-page==0.8.3
myst-parser==0.18.1
linuxdoc==20221127
aiounittest==1.4.2
yamllint==1.29.0
wlc==1.13
coloredlogs==15.0.1

View file

@ -1,18 +1,23 @@
certifi==2022.12.7
babel==2.11.0
flask-babel==3.0.1
flask==2.2.2
jinja2==3.1.2
lxml==4.9.2
pygments==2.14.0
python-dateutil==2.8.2
pyyaml==6.0
httpx[http2]==0.21.2
Brotli==1.0.9
uvloop==0.17.0
httpx-socks[asyncio]==0.7.2
setproctitle==1.3.2
redis==4.5.1
markdown-it-py==2.1.0
typing_extensions==4.4.0
fasttext-predict==0.9.2.1
-e .
mock==5.0.1
nose2[coverage_plugin]==0.12.0
cov-core==1.15.0
black==22.12.0
pylint==2.16.1
splinter==0.19.0
selenium==4.8.0
twine==4.0.2
Pallets-Sphinx-Themes==2.0.3
Sphinx==5.3.0
sphinx-issues==3.0.1
sphinx-jinja==2.0.2
sphinx-tabs==3.4.1
sphinxcontrib-programoutput==0.17
sphinx-autobuild==2021.3.14
sphinx-notfound-page==0.8.3
myst-parser==0.18.1
linuxdoc==20221127
aiounittest==1.4.2
yamllint==1.29.0
wlc==1.13
coloredlogs==15.0.1

View file

@ -11,9 +11,26 @@ import os
import logging
from base64 import b64decode
from os.path import dirname, abspath
from importlib import metadata
from searx.languages import language_codes as languages
try:
metadata = metadata.metadata('searxng')
project_urls = {}
for k, v in metadata.items():
if k == 'Project-URL':
url_type, url = v.split(',')
project_urls[url_type.strip()] = url.strip()
except metadata.PackageNotFoundError:
project_urls = {
"Code": "https://github.com/searxng/searxng",
"Documentation": 'https://docs.searxng.org/',
"Issue tracker": 'https://github.com/searxng/searxng/issues',
"New issue": 'https://github.com/searxng/searxng/issues/new',
'Public instances': 'https//searx.space',
}
searx_dir = abspath(dirname(__file__))
logger = logging.getLogger('searx')
@ -146,11 +163,10 @@ SCHEMA = {
'enable_metrics': SettingsValue(bool, True),
},
'brand': {
'issue_url': SettingsValue(str, 'https://github.com/searxng/searxng/issues'),
'new_issue_url': SettingsValue(str, 'https://github.com/searxng/searxng/issues/new'),
'docs_url': SettingsValue(str, 'https://docs.searxng.org'),
'public_instances': SettingsValue((False, str), 'https://searx.space'),
'wiki_url': SettingsValue(str, 'https://github.com/searxng/searxng/wiki'),
'issue_url': SettingsValue(str, project_urls['Issue tracker']),
'new_issue_url': SettingsValue(str, project_urls['New issue']),
'docs_url': SettingsValue(str, project_urls['Documentation']),
'public_instances': SettingsValue((False, str), project_urls['Public instances']),
},
'search': {
'safe_search': SettingsValue((0, 1, 2), 0),

View file

@ -10,8 +10,8 @@ import importlib
# fallback values
# if there is searx.version_frozen module, and it is not possible to get the git tag
VERSION_STRING = "1.0.0"
VERSION_TAG = "1.0.0"
VERSION_STRING = "2.0.0"
VERSION_TAG = "2.0.0"
GIT_URL = "unknow"
GIT_BRANCH = "unknow"
@ -67,7 +67,7 @@ def get_git_version():
subprocess_run("git diff --quiet -- . ':!searx/settings.yml' ':!utils/brand.env'")
except subprocess.CalledProcessError as e:
if e.returncode == 1:
git_version += "+dirty"
git_version += ".dirty"
else:
logger.warning('"%s" returns an unexpected return code %i', e.returncode, e.cmd)
docker_tag = git_version.replace("+", "-")
@ -76,13 +76,12 @@ def get_git_version():
try:
vf = importlib.import_module('searx.version_frozen')
VERSION_STRING, VERSION_TAG, DOCKER_TAG, GIT_URL, GIT_BRANCH = (
vf.VERSION_STRING,
vf.VERSION_TAG,
vf.DOCKER_TAG,
vf.GIT_URL,
vf.GIT_BRANCH,
)
vt = vf.version_tuple
VERSION_STRING = vf.version
VERSION_TAG = f"{vt[0]}.{vt[1]}.{vt[2]}-{vt[3].split('.')[0]}"
DOCKER_TAG = f"{vt[0]}.{vt[1]}.{vt[2]}-{vt[3]}"
GIR_URL = ""
GIT_BRANCH = ""
except ImportError:
try:
try:

View file

@ -1,31 +1,42 @@
# -*- coding: utf-8 -*-
"""Installer for SearXNG package."""
from setuptools import setup
from setuptools import find_packages
from searx.version import VERSION_TAG, GIT_URL
from searx import get_setting
from setuptools import setup, find_packages
with open('README.rst', encoding='utf-8') as f:
long_description = f.read()
with open('requirements.txt') as f:
requirements = [ l.strip() for l in f.readlines()]
with open('requirements-dev.txt') as f:
dev_requirements = [ l.strip() for l in f.readlines()]
def version_yyyymmdd_tag():
from setuptools_scm.version import ScmVersion
def custom_version_scheme(version: ScmVersion):
return f"{version.node_date.year}.{version.node_date.month}.{version.node_date.day}+{version.node}"
def custom_local_scheme(version: ScmVersion):
return '.dirty' if version.dirty else ''
# FIXME : GIT_URL and GIT_BRANCH are missing from searx/version_frozen.py
return {
'write_to': 'searx/version_frozen.py',
'version_scheme': custom_version_scheme,
'local_scheme': custom_local_scheme
}
setup(
name='searxng',
python_requires=">=3.7",
version=VERSION_TAG,
description="A privacy-respecting, hackable metasearch engine",
long_description=long_description,
url=get_setting('brand.docs_url'),
use_scm_version=version_yyyymmdd_tag,
url='https://docs.searxng.org/',
project_urls={
"Code": GIT_URL,
"Issue tracker": get_setting('brand.issue_url')
"Code": 'https://github.com/searxng/searxng',
"Documentation": 'https://docs.searxng.org/',
"Issue tracker": 'https://github.com/searxng/searxng/issues',
"New issue": 'https://github.com/searxng/searxng/issues/new',
'Public instances': 'https//searx.space',
},
classifiers=[
"Development Status :: 4 - Beta",
@ -39,24 +50,38 @@ setup(
author='SearXNG dev team',
author_email='contact@searxng.org',
license='GNU Affero General Public License',
packages=find_packages(exclude=["tests*", "searxng_extra"]),
packages=find_packages(exclude=["tests*", "searxng_extra*"]),
zip_safe=False,
install_requires=requirements,
extras_require={
'test': dev_requirements
},
install_requires=[
'certifi==2022.12.7',
'babel==2.11.0',
'flask-babel==3.0.1',
'flask==2.2.2',
'jinja2==3.1.2',
'lxml==4.9.2',
'pygments==2.14.0',
'python-dateutil==2.8.2',
'pyyaml==6.0',
'httpx[http2]==0.21.2',
'Brotli==1.0.9',
'uvloop==0.17.0',
'httpx-socks[asyncio]==0.7.2',
'setproctitle==1.3.2',
'redis==4.5.1',
'markdown-it-py==2.1.0',
'typing_extensions==4.4.0',
'fasttext-predict==0.9.2.1',
],
entry_points={
'console_scripts': [
'searx-run = searx.webapp:run',
'searx-checker = searx.search.checker.__main__:main'
'searxng = searx.webapp:run',
'searxng-checker = searx.search.checker.__main__:main'
]
},
package_data={
'searx': [
'settings.yml',
'../README.rst',
'../requirements.txt',
'../requirements-dev.txt',
'data/*',
'info/*',
'info/*/*',
@ -68,9 +93,6 @@ setup(
'static/*/*/*/*/*.*',
'templates/*/*.*',
'templates/*/*/*.*',
'tests/*',
'tests/*/*',
'tests/*/*/*',
'translations/*/*/*'
],
},

View file

@ -488,9 +488,6 @@ EOF
info_msg "install needed python packages"
tee_stderr 0.1 <<EOF | sudo -H -u "${SERVICE_USER}" -i 2>&1 | prefix_stdout "$_service_prefix"
pip install -U pip
pip install -U setuptools
pip install -U wheel
pip install -U pyyaml
cd ${SEARXNG_SRC}
pip install -e .
EOF
@ -558,9 +555,6 @@ cd ${SEARXNG_SRC}
git fetch origin "$GIT_BRANCH"
git reset --hard "origin/$GIT_BRANCH"
pip install -U pip
pip install -U setuptools
pip install -U wheel
pip install -U pyyaml
pip install -U -e .
EOF
rst_para "update instance's settings.yml from ${SEARXNG_SETTINGS_PATH}"