..  _makefile: 
  
						
						
						
							
  
						
						
						
							================ 
 
						
						
						
							Makefile Targets 
 
						
						
						
							================ 
 
						
						
						
							
  
						
						
						
							..  _gnu-make:  https://www.gnu.org/software/make/manual/make.html#Introduction
  
						
						
						
							
  
						
						
						
							..  sidebar ::  build environment
  
						
						
						
							
  
						
						
						
							:ref: `makefile setup` 
  
						
						
						
							:ref: `make pyenv` .
  
						
						
						
							
  
						
						
						
							:ref: `buildhosts` .
  
						
						
						
							
  
						
						
						
							:pull: `1756`  a
  
						
						
						
							`` Makefile ``  based boilerplate was added.  If you are not familiar with
  
						
						
						
							
  
						
						
						
							
  
						
						
						
							`` make {target-name} ``  to *build*  a target.
  
						
						
						
							`` help ``  target gives a first overview (`` make help `` ):
  
						
						
						
							
  
						
						
						
							..  program-output ::  bash -c "cd ..; make --no-print-directory help"
  
						
						
						
							
  
						
						
						
							
  
						
						
						
							..  contents ::  Contents
  
						
						
						
							:depth:  2 
  
						
						
						
							:local: 
  
						
						
						
							:backlinks:  entry 
  
						
						
						
							
  
						
						
						
							
  
						
						
						
							..  _makefile setup: 
  
						
						
						
							
  
						
						
						
							Makefile setup 
 
						
						
						
							============== 
 
						
						
						
							
  
						
						
						
							..  _git stash:  https://git-scm.com/docs/git-stash
  
						
						
						
							
  
						
						
						
							..  sidebar ::  fork & upstream
  
						
						
						
							
  
						
						
						
							
  
						
						
						
							`git stash`_  is your friend.
  
						
						
						
							
  
						
						
						
							:origin: `Makefile` .
  
						
						
						
							
  
						
						
						
							..  literalinclude ::  ../../Makefile
  
						
						
						
							:start-after:  START Makefile setup 
  
						
						
						
							:end-before:  END Makefile setup 
  
						
						
						
							
  
						
						
						
							:GIT_URL:     Changes this, to point to your searx fork. 
  
						
						
						
							:GIT_BRANCH:  Changes this, to point to your searx branch. 
  
						
						
						
							:SEARX_URL:   Changes this, to point to your searx instance. 
  
						
						
						
							:DOCS_URL:    If you host your own (*brand*) documentation, change this URL. 
  
						
						
						
							
  
						
						
						
							`` make
  
						
						
						
							buildenv `` :: 
 
						
						
						
							
 
						
						
						
							   $ make buildenv 
 
						
						
						
							  build searx/brand.py
  
						
						
						
							  build utils/brand.env
  
						
						
						
							
  
						
						
						
							..  _make pyenv: 
  
						
						
						
							
  
						
						
						
							Python environment 
 
						
						
						
							================== 
 
						
						
						
							
  
						
						
						
							..  sidebar ::  activate environment
  
						
						
						
							
  
						
						
						
							`` source ./local/py3/bin/activate `` 
  
						
						
						
							
  
						
						
						
							
  
						
						
						
							:ref: `devquickstart`  guide).  Jump into your git working tree
  
						
						
						
							`` make pyenv `` :
  
						
						
						
							
  
						
						
						
							..  code ::  sh 
 
						
						
						
							
 
						
						
						
							   $ cd  ~/searx-clone
 
						
						
						
							   $ make pyenv
 
						
						
						
							   PYENV     usage: source  ./local/py3/bin/activate
 
						
						
						
							   ...
 
						
						
						
							
 
						
						
						
							With target `` pyenv ``  a development environment (aka virtualenv) was build up in
  
						
						
						
							`` ./local/py3/ `` .  To make a *developer install*  of searx (:origin: `setup.py` )
  
						
						
						
							`` install `` :
  
						
						
						
							
  
						
						
						
							..  code ::  sh 
 
						
						
						
							
 
						
						
						
							   $ make install
 
						
						
						
							   PYENV     usage: source  ./local/py3/bin/activate
 
						
						
						
							   PYENV     using virtualenv from ./local/py3
 
						
						
						
							   PYENV     install .
 
						
						
						
							
 
						
						
						
							You have never to think about intermediate targets like `` pyenv ``  or
  
						
						
						
							`` install `` , the `` Makefile ``  chains them as requisites.  Just run your main
  
						
						
						
							
  
						
						
						
							
  
						
						
						
							..  sidebar ::  drop environment
  
						
						
						
							
  
						
						
						
							
  
						
						
						
							
  
						
						
						
							
  
						
						
						
							
  
						
						
						
							:origin: `setup.py`  file (or the requirements listed in
  
						
						
						
							:origin: `requirements-dev.txt`  and :origin: `requirements.txt` ), you have to call
  
						
						
						
							:ref: `make clean` .
  
						
						
						
							
  
						
						
						
							
  
						
						
						
							..  _make run: 
  
						
						
						
							
  
						
						
						
							``make run`` 
 
						
						
						
							============ 
 
						
						
						
							
  
						
						
						
							`` make run `` .  This enables
  
						
						
						
							*debug*  option in :origin: `searx/settings.yml` , starts a `` ./searx/webapp.py `` 
  
						
						
						
							*debug*  option again and opens the URL in your favorite WEB
  
						
						
						
							:man: `xdg-open` ):
  
						
						
						
							
  
						
						
						
							..  code ::  sh 
 
						
						
						
							
 
						
						
						
							  $ make run
 
						
						
						
							  PYENV     usage: source  ./local/py3/bin/activate
 
						
						
						
							  PYENV     install .
 
						
						
						
							  ./local/py3/bin/python ./searx/webapp.py
 
						
						
						
							  ...
 
						
						
						
							  INFO:werkzeug: * Running on http://127.0.0.1:8888/ ( Press CTRL+C to quit) 
 
						
						
						
							  ...
 
						
						
						
							
 
						
						
						
							..  _make clean: 
  
						
						
						
							
  
						
						
						
							``make clean`` 
 
						
						
						
							============== 
 
						
						
						
							
  
						
						
						
							
  
						
						
						
							`` pyclean ``  which drops ./local environment.  Before calling `` make
  
						
						
						
							clean ``  stop all processes using :ref: `make pyenv` .
  
						
						
						
							
  
						
						
						
							..  code ::  sh 
 
						
						
						
							
 
						
						
						
							   $ make clean
 
						
						
						
							   CLEAN     pyclean
 
						
						
						
							   CLEAN     clean
 
						
						
						
							
 
						
						
						
							..  _make docs: 
  
						
						
						
							
  
						
						
						
							``make docs docs-live docs-clean`` 
 
						
						
						
							================================== 
 
						
						
						
							
  
						
						
						
							`` doc* ``  targets in the :ref:`How to contribute /
  
						
						
						
							
  
						
						
						
							:ref: `make docs-live`  section.  If you are working in your own brand,
  
						
						
						
							:ref: `Makefile setup <makefile setup>` .
  
						
						
						
							
  
						
						
						
							..  _make books: 
  
						
						
						
							
  
						
						
						
							``make books/{name}.html books/{name}.pdf`` 
 
						
						
						
							=========================================== 
 
						
						
						
							
  
						
						
						
							..  _intersphinx:  https://www.sphinx-doc.org/en/stable/ext/intersphinx.html
  
						
						
						
							..  _XeTeX:  https://tug.org/xetex/
  
						
						
						
							
  
						
						
						
							..  sidebar ::  info
  
						
						
						
							
  
						
						
						
							:ref: `buildhosts` .
  
						
						
						
							
  
						
						
						
							
  
						
						
						
							`` books/{name}.* ``  targets are building *books* .  A *book*  is a
  
						
						
						
							`` conf.py ``  file.  One example is the user handbook
  
						
						
						
							:origin: `docs/user/conf.py` ).  Such `` conf.py `` 
  
						
						
						
							:origin: `docs/conf.py`  and overwrite values to fit *book's* 
  
						
						
						
							
  
						
						
						
							
  
						
						
						
							:ref: `reST smart ref` ) the links to searx’ 
  
						
						
						
							
  
						
						
						
							`` DOCS_URL `` .  Take into account that URLs will be picked from the inventary at
  
						
						
						
							
  
						
						
						
							
  
						
						
						
							`` make docs-help ``  to see which books available:
  
						
						
						
							
  
						
						
						
							..  program-output ::  bash -c "cd ..; make --no-print-directory docs-help"
  
						
						
						
							:ellipsis:  0,-6 
  
						
						
						
							
  
						
						
						
							
  
						
						
						
							..  _make gh-pages: 
  
						
						
						
							
  
						
						
						
							``make gh-pages`` 
 
						
						
						
							================= 
 
						
						
						
							
  
						
						
						
							
  
						
						
						
							`.  For any further read :ref:` 
  
						
						
						
							
  
						
						
						
							..  _make test: 
  
						
						
						
							
  
						
						
						
							``make test`` 
 
						
						
						
							============= 
 
						
						
						
							
  
						
						
						
							`` test.pep8 `` , `` test.unit `` , `` test.robot ``  and does
  
						
						
						
							:ref: `pylint checks <make pylint>` .  You can run tests selective,
  
						
						
						
							
  
						
						
						
							
  
						
						
						
							..  code ::  sh 
 
						
						
						
							
 
						
						
						
							  $ make test.pep8 test.unit test.sh
 
						
						
						
							  . ./local/py3/bin/activate;  ./manage.sh pep8_check
 
						
						
						
							  [ !]  Running pep8 check
 
						
						
						
							  . ./local/py3/bin/activate;  ./manage.sh unit_tests
 
						
						
						
							  [ !]  Running unit tests
 
						
						
						
							
 
						
						
						
							..  _make pylint: 
  
						
						
						
							
  
						
						
						
							``make pylint`` 
 
						
						
						
							=============== 
 
						
						
						
							
  
						
						
						
							..  _Pylint:  https://www.pylint.org/
  
						
						
						
							
  
						
						
						
							
  
						
						
						
							
  
						
						
						
							
  
						
						
						
							:ref: `test.pep8 <make test>`  it is), but Pylint_ can help to improve code
  
						
						
						
							
  
						
						
						
							:origin: `.pylintrc` .
  
						
						
						
							
  
						
						
						
							
  
						
						
						
							
  
						
						
						
							
  
						
						
						
							
  
						
						
						
							
  
						
						
						
							
  
						
						
						
							
  
						
						
						
							``make pybuild`` 
 
						
						
						
							================ 
 
						
						
						
							
  
						
						
						
							..  _PyPi:  https://pypi.org/
  
						
						
						
							..  _twine:  https://twine.readthedocs.io/en/latest/
  
						
						
						
							
  
						
						
						
							`` ./dist/py `` .
  
						
						
						
							
  
						
						
						
							..  code ::  sh 
 
						
						
						
							
 
						
						
						
							  $ make pybuild
 
						
						
						
							  ...
 
						
						
						
							  BUILD     pybuild
 
						
						
						
							  running sdist
 
						
						
						
							  running egg_info
 
						
						
						
							  ...
 
						
						
						
							  $ ls  ./dist/py/
 
						
						
						
							  searx-0.15.0-py3-none-any.whl  searx-0.15.0.tar.gz
 
						
						
						
							
 
						
						
						
							To upload packages to PyPi_, there is also a `` upload-pypi ``  target.  It needs
  
						
						
						
							:pypi: `searx`  you will