on master help sign in
Merge remote-tracking branch 'origin/install-refactor'
commitdb615aa1a36cb5e136f6c264295a6e59f7466a9d authorAdam Tauber <asciimoo@gmail.com> dateSun 10 Jan 2016, 19:49 (11 years ago) parent66f48c2c873ddd
72 files changed+150−716
.gitignore+1−12 .travis.yml+7−7 Makefile−66 README.rst+2−115 base.cfg−17 bootstrap.py−210 buildout.cfg−30 manage.sh+94 minimal.cfg−15 production.cfg−34 requirements-dev.txt+10 requirements.txt+12−12 searx/testing.py+17−3 searx/tests/test_engines.py−45 setup.py+7−28 searx/tests/__init__.py → tests/__init__.py searx/tests/engines/__init__.py → tests/robot/__init__.py searx/tests/robot/test_basic.robot → tests/robot/test_basic.robot searx/tests/test_robot.py → tests/test_robot.py searx/tests/robot/__init__.py → tests/unit/__init__.py tests/unit/engines/__init__.py searx/tests/engines/test_bing.py → tests/unit/engines/test_bing.py searx/tests/engines/test_bing_images.py → tests/unit/engines/test_bing_images.py searx/tests/engines/test_bing_news.py → tests/unit/engines/test_bing_news.py searx/tests/engines/test_blekko_images.py → tests/unit/engines/test_blekko_images.py searx/tests/engines/test_btdigg.py → tests/unit/engines/test_btdigg.py searx/tests/engines/test_currency_convert.py → tests/unit/engines/test_currency_convert.py searx/tests/engines/test_dailymotion.py → tests/unit/engines/test_dailymotion.py searx/tests/engines/test_deezer.py → tests/unit/engines/test_deezer.py searx/tests/engines/test_deviantart.py → tests/unit/engines/test_deviantart.py searx/tests/engines/test_digg.py → tests/unit/engines/test_digg.py searx/tests/engines/test_duckduckgo.py → tests/unit/engines/test_duckduckgo.py searx/tests/engines/test_duckduckgo_definitions.py → tests/unit/engines/test_duckduckgo_definitions.py searx/tests/engines/test_dummy.py → tests/unit/engines/test_dummy.py searx/tests/engines/test_faroo.py → tests/unit/engines/test_faroo.py searx/tests/engines/test_flickr.py → tests/unit/engines/test_flickr.py searx/tests/engines/test_flickr_noapi.py → tests/unit/engines/test_flickr_noapi.py searx/tests/engines/test_gigablast.py → tests/unit/engines/test_gigablast.py searx/tests/engines/test_github.py → tests/unit/engines/test_github.py searx/tests/engines/test_google.py → tests/unit/engines/test_google.py searx/tests/engines/test_google_images.py → tests/unit/engines/test_google_images.py searx/tests/engines/test_google_news.py → tests/unit/engines/test_google_news.py searx/tests/engines/test_kickass.py → tests/unit/engines/test_kickass.py searx/tests/engines/test_mediawiki.py → tests/unit/engines/test_mediawiki.py searx/tests/engines/test_mixcloud.py → tests/unit/engines/test_mixcloud.py searx/tests/engines/test_openstreetmap.py → tests/unit/engines/test_openstreetmap.py searx/tests/engines/test_photon.py → tests/unit/engines/test_photon.py searx/tests/engines/test_piratebay.py → tests/unit/engines/test_piratebay.py searx/tests/engines/test_qwant.py → tests/unit/engines/test_qwant.py searx/tests/engines/test_searchcode_code.py → tests/unit/engines/test_searchcode_code.py searx/tests/engines/test_searchcode_doc.py → tests/unit/engines/test_searchcode_doc.py searx/tests/engines/test_soundcloud.py → tests/unit/engines/test_soundcloud.py searx/tests/engines/test_spotify.py → tests/unit/engines/test_spotify.py searx/tests/engines/test_stackoverflow.py → tests/unit/engines/test_stackoverflow.py searx/tests/engines/test_startpage.py → tests/unit/engines/test_startpage.py searx/tests/engines/test_subtitleseeker.py → tests/unit/engines/test_subtitleseeker.py searx/tests/engines/test_swisscows.py → tests/unit/engines/test_swisscows.py searx/tests/engines/test_twitter.py → tests/unit/engines/test_twitter.py searx/tests/engines/test_vimeo.py → tests/unit/engines/test_vimeo.py searx/tests/engines/test_www1x.py → tests/unit/engines/test_www1x.py searx/tests/engines/test_www500px.py → tests/unit/engines/test_www500px.py searx/tests/engines/test_yacy.py → tests/unit/engines/test_yacy.py searx/tests/engines/test_yahoo.py → tests/unit/engines/test_yahoo.py searx/tests/engines/test_yahoo_news.py → tests/unit/engines/test_yahoo_news.py searx/tests/engines/test_youtube_api.py → tests/unit/engines/test_youtube_api.py searx/tests/engines/test_youtube_noapi.py → tests/unit/engines/test_youtube_noapi.py searx/tests/test_plugins.py → tests/unit/test_plugins.py searx/tests/test_results.py → tests/unit/test_results.py searx/tests/test_search.py → tests/unit/test_search.py searx/tests/test_utils.py → tests/unit/test_utils.py searx/tests/test_webapp.py → tests/unit/test_webapp.py versions.cfg−122
.gitignore+1−12
@@ -5,24 +5,13 @@ env
55robot_log.html
66robot_output.xml
77robot_report.html
8+test_basic/
89setup.cfg
910
1011*.pyc
1112*/*.pyc
1213*~
1314
14−bin/
15−build/
16−coverage/
17−develop-eggs/
18−dist/
19−eggs/
20−include/
21−lib/
22−local/
23−parts/
24−searx.egg-info/
25−var/
2615node_modules/
2716
2817.tx/
.travis.yml+7−7
@@ -11,16 +11,16 @@ before_install:
1111 - "export DISPLAY=:99.0"
1212 - "sh -e /etc/init.d/xvfb start"
1313 - npm install -g less grunt-cli
14− - ( cd searx/static/themes/oscar;npm install )
14+ - ( cd searx/static/themes/oscar;npm install; cd - )
1515install:
16− - "make"
16+ - ./manage.sh update_dev_packages
1717 - pip install coveralls
1818script:
19− - "make flake8"
20− - "make robot"
21− - "make styles"
22− - "make grunt"
23− - make coverage
19+ - ./manage.sh pep8_check
20+ - ./manage.sh styles
21+ - ./manage.sh grunt_build
22+ - ./manage.sh py_test_coverage
23+ - ./manage.sh robot_tests
2424after_success:
2525 coveralls
2626notifications:
Makefiledeleted−66
@@ -1,66 +0,0 @@
1−# convenience makefile to boostrap & run buildout
2−# use `make options=-v` to run buildout with extra options
3−
4−version = 2.7
5−python = bin/python
6−options =
7−
8−all: .installed.cfg
9−
10−.installed.cfg: bin/buildout buildout.cfg setup.py
11− bin/buildout $(options)
12−
13−bin/buildout: $(python) buildout.cfg bootstrap.py
14− $(python) bootstrap.py
15− @touch $@
16−
17−$(python):
18− virtualenv -p python$(version) --no-site-packages .
19− @touch $@
20−
21−robot: .installed.cfg
22− @bin/robot
23−
24−flake8: .installed.cfg
25− @bin/flake8 setup.py
26− @bin/flake8 ./searx/
27−
28−tests: .installed.cfg flake8
29− @bin/test
30− @grunt test --gruntfile searx/static/themes/oscar/gruntfile.js
31−
32−coverage: .installed.cfg
33− @bin/coverage run bin/test
34− @bin/coverage report
35− @bin/coverage html
36−
37−production: bin/buildout production.cfg setup.py
38− bin/buildout -c production.cfg $(options)
39− @echo "* Please modify `readlink --canonicalize-missing ./searx/settings.py`"
40− @echo "* Hint 1: on production, disable debug mode and change secret_key"
41− @echo "* Hint 2: searx will be executed at server startup by crontab"
42− @echo "* Hint 3: to run immediatley, execute 'bin/supervisord'"
43−
44−minimal: bin/buildout minimal.cfg setup.py
45− bin/buildout -c minimal.cfg $(options)
46−
47−styles:
48− @lessc -x searx/static/themes/default/less/style.less > searx/static/themes/default/css/style.css
49− @lessc -x searx/static/themes/default/less/style-rtl.less > searx/static/themes/default/css/style-rtl.css
50− @lessc -x searx/static/themes/courgette/less/style.less > searx/static/themes/courgette/css/style.css
51− @lessc -x searx/static/themes/courgette/less/style-rtl.less > searx/static/themes/courgette/css/style-rtl.css
52− @lessc -x searx/static/less/bootstrap/bootstrap.less > searx/static/css/bootstrap.min.css
53− @lessc -x searx/static/themes/oscar/less/oscar/oscar.less > searx/static/themes/oscar/css/oscar.min.css
54− @lessc -x searx/static/themes/pix-art/less/style.less > searx/static/themes/pix-art/css/style.css
55−
56−grunt:
57− @grunt --gruntfile searx/static/themes/oscar/gruntfile.js
58−
59−locales:
60− @pybabel compile -d searx/translations
61−
62−clean:
63− @rm -rf .installed.cfg .mr.developer.cfg bin parts develop-eggs eggs \
64− searx.egg-info lib include .coverage coverage
65−
66−.PHONY: all tests robot flake8 coverage production minimal styles locales clean
README.rst+2−115
@@ -7,31 +7,16 @@ engine <https://en.wikipedia.org/wiki/Metasearch_engine>`__.
77List of `running
88instances <https://github.com/asciimoo/searx/wiki/Searx-instances>`__.
99
10−See the `wiki <https://github.com/asciimoo/searx/wiki>`__ for more information.
10+See the `documentation <https://asciimoo.github.io/searx>`__ and the `wiki <https://github.com/asciimoo/searx/wiki>`__ for more information.
1111
1212|Flattr searx|
1313
14−Features
15−~~~~~~~~
16−
17−- Tracking free
18−- Supports multiple output formats
19−
20− - json ``curl https://searx.me/?format=json&q=[query]``
21− - csv ``curl https://searx.me/?format=csv&q=[query]``
22− - opensearch/rss ``curl https://searx.me/?format=rss&q=[query]``
23−- Opensearch support (you can set as default search engine)
24−- Configurable search engines/categories
25−- Different search languages
26−- Duckduckgo like !bang functionality with engine shortcuts
27−- Parallel queries - relatively fast
28−
2914Installation
3015~~~~~~~~~~~~
3116
3217- clone source:
3318 ``git clone git@github.com:asciimoo/searx.git && cd searx``
34−- install dependencies: ``pip install -r requirements.txt``
19+- install dependencies: ``./manage.sh update_packages``
3520- edit your
3621 `settings.yml <https://github.com/asciimoo/searx/blob/master/settings.yml>`__
3722 (set your ``secret_key``!)
@@ -40,104 +25,6 @@ Installation
4025For all the details, follow this `step by step
4126installation <https://github.com/asciimoo/searx/wiki/Installation>`__
4227
43−Alternative (Recommended) Installation
44−~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45−
46−- clone source:
47− ``git clone git@github.com:asciimoo/searx.git && cd searx``
48−- build in current folder: ``make minimal``
49−- run ``bin/searx-run`` to start the application
50−
51−Development
52−~~~~~~~~~~~
53−
54−Just run ``make``. Versions of dependencies are pinned down inside
55−``versions.cfg`` to produce most stable build. Also remember, NO make
56−command should be run as root, not even ``make production``
57−
58−Deployment
59−~~~~~~~~~~
60−
61−- clone source:
62− ``git clone git@github.com:asciimoo/searx.git && cd searx``
63−- build in current folder: ``make production``
64−- run ``bin/supervisord`` to start the application
65−
66−Upgrading
67−~~~~~~~~~
68−
69−- inside previously cloned searx directory run: ``git stash`` to
70− temporarily save any changes you have made
71−- pull source: ``git pull origin master``
72−- re-build in current folder: ``make production``
73−- run ``bin/supervisorctl stop searx`` to stop searx, if it does not,
74− then run ``fuser -k 8888/tcp``
75−- run ``bin/supervisorctl reload`` to re-read supervisor config and
76− start searx
77−
78−Command make
79−~~~~~~~~~~~~
80−
81−``make``
82−''''''''
83−
84−Builds development environment with testing support.
85−
86−``make tests``
87−''''''''''''''
88−
89−Runs tests. You can write tests
90−`here <https://github.com/asciimoo/searx/tree/master/searx/tests>`__ and
91−remember 'untested code is broken code'.
92−
93−``make robot``
94−''''''''''''''
95−
96−Runs robot (Selenium) tests, you must have ``firefox`` installed because
97−this functional tests actually run the browser and perform operations on
98−it. Also searx is executed with
99−`settings\_robot <https://github.com/asciimoo/searx/blob/master/searx/settings_robot.yml>`__.
100−
101−``make flake8``
102−'''''''''''''''
103−
104−'pep8 is a tool to check your Python code against some of the style
105−conventions in `PEP 8 <http://www.python.org/dev/peps/pep-0008/>`__.'
106−
107−``make coverage``
108−'''''''''''''''''
109−
110−Checks coverage of tests, after running this, execute this:
111−``firefox ./coverage/index.html``
112−
113−``make production``
114−'''''''''''''''''''
115−
116−Used to make co-called production environment - without tests (you
117−should ran tests before deploying searx on the server). This installs
118−supervisord, so if searx crashes, it will try to pick itself up again.
119−And crontab entry is added to start supervisord at server boot.
120−
121−``make minimal``
122−''''''''''''''''
123−
124−Minimal build - without test frameworks, the quickest build option.
125−
126−``make clean``
127−''''''''''''''
128−
129−Deletes several folders and files (see ``Makefile`` for more), so that
130−next time you run any other ``make`` command it will rebuild everithing.
131−
132−TODO
133−~~~~
134−
135−- Moar engines
136−- Better ui
137−- Browser integration
138−- Documentation
139−- Tests
140−
14128Bugs
14229~~~~
14330
base.cfgdeleted−17
@@ -1,17 +0,0 @@
1−[buildout]
2−extends = versions.cfg
3−unzip = true
4−newest = false
5−prefer-final = true
6−develop = .
7−
8−eggs =
9− searx
10−
11−parts =
12− omelette
13−
14−
15−[omelette]
16−recipe = collective.recipe.omelette
17−eggs = ${buildout:eggs}
bootstrap.pydeleted−210
@@ -1,210 +0,0 @@
1−##############################################################################
2−#
3−# Copyright (c) 2006 Zope Foundation and Contributors.
4−# All Rights Reserved.
5−#
6−# This software is subject to the provisions of the Zope Public License,
7−# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
8−# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
9−# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
10−# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
11−# FOR A PARTICULAR PURPOSE.
12−#
13−##############################################################################
14−"""Bootstrap a buildout-based project
15−
16−Simply run this script in a directory containing a buildout.cfg.
17−The script accepts buildout command-line options, so you can
18−use the -c option to specify an alternate configuration file.
19−"""
20−
21−import os
22−import shutil
23−import sys
24−import tempfile
25−
26−from optparse import OptionParser
27−
28−__version__ = '2015-07-01'
29−# See zc.buildout's changelog if this version is up to date.
30−
31−tmpeggs = tempfile.mkdtemp(prefix='bootstrap-')
32−
33−usage = '''\
34−[DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options]
35−
36−Bootstraps a buildout-based project.
37−
38−Simply run this script in a directory containing a buildout.cfg, using the
39−Python that you want bin/buildout to use.
40−
41−Note that by using --find-links to point to local resources, you can keep
42−this script from going over the network.
43−'''
44−
45−parser = OptionParser(usage=usage)
46−parser.add_option("--version",
47− action="store_true", default=False,
48− help=("Return bootstrap.py version."))
49−parser.add_option("-t", "--accept-buildout-test-releases",
50− dest='accept_buildout_test_releases',
51− action="store_true", default=False,
52− help=("Normally, if you do not specify a --version, the "
53− "bootstrap script and buildout gets the newest "
54− "*final* versions of zc.buildout and its recipes and "
55− "extensions for you. If you use this flag, "
56− "bootstrap and buildout will get the newest releases "
57− "even if they are alphas or betas."))
58−parser.add_option("-c", "--config-file",
59− help=("Specify the path to the buildout configuration "
60− "file to be used."))
61−parser.add_option("-f", "--find-links",
62− help=("Specify a URL to search for buildout releases"))
63−parser.add_option("--allow-site-packages",
64− action="store_true", default=False,
65− help=("Let bootstrap.py use existing site packages"))
66−parser.add_option("--buildout-version",
67− help="Use a specific zc.buildout version")
68−parser.add_option("--setuptools-version",
69− help="Use a specific setuptools version")
70−parser.add_option("--setuptools-to-dir",
71− help=("Allow for re-use of existing directory of "
72− "setuptools versions"))
73−
74−options, args = parser.parse_args()
75−if options.version:
76− print("bootstrap.py version %s" % __version__)
77− sys.exit(0)
78−
79−
80−######################################################################
81−# load/install setuptools
82−
83−try:
84− from urllib.request import urlopen
85−except ImportError:
86− from urllib2 import urlopen
87−
88−ez = {}
89−if os.path.exists('ez_setup.py'):
90− exec(open('ez_setup.py').read(), ez)
91−else:
92− exec(urlopen('https://bootstrap.pypa.io/ez_setup.py').read(), ez)
93−
94−if not options.allow_site_packages:
95− # ez_setup imports site, which adds site packages
96− # this will remove them from the path to ensure that incompatible versions
97− # of setuptools are not in the path
98− import site
99− # inside a virtualenv, there is no 'getsitepackages'.
100− # We can't remove these reliably
101− if hasattr(site, 'getsitepackages'):
102− for sitepackage_path in site.getsitepackages():
103− # Strip all site-packages directories from sys.path that
104− # are not sys.prefix; this is because on Windows
105− # sys.prefix is a site-package directory.
106− if sitepackage_path != sys.prefix:
107− sys.path[:] = [x for x in sys.path
108− if sitepackage_path not in x]
109−
110−setup_args = dict(to_dir=tmpeggs, download_delay=0)
111−
112−if options.setuptools_version is not None:
113− setup_args['version'] = options.setuptools_version
114−if options.setuptools_to_dir is not None:
115− setup_args['to_dir'] = options.setuptools_to_dir
116−
117−ez['use_setuptools'](**setup_args)
118−import setuptools
119−import pkg_resources
120−
121−# This does not (always?) update the default working set. We will
122−# do it.
123−for path in sys.path:
124− if path not in pkg_resources.working_set.entries:
125− pkg_resources.working_set.add_entry(path)
126−
127−######################################################################
128−# Install buildout
129−
130−ws = pkg_resources.working_set
131−
132−setuptools_path = ws.find(
133− pkg_resources.Requirement.parse('setuptools')).location
134−
135−# Fix sys.path here as easy_install.pth added before PYTHONPATH
136−cmd = [sys.executable, '-c',
137− 'import sys; sys.path[0:0] = [%r]; ' % setuptools_path +
138− 'from setuptools.command.easy_install import main; main()',
139− '-mZqNxd', tmpeggs]
140−
141−find_links = os.environ.get(
142− 'bootstrap-testing-find-links',
143− options.find_links or
144− ('http://downloads.buildout.org/'
145− if options.accept_buildout_test_releases else None)
146− )
147−if find_links:
148− cmd.extend(['-f', find_links])
149−
150−requirement = 'zc.buildout'
151−version = options.buildout_version
152−if version is None and not options.accept_buildout_test_releases:
153− # Figure out the most recent final version of zc.buildout.
154− import setuptools.package_index
155− _final_parts = '*final-', '*final'
156−
157− def _final_version(parsed_version):
158− try:
159− return not parsed_version.is_prerelease
160− except AttributeError:
161− # Older setuptools
162− for part in parsed_version:
163− if (part[:1] == '*') and (part not in _final_parts):
164− return False
165− return True
166−
167− index = setuptools.package_index.PackageIndex(
168− search_path=[setuptools_path])
169− if find_links:
170− index.add_find_links((find_links,))
171− req = pkg_resources.Requirement.parse(requirement)
172− if index.obtain(req) is not None:
173− best = []
174− bestv = None
175− for dist in index[req.project_name]:
176− distv = dist.parsed_version
177− if _final_version(distv):
178− if bestv is None or distv > bestv:
179− best = [dist]
180− bestv = distv
181− elif distv == bestv:
182− best.append(dist)
183− if best:
184− best.sort()
185− version = best[-1].version
186−if version:
187− requirement = '=='.join((requirement, version))
188−cmd.append(requirement)
189−
190−import subprocess
191−if subprocess.call(cmd) != 0:
192− raise Exception(
193− "Failed to execute command:\n%s" % repr(cmd)[1:-1])
194−
195−######################################################################
196−# Import and run buildout
197−
198−ws.add_entry(tmpeggs)
199−ws.require(requirement)
200−import zc.buildout.buildout
201−
202−if not [a for a in args if '=' not in a]:
203− args.append('bootstrap')
204−
205−# if -c was provided, we push it back into args for buildout' main function
206−if options.config_file is not None:
207− args[0:0] = ['-c', options.config_file]
208−
209−zc.buildout.buildout.main(args)
210−shutil.rmtree(tmpeggs)
buildout.cfgdeleted−30
@@ -1,30 +0,0 @@
1−[buildout]
2−extends = base.cfg
3−develop = .
4−
5−eggs =
6− searx [test]
7−
8−parts +=
9− pyscripts
10− robot
11− test
12−
13−
14−[pyscripts]
15−recipe = zc.recipe.egg:script
16−eggs = ${buildout:eggs}
17−interpreter = py
18−dependent-scripts = true
19−
20−
21−[robot]
22−recipe = zc.recipe.testrunner
23−eggs = ${buildout:eggs}
24−defaults = ['--color', '--auto-progress', '--layer', 'SearxRobotLayer']
25−
26−
27−[test]
28−recipe = zc.recipe.testrunner
29−eggs = ${buildout:eggs}
30−defaults = ['--color', '--auto-progress', '--layer', 'SearxTestLayer', '--layer', '!SearxRobotLayer']
manage.shnew file+94
@@ -0,0 +1,94 @@
1+#!/bin/sh
2+
3+BASE_DIR=$(dirname `readlink -f $0`)
4+PYTHONPATH=$BASE_DIR
5+SEARX_DIR="$BASE_DIR/searx"
6+ACTION=$1
7+
8+update_packages() {
9+ pip install --upgrade -r "$BASE_DIR/requirements.txt"
10+}
11+
12+update_dev_packages() {
13+ update_packages
14+ pip install --upgrade -r "$BASE_DIR/requirements-dev.txt"
15+}
16+
17+pep8_check() {
18+ echo '[!] Running pep8 check'
19+ pep8 --max-line-length=120 "$SEARX_DIR" "$BASE_DIR/tests"
20+}
21+
22+unit_tests() {
23+ echo '[!] Running unit tests'
24+ python -m nose2 -s "$BASE_DIR/tests/unit"
25+}
26+
27+py_test_coverage() {
28+ echo '[!] Running python test coverage'
29+ PYTHONPATH=`pwd` python -m nose2 -C --coverage "$SEARX_DIR" -s "$BASE_DIR/tests/unit"
30+ coverage report
31+ coverage html
32+}
33+
34+robot_tests() {
35+ echo '[!] Running robot tests'
36+ PYTHONPATH=`pwd` python "$SEARX_DIR/testing.py" robot
37+}
38+
39+tests() {
40+ set -e
41+ pep8_check
42+ unit_tests
43+ robot_tests
44+ set +e
45+}
46+
47+build_style() {
48+ lessc -x "$BASE_DIR/searx/static/$1" "$BASE_DIR/searx/static/$2"
49+}
50+
51+styles() {
52+ echo '[!] Building styles'
53+ build_style themes/default/less/style.less themes/default/css/style.css
54+ build_style themes/default/less/style-rtl.less themes/default/css/style-rtl.css
55+ build_style themes/courgette/less/style.less themes/courgette/css/style.css
56+ build_style themes/courgette/less/style-rtl.less themes/courgette/css/style-rtl.css
57+ build_style less/bootstrap/bootstrap.less css/bootstrap.min.css
58+ build_style themes/oscar/less/oscar/oscar.less themes/oscar/css/oscar.min.css
59+ build_style themes/pix-art/less/style.less themes/pix-art/css/style.css
60+}
61+
62+grunt_build() {
63+ grunt --gruntfile "$SEARX_DIR/static/themes/oscar/gruntfile.js"
64+}
65+
66+locales() {
67+ pybabel compile -d "$SEARX_DIR/translations"
68+}
69+
70+help() {
71+ [ -z "$1" ] || echo "Error: $1\n"
72+ echo "Searx manage.sh help
73+
74+Commands
75+========
76+ grunt_build - Build js files
77+ help - This text
78+ locales - Compile locales
79+ pep8_check - Pep8 validation
80+ py_test_coverage - Unit test coverage
81+ robot_tests - Run selenium tests
82+ styles - Build less files
83+ tests - Run all python tests (pep8, unit, robot)
84+ unit_tests - Run unit tests
85+ update_dev_packages - Check & update development only dependency changes
86+ update_packages - Check & update dependency changes
87+"
88+}
89+
90+if type $ACTION 1>/dev/null; then
91+ $ACTION
92+else
93+ help "action not found"
94+fi
minimal.cfgdeleted−15
@@ -1,15 +0,0 @@
1−[buildout]
2−extends = base.cfg
3−develop = .
4−
5−eggs =
6− searx
7−
8−parts +=
9− pyscripts
10−
11−
12−[pyscripts]
13−recipe = zc.recipe.egg:script
14−eggs = ${buildout:eggs}
15−interpreter = py
production.cfgdeleted−34
@@ -1,34 +0,0 @@
1−[buildout]
2−extends = base.cfg
3−develop = .
4−
5−eggs =
6− searx
7−
8−parts +=
9− pyscripts
10− supervisor
11− crontab_reboot
12−
13−
14−[pyscripts]
15−recipe = zc.recipe.egg:script
16−eggs = ${buildout:eggs}
17−interpreter = py
18−
19−
20−[supervisor]
21−recipe = collective.recipe.supervisor
22−http-socket = unix
23−user = searxer
24−password = ohpleasedochangeme
25−file = /tmp/supervisor.sock
26−chmod = 0700
27−programs =
28− 50 searx ${buildout:bin-directory}/searx-run
29−
30−
31−[crontab_reboot]
32−recipe = z3c.recipe.usercrontab
33−times = @reboot
34−command = ${buildout:bin-directory}/supervisord
requirements-dev.txtnew file+10
@@ -0,0 +1,10 @@
1+babel==2.2.0
2+flake8==2.5.1
3+mock==1.0.1
4+nose2[coverage-plugin]
5+plone.testing==4.0.15
6+robotframework-selenium2library==1.7.4
7+robotsuite==1.7.0
8+transifex-client==0.11
9+unittest2==1.1.0
10+zope.testrunner==4.4.10
requirements.txt+12−12
@@ -1,12 +1,12 @@
1−flask
2−flask-babel
3−requests
4−lxml
5−pyyaml
6−pygments
7−python-dateutil
8−ndg-httpsclient
9−pyopenssl
10−pyasn1
11−pyasn1-modules
12−certifi
1+certifi==2015.11.20.1
2+flask==0.10.1
3+flask-babel==0.9
4+lxml==3.5.0
5+ndg-httpsclient==0.4.0
6+pyasn1==0.1.9
7+pyasn1-modules==0.0.8
8+pygments==2.0.2
9+pyopenssl==0.15.1
10+python-dateutil==2.4.2
11+pyyaml==3.11
12+requests==2.9.1
searx/testing.py+17−3
@@ -3,6 +3,7 @@
33
44from plone.testing import Layer
55from unittest2 import TestCase
6+from os.path import dirname, join, abspath
67
78
89import os
@@ -42,11 +43,11 @@ class SearxRobotLayer(Layer):
4243 os.path.abspath(os.path.dirname(os.path.realpath(__file__))),
4344 'webapp.py'
4445 )
45− exe = os.path.abspath(os.path.dirname(__file__) + '/../bin/py')
46+ exe = 'python'
4647
4748 # set robot settings path
48− os.environ['SEARX_SETTINGS_PATH'] = os.path.abspath(
49− os.path.dirname(__file__) + '/settings_robot.yml')
49+ os.environ['SEARX_SETTINGS_PATH'] = abspath(
50+ dirname(__file__) + '/settings_robot.yml')
5051
5152 # run the server
5253 self.server = subprocess.Popen(
@@ -68,3 +69,16 @@ class SearxTestCase(TestCase):
6869 """Base test case for non-robot tests."""
6970
7071 layer = SearxTestLayer
72+
73+
74+if __name__ == '__main__':
75+ from tests.test_robot import test_suite
76+ import sys
77+ from zope.testrunner.runner import Runner
78+
79+ base_dir = abspath(join(dirname(__file__), '../tests'))
80+ if sys.argv[1] == 'robot':
81+ Runner(['--color',
82+ '--auto-progress',
83+ '--path', base_dir],
84+ found_suites=[test_suite()]).run()
searx/tests/test_engines.pydeleted−45
@@ -1,45 +0,0 @@
1−from searx.tests.engines.test_bing import * # noqa
2−from searx.tests.engines.test_bing_images import * # noqa
3−from searx.tests.engines.test_bing_news import * # noqa
4−from searx.tests.engines.test_blekko_images import * # noqa
5−from searx.tests.engines.test_btdigg import * # noqa
6−from searx.tests.engines.test_currency_convert import * # noqa
7−from searx.tests.engines.test_dailymotion import * # noqa
8−from searx.tests.engines.test_deezer import * # noqa
9−from searx.tests.engines.test_deviantart import * # noqa
10−from searx.tests.engines.test_digg import * # noqa
11−from searx.tests.engines.test_duckduckgo import * # noqa
12−from searx.tests.engines.test_duckduckgo_definitions import * # noqa
13−from searx.tests.engines.test_dummy import * # noqa
14−from searx.tests.engines.test_faroo import * # noqa
15−from searx.tests.engines.test_flickr import * # noqa
16−from searx.tests.engines.test_flickr_noapi import * # noqa
17−from searx.tests.engines.test_gigablast import * # noqa
18−from searx.tests.engines.test_github import * # noqa
19−from searx.tests.engines.test_google import * # noqa
20−from searx.tests.engines.test_google_images import * # noqa
21−from searx.tests.engines.test_google_news import * # noqa
22−from searx.tests.engines.test_kickass import * # noqa
23−from searx.tests.engines.test_mediawiki import * # noqa
24−from searx.tests.engines.test_mixcloud import * # noqa
25−from searx.tests.engines.test_openstreetmap import * # noqa
26−from searx.tests.engines.test_photon import * # noqa
27−from searx.tests.engines.test_piratebay import * # noqa
28−from searx.tests.engines.test_qwant import * # noqa
29−from searx.tests.engines.test_searchcode_code import * # noqa
30−from searx.tests.engines.test_searchcode_doc import * # noqa
31−from searx.tests.engines.test_soundcloud import * # noqa
32−from searx.tests.engines.test_spotify import * # noqa
33−from searx.tests.engines.test_stackoverflow import * # noqa
34−from searx.tests.engines.test_startpage import * # noqa
35−from searx.tests.engines.test_subtitleseeker import * # noqa
36−from searx.tests.engines.test_swisscows import * # noqa
37−from searx.tests.engines.test_twitter import * # noqa
38−from searx.tests.engines.test_vimeo import * # noqa
39−from searx.tests.engines.test_www1x import * # noqa
40−from searx.tests.engines.test_www500px import * # noqa
41−from searx.tests.engines.test_yacy import * # noqa
42−from searx.tests.engines.test_yahoo import * # noqa
43−from searx.tests.engines.test_youtube_api import * # noqa
44−from searx.tests.engines.test_youtube_noapi import * # noqa
45−from searx.tests.engines.test_yahoo_news import * # noqa
setup.py+7−28
@@ -17,6 +17,8 @@ def read(*rnames):
1717
1818
1919long_description = read('README.rst')
20+requirements = map(str.strip, open('requirements.txt').readlines())
21+dev_requirements = map(str.strip, open('requirements-dev.txt').readlines())
2022
2123setup(
2224 name='searx',
@@ -38,35 +40,9 @@ setup(
3840 license='GNU Affero General Public License',
3941 packages=find_packages('.'),
4042 zip_safe=False,
41− install_requires=[
42− 'flask',
43− 'flask-babel',
44− 'requests',
45− 'lxml',
46− 'pyyaml',
47− 'pygments',
48− 'setuptools',
49− 'python-dateutil',
50− 'pyopenssl',
51− 'ndg-httpsclient',
52− 'pyasn1',
53− 'pyasn1-modules',
54− 'certifi'
55− ],
43+ install_requires=requirements,
5644 extras_require={
57− 'test': [
58− 'coverage',
59− 'flake8',
60− 'mock',
61− 'plone.testing',
62− 'robotframework',
63− 'robotframework-debuglibrary',
64− 'robotframework-httplibrary',
65− 'robotframework-selenium2library',
66− 'robotsuite',
67− 'unittest2',
68− 'zope.testrunner',
69− ]
45+ 'test': dev_requirements
7046 },
7147 entry_points={
7248 'console_scripts': [
@@ -86,6 +62,9 @@ setup(
8662 'static/*/*/*/*/*.*',
8763 'templates/*/*.*',
8864 'templates/*/*/*.*',
65+ 'tests/*',
66+ 'tests/*/*',
67+ 'tests/*/*/*',
8968 'translations/*/*/*'
9069 ],
9170 },
searx/tests/__init__.py → tests/__init__.pyrenamed

The content is the same.

searx/tests/engines/__init__.py → tests/robot/__init__.pyrenamed

The content is the same.

searx/tests/robot/test_basic.robot → tests/robot/test_basic.robotrenamed

The content is the same.

searx/tests/test_robot.py → tests/test_robot.pyrenamed

The content is the same.

searx/tests/robot/__init__.py → tests/unit/__init__.pyrenamed

The content is the same.

tests/unit/engines/__init__.pynew file

No changes to the content.

searx/tests/engines/test_bing.py → tests/unit/engines/test_bing.pyrenamed

The content is the same.

searx/tests/engines/test_bing_images.py → tests/unit/engines/test_bing_images.pyrenamed

The content is the same.

searx/tests/engines/test_bing_news.py → tests/unit/engines/test_bing_news.pyrenamed

The content is the same.

searx/tests/engines/test_blekko_images.py → tests/unit/engines/test_blekko_images.pyrenamed

The content is the same.

searx/tests/engines/test_btdigg.py → tests/unit/engines/test_btdigg.pyrenamed

The content is the same.

searx/tests/engines/test_currency_convert.py → tests/unit/engines/test_currency_convert.pyrenamed

The content is the same.

searx/tests/engines/test_dailymotion.py → tests/unit/engines/test_dailymotion.pyrenamed

The content is the same.

searx/tests/engines/test_deezer.py → tests/unit/engines/test_deezer.pyrenamed

The content is the same.

searx/tests/engines/test_deviantart.py → tests/unit/engines/test_deviantart.pyrenamed

The content is the same.

searx/tests/engines/test_digg.py → tests/unit/engines/test_digg.pyrenamed

The content is the same.

searx/tests/engines/test_duckduckgo.py → tests/unit/engines/test_duckduckgo.pyrenamed

The content is the same.

searx/tests/engines/test_duckduckgo_definitions.py → tests/unit/engines/test_duckduckgo_definitions.pyrenamed

The content is the same.

searx/tests/engines/test_dummy.py → tests/unit/engines/test_dummy.pyrenamed

The content is the same.

searx/tests/engines/test_faroo.py → tests/unit/engines/test_faroo.pyrenamed

The content is the same.

searx/tests/engines/test_flickr.py → tests/unit/engines/test_flickr.pyrenamed

The content is the same.

searx/tests/engines/test_flickr_noapi.py → tests/unit/engines/test_flickr_noapi.pyrenamed

The content is the same.

searx/tests/engines/test_gigablast.py → tests/unit/engines/test_gigablast.pyrenamed

The content is the same.

searx/tests/engines/test_github.py → tests/unit/engines/test_github.pyrenamed

The content is the same.

searx/tests/engines/test_google.py → tests/unit/engines/test_google.pyrenamed

The content is the same.

searx/tests/engines/test_google_images.py → tests/unit/engines/test_google_images.pyrenamed

The content is the same.

searx/tests/engines/test_google_news.py → tests/unit/engines/test_google_news.pyrenamed

The content is the same.

searx/tests/engines/test_kickass.py → tests/unit/engines/test_kickass.pyrenamed

The content is the same.

searx/tests/engines/test_mediawiki.py → tests/unit/engines/test_mediawiki.pyrenamed

The content is the same.

searx/tests/engines/test_mixcloud.py → tests/unit/engines/test_mixcloud.pyrenamed

The content is the same.

searx/tests/engines/test_openstreetmap.py → tests/unit/engines/test_openstreetmap.pyrenamed

The content is the same.

searx/tests/engines/test_photon.py → tests/unit/engines/test_photon.pyrenamed

The content is the same.

searx/tests/engines/test_piratebay.py → tests/unit/engines/test_piratebay.pyrenamed

The content is the same.

searx/tests/engines/test_qwant.py → tests/unit/engines/test_qwant.pyrenamed

The content is the same.

searx/tests/engines/test_searchcode_code.py → tests/unit/engines/test_searchcode_code.pyrenamed

The content is the same.

searx/tests/engines/test_searchcode_doc.py → tests/unit/engines/test_searchcode_doc.pyrenamed

The content is the same.

searx/tests/engines/test_soundcloud.py → tests/unit/engines/test_soundcloud.pyrenamed

The content is the same.

searx/tests/engines/test_spotify.py → tests/unit/engines/test_spotify.pyrenamed

The content is the same.

searx/tests/engines/test_stackoverflow.py → tests/unit/engines/test_stackoverflow.pyrenamed

The content is the same.

searx/tests/engines/test_startpage.py → tests/unit/engines/test_startpage.pyrenamed

The content is the same.

searx/tests/engines/test_subtitleseeker.py → tests/unit/engines/test_subtitleseeker.pyrenamed

The content is the same.

searx/tests/engines/test_swisscows.py → tests/unit/engines/test_swisscows.pyrenamed

The content is the same.

searx/tests/engines/test_twitter.py → tests/unit/engines/test_twitter.pyrenamed

The content is the same.

searx/tests/engines/test_vimeo.py → tests/unit/engines/test_vimeo.pyrenamed

The content is the same.

searx/tests/engines/test_www1x.py → tests/unit/engines/test_www1x.pyrenamed

The content is the same.

searx/tests/engines/test_www500px.py → tests/unit/engines/test_www500px.pyrenamed

The content is the same.

searx/tests/engines/test_yacy.py → tests/unit/engines/test_yacy.pyrenamed

The content is the same.

searx/tests/engines/test_yahoo.py → tests/unit/engines/test_yahoo.pyrenamed

The content is the same.

searx/tests/engines/test_yahoo_news.py → tests/unit/engines/test_yahoo_news.pyrenamed

The content is the same.

searx/tests/engines/test_youtube_api.py → tests/unit/engines/test_youtube_api.pyrenamed

The content is the same.

searx/tests/engines/test_youtube_noapi.py → tests/unit/engines/test_youtube_noapi.pyrenamed

The content is the same.

searx/tests/test_plugins.py → tests/unit/test_plugins.pyrenamed

The content is the same.

searx/tests/test_results.py → tests/unit/test_results.pyrenamed

The content is the same.

searx/tests/test_search.py → tests/unit/test_search.pyrenamed

The content is the same.

searx/tests/test_utils.py → tests/unit/test_utils.pyrenamed

The content is the same.

searx/tests/test_webapp.py → tests/unit/test_webapp.pyrenamed

The content is the same.

versions.cfgdeleted−122
@@ -1,122 +0,0 @@
1−[versions]
2−Babel = 1.3
3−Flask = 0.10.1
4−Flask-Babel = 0.9
5−Jinja2 = 2.7.3
6−MarkupSafe = 0.23
7−Pygments = 2.0.2
8−WebOb = 1.4.1
9−WebTest = 2.0.18
10−Werkzeug = 0.10.4
11−collective.recipe.omelette = 0.16
12−coverage = 3.7.1
13−decorator = 3.4.2
14−docutils = 0.12
15−flake8 = 2.4.1
16−itsdangerous = 0.24
17−mccabe = 0.3.1
18−mock = 1.0.1
19−pep8 = 1.5.7
20−plone.testing = 4.0.13
21−pyflakes = 0.8.1
22−pytz = 2015.4
23−pyyaml = 3.11
24−requests = 2.7.0
25−robotframework-debuglibrary = 0.3
26−robotframework-httplibrary = 0.4.2
27−robotframework-selenium2library = 1.7.1
28−robotsuite = 1.6.1
29−selenium = 2.46.0
30−speaklater = 1.3
31−unittest2 = 1.0.1
32−waitress = 0.8.9
33−zc.recipe.testrunner = 2.0.0
34−pyopenssl = 0.15.1
35−ndg-httpsclient = 0.4.0
36−pyasn1 = 0.1.8
37−pyasn1-modules = 0.0.6
38−certifi = 2015.11.20.1
39−
40−cffi = 1.1.2
41−cryptography = 0.9.1
42−
43−# Required by:
44−# robotsuite==1.6.1
45−# searx==0.7.0
46−lxml = 3.4.4
47−
48−# Required by:
49−# searx==0.7.0
50−python-dateutil = 2.4.2
51−
52−# Required by:
53−# searx==0.7.0
54−# zope.exceptions==4.0.7
55−# zope.interface==4.1.2
56−# zope.testrunner==4.4.9
57−setuptools = 18.0.1
58−
59−# Required by:
60−# WebTest==2.0.18
61−beautifulsoup4 = 4.3.2
62−
63−# Required by:
64−# cryptography==0.9.1
65−enum34 = 1.0.4
66−
67−# Required by:
68−# cryptography==0.9.1
69−idna = 2.0
70−
71−# Required by:
72−# cryptography==0.9.1
73−ipaddress = 1.0.7
74−
75−# Required by:
76−# robotframework-httplibrary==0.4.2
77−jsonpatch = 1.11
78−
79−# Required by:
80−# robotframework-httplibrary==0.4.2
81−jsonpointer = 1.9
82−
83−# Required by:
84−# traceback2==1.4.0
85−linecache2 = 1.0.0
86−
87−# Required by:
88−# cffi==1.1.2
89−pycparser = 2.12
90−
91−# Required by:
92−# robotframework-httplibrary==0.4.2
93−robotframework = 2.8.7
94−
95−# Required by:
96−# robotsuite==1.6.1
97−# zope.testrunner==4.4.9
98−six = 1.9.0
99−
100−# Required by:
101−# unittest2==1.0.1
102−traceback2 = 1.4.0
103−
104−# Required by:
105−# collective.recipe.omelette==0.16
106−zc.recipe.egg = 2.0.1
107−
108−# Required by:
109−# zope.testrunner==4.4.9
110−zope.exceptions = 4.0.7
111−
112−# Required by:
113−# zope.testrunner==4.4.9
114−zope.interface = 4.1.2
115−
116−# Required by:
117−# plone.testing==4.0.13
118−zope.testing = 4.2.0
119−
120−# Required by:
121−# zc.recipe.testrunner==2.0.0
122−zope.testrunner = 4.4.9