2019-12-18 16:11:05 +01:00
|
|
|
.. _makefile:
|
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
========
|
|
|
|
Makefile
|
|
|
|
========
|
2019-12-18 16:11:05 +01:00
|
|
|
|
2019-12-18 18:32:42 +01:00
|
|
|
.. _gnu-make: https://www.gnu.org/software/make/manual/make.html#Introduction
|
|
|
|
|
2019-12-18 16:11:05 +01:00
|
|
|
.. sidebar:: build environment
|
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
Before looking deeper at the targets, first read about :ref:`make
|
|
|
|
install`.
|
2019-12-18 16:11:05 +01:00
|
|
|
|
2020-01-08 18:09:36 +01:00
|
|
|
To install system requirements follow :ref:`buildhosts`.
|
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
All relevant build tasks are implemented in :origin:`manage.sh` and for CI or
|
|
|
|
IDE integration a small ``Makefile`` wrapper is available. If you are not
|
|
|
|
familiar with Makefiles, we recommend to read gnu-make_ introduction.
|
2019-12-18 16:11:05 +01:00
|
|
|
|
|
|
|
The usage is simple, just type ``make {target-name}`` to *build* a target.
|
2020-03-30 13:31:13 +02:00
|
|
|
Calling the ``help`` target gives a first overview (``make help``):
|
|
|
|
|
|
|
|
.. program-output:: bash -c "cd ..; make --no-print-directory help"
|
|
|
|
|
2019-12-18 16:11:05 +01:00
|
|
|
.. contents:: Contents
|
|
|
|
:depth: 2
|
|
|
|
:local:
|
|
|
|
:backlinks: entry
|
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
.. _make install:
|
2019-12-18 16:11:05 +01:00
|
|
|
|
|
|
|
Python environment
|
|
|
|
==================
|
|
|
|
|
|
|
|
.. sidebar:: activate environment
|
|
|
|
|
|
|
|
``source ./local/py3/bin/activate``
|
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
We do no longer need to build up the virtualenv manually. Jump into your git
|
|
|
|
working tree and release a ``make install`` to get a virtualenv with a
|
|
|
|
*developer install* of searx (:origin:`setup.py`). ::
|
2019-12-18 16:11:05 +01:00
|
|
|
|
|
|
|
$ cd ~/searx-clone
|
2021-04-18 12:12:03 +02:00
|
|
|
$ make install
|
|
|
|
PYENV [virtualenv] installing ./requirements*.txt into local/py3
|
2019-12-18 16:11:05 +01:00
|
|
|
...
|
2021-04-18 12:12:03 +02:00
|
|
|
PYENV OK
|
|
|
|
PYENV [install] pip install -e 'searx[test]'
|
|
|
|
...
|
|
|
|
Successfully installed argparse-1.4.0 searx
|
|
|
|
BUILDENV INFO:searx:load the default settings from ./searx/settings.yml
|
|
|
|
BUILDENV INFO:searx:Initialisation done
|
|
|
|
BUILDENV build utils/brand.env
|
2019-12-18 16:11:05 +01:00
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
If you release ``make install`` multiple times the installation will only
|
|
|
|
rebuild if the sha256 sum of the *requirement files* fails. With other words:
|
|
|
|
the check fails if you edit the requirements listed in
|
|
|
|
:origin:`requirements-dev.txt` and :origin:`requirements.txt`). ::
|
2019-12-18 16:11:05 +01:00
|
|
|
|
|
|
|
$ make install
|
2021-04-18 12:12:03 +02:00
|
|
|
PYENV OK
|
|
|
|
PYENV [virtualenv] requirements.sha256 failed
|
|
|
|
[virtualenv] - 6cea6eb6def9e14a18bf32f8a3e... ./requirements-dev.txt
|
|
|
|
[virtualenv] - 471efef6c73558e391c3adb35f4... ./requirements.txt
|
|
|
|
...
|
|
|
|
PYENV [virtualenv] installing ./requirements*.txt into local/py3
|
|
|
|
...
|
|
|
|
PYENV OK
|
|
|
|
PYENV [install] pip install -e 'searx[test]'
|
|
|
|
...
|
|
|
|
Successfully installed argparse-1.4.0 searx
|
|
|
|
BUILDENV INFO:searx:load the default settings from ./searx/settings.yml
|
|
|
|
BUILDENV INFO:searx:Initialisation done
|
|
|
|
BUILDENV build utils/brand.env
|
2019-12-18 16:11:05 +01:00
|
|
|
|
|
|
|
.. sidebar:: drop environment
|
|
|
|
|
|
|
|
To get rid of the existing environment before re-build use :ref:`clean target
|
|
|
|
<make clean>` first.
|
|
|
|
|
|
|
|
If you think, something goes wrong with your ./local environment or you change
|
2021-04-18 12:12:03 +02:00
|
|
|
the :origin:`setup.py` file, you have to call :ref:`make clean`.
|
2019-12-18 16:11:05 +01:00
|
|
|
|
|
|
|
.. _make run:
|
|
|
|
|
|
|
|
``make run``
|
|
|
|
============
|
|
|
|
|
|
|
|
To get up a running a developer instance simply call ``make run``. This enables
|
2019-12-18 18:32:42 +01:00
|
|
|
*debug* option in :origin:`searx/settings.yml`, starts a ``./searx/webapp.py``
|
|
|
|
instance, disables *debug* option again and opens the URL in your favorite WEB
|
2021-04-18 12:12:03 +02:00
|
|
|
browser (:man:`xdg-open`)::
|
2019-12-18 16:11:05 +01:00
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
$ make run
|
|
|
|
PYENV OK
|
|
|
|
SEARX_DEBUG=1 ./manage.sh pyenv.cmd python ./searx/webapp.py
|
|
|
|
...
|
|
|
|
INFO:werkzeug: * Running on http://127.0.0.1:8888/ (Press CTRL+C to quit)
|
2019-12-18 16:11:05 +01:00
|
|
|
|
|
|
|
.. _make clean:
|
|
|
|
|
|
|
|
``make clean``
|
|
|
|
==============
|
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
Drop all intermediate files, all builds, but keep sources untouched. Before
|
|
|
|
calling ``make clean`` stop all processes using :ref:`make install`. ::
|
2019-12-18 16:11:05 +01:00
|
|
|
|
|
|
|
$ make clean
|
2021-04-18 12:12:03 +02:00
|
|
|
CLEAN pyenv
|
|
|
|
PYENV [virtualenv] drop ./local/py3
|
|
|
|
CLEAN docs -- ./build/docs ./dist/docs
|
|
|
|
CLEAN locally installed npm dependencies
|
|
|
|
CLEAN test stuff
|
|
|
|
CLEAN common files
|
2019-12-18 16:11:05 +01:00
|
|
|
|
|
|
|
.. _make docs:
|
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
``make docs docs.autobuild docs.clean``
|
|
|
|
=======================================
|
2019-12-18 16:11:05 +01:00
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
We describe the usage of the ``doc.*`` targets in the :ref:`How to contribute /
|
2019-12-18 16:11:05 +01:00
|
|
|
Documentation <contrib docs>` section. If you want to edit the documentation
|
2021-04-18 12:12:03 +02:00
|
|
|
read our :ref:`make docs.live` section. If you are working in your own brand,
|
2020-12-21 00:37:45 +01:00
|
|
|
adjust your :ref:`settings global`.
|
2019-12-18 16:11:05 +01:00
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
.. _make docs.gh-pages:
|
2020-12-24 13:55:22 +01:00
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
``make docs.gh-pages``
|
|
|
|
======================
|
2020-12-24 13:55:22 +01:00
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
To deploy on github.io first adjust your :ref:`settings global`. For any
|
|
|
|
further read :ref:`deploy on github.io`.
|
2020-12-24 13:55:22 +01:00
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
.. _make test:
|
2020-12-24 13:55:22 +01:00
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
``make test``
|
|
|
|
=============
|
2020-12-24 13:55:22 +01:00
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
Runs a series of tests: :ref:`make test.pylint`, ``test.pep8``, ``test.unit``
|
|
|
|
and ``test.robot``. You can run tests selective, e.g.::
|
2020-12-24 13:55:22 +01:00
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
$ make test.pep8 test.unit test.sh
|
|
|
|
TEST test.pep8 OK
|
|
|
|
...
|
|
|
|
TEST test.unit OK
|
|
|
|
...
|
|
|
|
TEST test.sh OK
|
2020-12-24 13:55:22 +01:00
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
.. _make test.sh:
|
2020-12-24 13:55:22 +01:00
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
``make test.sh``
|
|
|
|
================
|
2020-12-24 13:55:22 +01:00
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
:ref:`sh lint` / if you have changed some bash scripting run this test before
|
|
|
|
commit.
|
2020-12-24 13:55:22 +01:00
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
.. _make test.pylint:
|
2019-12-18 16:11:05 +01:00
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
``make test.pylint``
|
|
|
|
====================
|
2019-12-18 16:11:05 +01:00
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
.. _Pylint: https://www.pylint.org/
|
2019-12-18 16:11:05 +01:00
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
Pylint_ is known as one of the best source-code, bug and quality checker for the
|
|
|
|
Python programming language. The pylint profile we use at searx project is
|
|
|
|
found in project's root folder :origin:`.pylintrc`.
|
2019-12-18 16:11:05 +01:00
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
.. _make search.checker:
|
2019-12-18 16:11:05 +01:00
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
``search.checker.{engine name}``
|
|
|
|
================================
|
2019-12-18 16:11:05 +01:00
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
To check all engines::
|
2019-12-18 16:11:05 +01:00
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
make search.checker
|
2019-12-18 16:11:05 +01:00
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
To check a engine with whitespace in the name like *google news* replace space
|
|
|
|
by underline::
|
2019-12-18 16:11:05 +01:00
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
make search.checker.google_news
|
2019-12-18 16:11:05 +01:00
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
To see HTTP requests and more use SEARX_DEBUG::
|
2019-12-18 16:11:05 +01:00
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
make SEARX_DEBUG=1 search.checker.google_news
|
|
|
|
|
|
|
|
.. _3xx: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_redirection
|
2019-12-18 16:11:05 +01:00
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
To filter out HTTP redirects (3xx_)::
|
2019-12-18 16:11:05 +01:00
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
make SEARX_DEBUG=1 search.checker.google_news | grep -A1 "HTTP/1.1\" 3[0-9][0-9]"
|
|
|
|
...
|
|
|
|
Engine google news Checking
|
|
|
|
https://news.google.com:443 "GET /search?q=life&hl=en&lr=lang_en&ie=utf8&oe=utf8&ceid=US%3Aen&gl=US HTTP/1.1" 302 0
|
|
|
|
https://news.google.com:443 "GET /search?q=life&hl=en-US&lr=lang_en&ie=utf8&oe=utf8&ceid=US:en&gl=US HTTP/1.1" 200 None
|
|
|
|
--
|
|
|
|
https://news.google.com:443 "GET /search?q=computer&hl=en&lr=lang_en&ie=utf8&oe=utf8&ceid=US%3Aen&gl=US HTTP/1.1" 302 0
|
|
|
|
https://news.google.com:443 "GET /search?q=computer&hl=en-US&lr=lang_en&ie=utf8&oe=utf8&ceid=US:en&gl=US HTTP/1.1" 200 None
|
|
|
|
--
|
2019-12-18 16:11:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
``make pybuild``
|
|
|
|
================
|
|
|
|
|
|
|
|
.. _PyPi: https://pypi.org/
|
|
|
|
.. _twine: https://twine.readthedocs.io/en/latest/
|
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
Build Python packages in ``./dist/py``::
|
2019-12-18 16:11:05 +01:00
|
|
|
|
|
|
|
$ make pybuild
|
|
|
|
...
|
|
|
|
BUILD pybuild
|
|
|
|
running sdist
|
|
|
|
running egg_info
|
|
|
|
...
|
2021-04-18 12:12:03 +02:00
|
|
|
running bdist_wheel
|
|
|
|
|
|
|
|
$ ls ./dist
|
|
|
|
searx-0.18.0-py3-none-any.whl searx-0.18.0.tar.gz
|
2019-12-18 16:11:05 +01:00
|
|
|
|
2021-04-18 12:12:03 +02:00
|
|
|
To upload packages to PyPi_, there is also a ``pypi.upload`` target (to test use
|
|
|
|
``pypi.upload.test``). Since you are not the owner of :pypi:`searx` you will
|
|
|
|
never need to upload.
|