makefile.html 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <title>Makefile &#8212; Searx Documentation (Searx-1.1.0.tex)</title>
  8. <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
  9. <link rel="stylesheet" type="text/css" href="../_static/searx.css" />
  10. <link rel="stylesheet" type="text/css" href="../_static/tabs.css" />
  11. <script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
  12. <script src="../_static/jquery.js"></script>
  13. <script src="../_static/underscore.js"></script>
  14. <script src="../_static/_sphinx_javascript_frameworks_compat.js"></script>
  15. <script src="../_static/doctools.js"></script>
  16. <script src="../_static/sphinx_highlight.js"></script>
  17. <link rel="index" title="Index" href="../genindex.html" />
  18. <link rel="search" title="Search" href="../search.html" />
  19. <link rel="next" title="reST primer" href="reST.html" />
  20. <link rel="prev" title="Translation" href="translation.html" />
  21. </head><body>
  22. <div class="related" role="navigation" aria-label="related navigation">
  23. <h3>Navigation</h3>
  24. <ul>
  25. <li class="right" style="margin-right: 10px">
  26. <a href="../genindex.html" title="General Index"
  27. accesskey="I">index</a></li>
  28. <li class="right" >
  29. <a href="../py-modindex.html" title="Python Module Index"
  30. >modules</a> |</li>
  31. <li class="right" >
  32. <a href="reST.html" title="reST primer"
  33. accesskey="N">next</a> |</li>
  34. <li class="right" >
  35. <a href="translation.html" title="Translation"
  36. accesskey="P">previous</a> |</li>
  37. <li class="nav-item nav-item-0"><a href="../index.html">Searx Documentation (Searx-1.1.0.tex)</a> &#187;</li>
  38. <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Developer documentation</a> &#187;</li>
  39. <li class="nav-item nav-item-this"><a href="">Makefile</a></li>
  40. </ul>
  41. </div>
  42. <div class="document">
  43. <div class="documentwrapper">
  44. <div class="bodywrapper">
  45. <div class="body" role="main">
  46. <section id="makefile">
  47. <span id="id1"></span><h1>Makefile<a class="headerlink" href="#makefile" title="Permalink to this heading">¶</a></h1>
  48. <aside class="sidebar">
  49. <p class="sidebar-title">build environment</p>
  50. <p>Before looking deeper at the targets, first read about <a class="reference internal" href="#make-install"><span class="std std-ref">Python environment</span></a>.</p>
  51. <p>To install system requirements follow <a class="reference internal" href="../admin/buildhosts.html#buildhosts"><span class="std std-ref">Buildhosts</span></a>.</p>
  52. </aside>
  53. <p>All relevant build tasks are implemented in <a class="reference external" href="https://github.com/searx/searx/blob/master/manage.sh">Origin: manage.sh</a> and for CI or
  54. IDE integration a small <code class="docutils literal notranslate"><span class="pre">Makefile</span></code> wrapper is available. If you are not
  55. familiar with Makefiles, we recommend to read <a class="reference external" href="https://www.gnu.org/software/make/manual/make.html#Introduction">gnu-make</a> introduction.</p>
  56. <p>The usage is simple, just type <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">{target-name}</span></code> to <em>build</em> a target.
  57. Calling the <code class="docutils literal notranslate"><span class="pre">help</span></code> target gives a first overview (<code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">help</span></code>):</p>
  58. <div class="highlight-text notranslate"><div class="highlight"><pre><span></span>buildenv
  59. rebuild ./utils/brand.env
  60. babel.compile
  61. pybabel compile ./searx/translations
  62. data.*
  63. all : update searx/languages.py and ./data/*
  64. languages : update searx/data/engines_languages.json &amp; searx/languages.py
  65. useragents: update searx/data/useragents.json with the most recent versions of Firefox.
  66. docs.*
  67. html : build HTML documentation
  68. live : autobuild HTML documentation while editing
  69. gh-pages : deploy on gh-pages branch
  70. prebuild : build reST include files (./build/docs/includes)
  71. clean : clean documentation build
  72. docker
  73. build : build docker image
  74. push : build and push docker image
  75. gecko.driver
  76. download &amp; install geckodriver if not already installed (required for
  77. robot_tests)
  78. node.*
  79. env : download &amp; install npm dependencies locally
  80. clean : drop npm installations
  81. py.*
  82. build : Build python packages at ./dist
  83. clean : delete virtualenv and intermediate py files
  84. pyenv.* :
  85. install : developer install of searx into virtualenv
  86. uninstall : uninstall developer installation
  87. cmd ... : run command ... in virtualenv
  88. OK : test if virtualenv is OK
  89. pypi.upload:
  90. Upload python packages to PyPi (to test use pypi.upload.test)
  91. test.* :
  92. pylint : lint PYLINT_FILES, searx/engines, searx &amp; tests
  93. pep8 : pycodestyle (pep8) for all files except PYLINT_FILES
  94. unit : run unit tests
  95. coverage : run unit tests with coverage
  96. robot : run robot test
  97. clean : clean intermediate test stuff
  98. themes.* :
  99. all : build all themes
  100. oscar : build oscar theme
  101. simple : build simple theme
  102. ----
  103. run - run developer instance
  104. install - developer install of searx into virtualenv
  105. uninstall - uninstall developer installation
  106. clean - clean up working tree
  107. search.checker - check search engines
  108. test - run shell &amp; CI tests
  109. test.sh - test shell scripts
  110. ci.test - run CI tests
  111. </pre></div>
  112. </div>
  113. <nav class="contents local" id="contents">
  114. <p class="topic-title">Contents</p>
  115. <ul class="simple">
  116. <li><p><a class="reference internal" href="#python-environment" id="id8">Python environment</a></p></li>
  117. <li><p><a class="reference internal" href="#make-run" id="id9"><code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">run</span></code></a></p></li>
  118. <li><p><a class="reference internal" href="#make-clean" id="id10"><code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">clean</span></code></a></p></li>
  119. <li><p><a class="reference internal" href="#make-docs-docs-autobuild-docs-clean" id="id11"><code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">docs</span> <span class="pre">docs.autobuild</span> <span class="pre">docs.clean</span></code></a></p></li>
  120. <li><p><a class="reference internal" href="#make-docs-gh-pages" id="id12"><code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">docs.gh-pages</span></code></a></p></li>
  121. <li><p><a class="reference internal" href="#make-test" id="id13"><code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">test</span></code></a></p></li>
  122. <li><p><a class="reference internal" href="#make-test-sh" id="id14"><code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">test.sh</span></code></a></p></li>
  123. <li><p><a class="reference internal" href="#make-test-pylint" id="id15"><code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">test.pylint</span></code></a></p></li>
  124. <li><p><a class="reference internal" href="#search-checker-engine-name" id="id16"><code class="docutils literal notranslate"><span class="pre">search.checker.{engine</span> <span class="pre">name}</span></code></a></p></li>
  125. <li><p><a class="reference internal" href="#make-pybuild" id="id17"><code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">pybuild</span></code></a></p></li>
  126. </ul>
  127. </nav>
  128. <section id="python-environment">
  129. <span id="make-install"></span><h2><a class="toc-backref" href="#id8" role="doc-backlink">Python environment</a><a class="headerlink" href="#python-environment" title="Permalink to this heading">¶</a></h2>
  130. <aside class="sidebar">
  131. <p class="sidebar-title">activate environment</p>
  132. <p><code class="docutils literal notranslate"><span class="pre">source</span> <span class="pre">./local/py3/bin/activate</span></code></p>
  133. </aside>
  134. <p>We do no longer need to build up the virtualenv manually. Jump into your git
  135. working tree and release a <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">install</span></code> to get a virtualenv with a
  136. <em>developer install</em> of searx (<a class="reference external" href="https://github.com/searx/searx/blob/master/setup.py">Origin: setup.py</a>).</p>
  137. <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ cd ~/searx-clone
  138. $ make install
  139. PYENV [virtualenv] installing ./requirements*.txt into local/py3
  140. ...
  141. PYENV OK
  142. PYENV [install] pip install -e &#39;searx[test]&#39;
  143. ...
  144. Successfully installed argparse-1.4.0 searx
  145. BUILDENV INFO:searx:load the default settings from ./searx/settings.yml
  146. BUILDENV INFO:searx:Initialisation done
  147. BUILDENV build utils/brand.env
  148. </pre></div>
  149. </div>
  150. <p>If you release <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">install</span></code> multiple times the installation will only
  151. rebuild if the sha256 sum of the <em>requirement files</em> fails. With other words:
  152. the check fails if you edit the requirements listed in
  153. <a class="reference external" href="https://github.com/searx/searx/blob/master/requirements-dev.txt">Origin: requirements-dev.txt</a> and <a class="reference external" href="https://github.com/searx/searx/blob/master/requirements.txt">Origin: requirements.txt</a>).</p>
  154. <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ make install
  155. PYENV OK
  156. PYENV [virtualenv] requirements.sha256 failed
  157. [virtualenv] - 6cea6eb6def9e14a18bf32f8a3e... ./requirements-dev.txt
  158. [virtualenv] - 471efef6c73558e391c3adb35f4... ./requirements.txt
  159. ...
  160. PYENV [virtualenv] installing ./requirements*.txt into local/py3
  161. ...
  162. PYENV OK
  163. PYENV [install] pip install -e &#39;searx[test]&#39;
  164. ...
  165. Successfully installed argparse-1.4.0 searx
  166. BUILDENV INFO:searx:load the default settings from ./searx/settings.yml
  167. BUILDENV INFO:searx:Initialisation done
  168. BUILDENV build utils/brand.env
  169. </pre></div>
  170. </div>
  171. <aside class="sidebar">
  172. <p class="sidebar-title">drop environment</p>
  173. <p>To get rid of the existing environment before re-build use <a class="reference internal" href="#make-clean"><span class="std std-ref">clean target</span></a> first.</p>
  174. </aside>
  175. <p>If you think, something goes wrong with your ./local environment or you change
  176. the <a class="reference external" href="https://github.com/searx/searx/blob/master/setup.py">Origin: setup.py</a> file, you have to call <a class="reference internal" href="#make-clean"><span class="std std-ref">make clean</span></a>.</p>
  177. </section>
  178. <section id="make-run">
  179. <span id="id2"></span><h2><a class="toc-backref" href="#id9" role="doc-backlink"><code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">run</span></code></a><a class="headerlink" href="#make-run" title="Permalink to this heading">¶</a></h2>
  180. <p>To get up a running a developer instance simply call <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">run</span></code>. This enables
  181. <em>debug</em> option in <a class="reference external" href="https://github.com/searx/searx/blob/master/searx/settings.yml">Origin: searx/settings.yml</a>, starts a <code class="docutils literal notranslate"><span class="pre">./searx/webapp.py</span></code>
  182. instance, disables <em>debug</em> option again and opens the URL in your favorite WEB
  183. browser (<a class="reference external" href="https://manpages.debian.org/jump?q=xdg-open">man: xdg-open</a>):</p>
  184. <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ make run
  185. PYENV OK
  186. SEARX_DEBUG=1 ./manage.sh pyenv.cmd python ./searx/webapp.py
  187. ...
  188. INFO:werkzeug: * Running on http://127.0.0.1:8888/ (Press CTRL+C to quit)
  189. </pre></div>
  190. </div>
  191. </section>
  192. <section id="make-clean">
  193. <span id="id3"></span><h2><a class="toc-backref" href="#id10" role="doc-backlink"><code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">clean</span></code></a><a class="headerlink" href="#make-clean" title="Permalink to this heading">¶</a></h2>
  194. <p>Drop all intermediate files, all builds, but keep sources untouched. Before
  195. calling <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">clean</span></code> stop all processes using <a class="reference internal" href="#make-install"><span class="std std-ref">Python environment</span></a>.</p>
  196. <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ make clean
  197. CLEAN pyenv
  198. PYENV [virtualenv] drop ./local/py3
  199. CLEAN docs -- ./build/docs ./dist/docs
  200. CLEAN locally installed npm dependencies
  201. CLEAN test stuff
  202. CLEAN common files
  203. </pre></div>
  204. </div>
  205. </section>
  206. <section id="make-docs-docs-autobuild-docs-clean">
  207. <span id="make-docs"></span><h2><a class="toc-backref" href="#id11" role="doc-backlink"><code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">docs</span> <span class="pre">docs.autobuild</span> <span class="pre">docs.clean</span></code></a><a class="headerlink" href="#make-docs-docs-autobuild-docs-clean" title="Permalink to this heading">¶</a></h2>
  208. <p>We describe the usage of the <code class="docutils literal notranslate"><span class="pre">doc.*</span></code> targets in the <a class="reference internal" href="contribution_guide.html#contrib-docs"><span class="std std-ref">How to contribute /
  209. Documentation</span></a> section. If you want to edit the documentation
  210. read our <a class="reference internal" href="contribution_guide.html#make-docs-live"><span class="std std-ref">live build</span></a> section. If you are working in your own brand,
  211. adjust your <a class="reference internal" href="../admin/settings.html#settings-global"><span class="std std-ref">Global Settings</span></a>.</p>
  212. </section>
  213. <section id="make-docs-gh-pages">
  214. <span id="id4"></span><h2><a class="toc-backref" href="#id12" role="doc-backlink"><code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">docs.gh-pages</span></code></a><a class="headerlink" href="#make-docs-gh-pages" title="Permalink to this heading">¶</a></h2>
  215. <p>To deploy on github.io first adjust your <a class="reference internal" href="../admin/settings.html#settings-global"><span class="std std-ref">Global Settings</span></a>. For any
  216. further read <a class="reference internal" href="contribution_guide.html#deploy-on-github-io"><span class="std std-ref">deploy on github.io</span></a>.</p>
  217. </section>
  218. <section id="make-test">
  219. <span id="id5"></span><h2><a class="toc-backref" href="#id13" role="doc-backlink"><code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">test</span></code></a><a class="headerlink" href="#make-test" title="Permalink to this heading">¶</a></h2>
  220. <p>Runs a series of tests: <a class="reference internal" href="#make-test-pylint"><span class="std std-ref">make test.pylint</span></a>, <code class="docutils literal notranslate"><span class="pre">test.pep8</span></code>, <code class="docutils literal notranslate"><span class="pre">test.unit</span></code>
  221. and <code class="docutils literal notranslate"><span class="pre">test.robot</span></code>. You can run tests selective, e.g.:</p>
  222. <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ make test.pep8 test.unit test.sh
  223. TEST test.pep8 OK
  224. ...
  225. TEST test.unit OK
  226. ...
  227. TEST test.sh OK
  228. </pre></div>
  229. </div>
  230. </section>
  231. <section id="make-test-sh">
  232. <span id="id6"></span><h2><a class="toc-backref" href="#id14" role="doc-backlink"><code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">test.sh</span></code></a><a class="headerlink" href="#make-test-sh" title="Permalink to this heading">¶</a></h2>
  233. <p><a class="reference internal" href="../admin/buildhosts.html#sh-lint"><span class="std std-ref">Lint shell scripts</span></a> / if you have changed some bash scripting run this test before
  234. commit.</p>
  235. </section>
  236. <section id="make-test-pylint">
  237. <span id="id7"></span><h2><a class="toc-backref" href="#id15" role="doc-backlink"><code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">test.pylint</span></code></a><a class="headerlink" href="#make-test-pylint" title="Permalink to this heading">¶</a></h2>
  238. <p><a class="reference external" href="https://www.pylint.org/">Pylint</a> is known as one of the best source-code, bug and quality checker for the
  239. Python programming language. The pylint profile we use at searx project is
  240. found in project’s root folder <a class="reference external" href="https://github.com/searx/searx/blob/master/.pylintrc">Origin: .pylintrc</a>.</p>
  241. </section>
  242. <section id="search-checker-engine-name">
  243. <span id="make-search-checker"></span><h2><a class="toc-backref" href="#id16" role="doc-backlink"><code class="docutils literal notranslate"><span class="pre">search.checker.{engine</span> <span class="pre">name}</span></code></a><a class="headerlink" href="#search-checker-engine-name" title="Permalink to this heading">¶</a></h2>
  244. <p>To check all engines:</p>
  245. <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>make search.checker
  246. </pre></div>
  247. </div>
  248. <p>To check a engine with whitespace in the name like <em>google news</em> replace space
  249. by underline:</p>
  250. <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>make search.checker.google_news
  251. </pre></div>
  252. </div>
  253. <p>To see HTTP requests and more use SEARX_DEBUG:</p>
  254. <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>make SEARX_DEBUG=1 search.checker.google_news
  255. </pre></div>
  256. </div>
  257. <p>To filter out HTTP redirects (<a class="reference external" href="https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_redirection">3xx</a>):</p>
  258. <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>make SEARX_DEBUG=1 search.checker.google_news | grep -A1 &quot;HTTP/1.1\&quot; 3[0-9][0-9]&quot;
  259. ...
  260. Engine google news Checking
  261. https://news.google.com:443 &quot;GET /search?q=life&amp;hl=en&amp;lr=lang_en&amp;ie=utf8&amp;oe=utf8&amp;ceid=US%3Aen&amp;gl=US HTTP/1.1&quot; 302 0
  262. https://news.google.com:443 &quot;GET /search?q=life&amp;hl=en-US&amp;lr=lang_en&amp;ie=utf8&amp;oe=utf8&amp;ceid=US:en&amp;gl=US HTTP/1.1&quot; 200 None
  263. --
  264. https://news.google.com:443 &quot;GET /search?q=computer&amp;hl=en&amp;lr=lang_en&amp;ie=utf8&amp;oe=utf8&amp;ceid=US%3Aen&amp;gl=US HTTP/1.1&quot; 302 0
  265. https://news.google.com:443 &quot;GET /search?q=computer&amp;hl=en-US&amp;lr=lang_en&amp;ie=utf8&amp;oe=utf8&amp;ceid=US:en&amp;gl=US HTTP/1.1&quot; 200 None
  266. --
  267. </pre></div>
  268. </div>
  269. </section>
  270. <section id="make-pybuild">
  271. <h2><a class="toc-backref" href="#id17" role="doc-backlink"><code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">pybuild</span></code></a><a class="headerlink" href="#make-pybuild" title="Permalink to this heading">¶</a></h2>
  272. <p>Build Python packages in <code class="docutils literal notranslate"><span class="pre">./dist/py</span></code>:</p>
  273. <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ make pybuild
  274. ...
  275. BUILD pybuild
  276. running sdist
  277. running egg_info
  278. ...
  279. running bdist_wheel
  280. $ ls ./dist
  281. searx-0.18.0-py3-none-any.whl searx-0.18.0.tar.gz
  282. </pre></div>
  283. </div>
  284. <p>To upload packages to <a class="reference external" href="https://pypi.org/">PyPi</a>, there is also a <code class="docutils literal notranslate"><span class="pre">pypi.upload</span></code> target (to test use
  285. <code class="docutils literal notranslate"><span class="pre">pypi.upload.test</span></code>). Since you are not the owner of <a class="reference external" href="https://pypi.org/project/searx">PyPi: searx</a> you will
  286. never need to upload.</p>
  287. </section>
  288. </section>
  289. <div class="clearer"></div>
  290. </div>
  291. </div>
  292. </div>
  293. <span id="sidebar-top"></span>
  294. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  295. <div class="sphinxsidebarwrapper">
  296. <p class="logo"><a href="../index.html">
  297. <img class="logo" src="../_static/searx_logo_small.png" alt="Logo"/>
  298. </a></p>
  299. <h3>Project Links</h3>
  300. <ul>
  301. <li><a href="https://searx.github.io/searx/blog/index.html">Blog</a>
  302. <li><a href="https://github.com/searx/searx">Source</a>
  303. <li><a href="https://github.com/searx/searx/wiki">Wiki</a>
  304. <li><a href="https://twitter.com/Searx_engine">Twitter</a>
  305. <li><a href="https://github.com/searx/searx/issues">Issue Tracker</a>
  306. </ul><h3>Navigation</h3>
  307. <ul>
  308. <li><a href="../index.html">Overview</a>
  309. <ul>
  310. <li><a href="index.html">Developer documentation</a>
  311. <ul>
  312. <li>Previous: <a href="translation.html" title="previous chapter">Translation</a>
  313. <li>Next: <a href="reST.html" title="next chapter">reST primer</a></ul>
  314. </li>
  315. </ul>
  316. </li>
  317. </ul>
  318. <div id="searchbox" style="display: none" role="search">
  319. <h3 id="searchlabel">Quick search</h3>
  320. <div class="searchformwrapper">
  321. <form class="search" action="../search.html" method="get">
  322. <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
  323. <input type="submit" value="Go" />
  324. </form>
  325. </div>
  326. </div>
  327. <script>document.getElementById('searchbox').style.display = "block"</script>
  328. </div>
  329. </div>
  330. <div class="clearer"></div>
  331. </div>
  332. <div class="footer" role="contentinfo">
  333. &#169; Copyright 2015-2022, Adam Tauber, Noémi Ványi.
  334. Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 5.3.0.
  335. </div>
  336. <script src="../_static/version_warning_offset.js"></script>
  337. </body>
  338. </html>