# HG changeset patch # User Marcin Kuzminski # Date 2016-12-06 23:19:15 # Node ID a3ed8d9eafcfabe1d27997e108d5e6a2ab820c90 # Parent 9a854dd7f6f92f91fd3f2d532f47b12f40212808 dependencies: organized test requirements. - introduced requirements_test.txt file to store test requirements. - add parsing into setup.py of requirement files and passing it automatically. diff --git a/pkgs/python-packages.nix b/pkgs/python-packages.nix --- a/pkgs/python-packages.nix +++ b/pkgs/python-packages.nix @@ -1354,6 +1354,19 @@ license = [ pkgs.lib.licenses.mit ]; }; }; + pytest-sugar = super.buildPythonPackage { + name = "pytest-sugar-0.7.1"; + buildInputs = with self; []; + doCheck = false; + propagatedBuildInputs = with self; [pytest termcolor]; + src = fetchurl { + url = "https://pypi.python.org/packages/03/97/05d988b4fa870e7373e8ee4582408543b9ca2bd35c3c67b569369c6f9c49/pytest-sugar-0.7.1.tar.gz"; + md5 = "7400f7c11f3d572b2c2a3b60352d35fe"; + }; + meta = { + license = [ pkgs.lib.licenses.bsdOriginal ]; + }; + }; pytest-timeout = super.buildPythonPackage { name = "pytest-timeout-1.2.0"; buildInputs = with self; []; @@ -1499,7 +1512,7 @@ }; rhodecode-enterprise-ce = super.buildPythonPackage { name = "rhodecode-enterprise-ce-4.6.0"; - buildInputs = with self; [WebTest configobj cssselect lxml mock pytest pytest-cov pytest-runner pytest-sugar]; + buildInputs = with self; [pytest py pytest-runner pytest-catchlog pytest-cov pytest-profiling gprof2dot pytest-timeout pytest-sugar mock WebTest cov-core coverage cssselect lxml configobj]; doCheck = true; propagatedBuildInputs = with self; [Babel Beaker FormEncode Mako Markdown MarkupSafe MySQL-python Paste PasteDeploy PasteScript Pygments pygments-markdown-lexer Pylons Pyro4 Routes SQLAlchemy Tempita URLObject WebError WebHelpers WebHelpers2 WebOb WebTest Whoosh alembic amqplib anyjson appenlight-client authomatic backport-ipaddress celery channelstream colander decorator deform docutils gevent gunicorn infrae.cache ipython iso8601 kombu msgpack-python packaging psycopg2 py-gfm pycrypto pycurl pyparsing pyramid pyramid-debugtoolbar pyramid-mako pyramid-beaker pysqlite python-dateutil python-ldap python-memcached python-pam recaptcha-client repoze.lru requests simplejson subprocess32 waitress zope.cachedescriptors dogpile.cache dogpile.core psutil py-bcrypt]; src = ./.; @@ -1637,6 +1650,19 @@ license = [ { fullName = "BSD-derived (http://www.repoze.org/LICENSE.txt)"; } ]; }; }; + termcolor = super.buildPythonPackage { + name = "termcolor-1.1.0"; + buildInputs = with self; []; + doCheck = false; + propagatedBuildInputs = with self; []; + src = fetchurl { + url = "https://pypi.python.org/packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gz"; + md5 = "043e89644f8909d462fbbfa511c768df"; + }; + meta = { + license = [ pkgs.lib.licenses.mit ]; + }; + }; traitlets = super.buildPythonPackage { name = "traitlets-4.3.1"; buildInputs = with self; []; @@ -1835,30 +1861,5 @@ ### Test requirements - pytest-sugar = super.buildPythonPackage { - name = "pytest-sugar-0.7.1"; - buildInputs = with self; []; - doCheck = false; - propagatedBuildInputs = with self; [pytest termcolor]; - src = fetchurl { - url = "https://pypi.python.org/packages/03/97/05d988b4fa870e7373e8ee4582408543b9ca2bd35c3c67b569369c6f9c49/pytest-sugar-0.7.1.tar.gz"; - md5 = "7400f7c11f3d572b2c2a3b60352d35fe"; - }; - meta = { - license = [ pkgs.lib.licenses.bsdOriginal ]; - }; - }; - termcolor = super.buildPythonPackage { - name = "termcolor-1.1.0"; - buildInputs = with self; []; - doCheck = false; - propagatedBuildInputs = with self; []; - src = fetchurl { - url = "https://pypi.python.org/packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gz"; - md5 = "043e89644f8909d462fbbfa511c768df"; - }; - meta = { - license = [ pkgs.lib.licenses.mit ]; - }; - }; + } diff --git a/requirements.txt b/requirements.txt --- a/requirements.txt +++ b/requirements.txt @@ -139,16 +139,4 @@ zope.event==4.0.3 zope.interface==4.1.3 # test related requirements -pytest==3.0.5 -py==1.4.31 -pytest-runner==2.9.0 -pytest-catchlog==1.2.2 -pytest-cov==2.4.0 -pytest-profiling==1.2.2 -gprof2dot==2016.10.13 -pytest-timeout==1.2.0 -pytest-sugar==0.7.1 -mock==1.0.1 -WebTest==1.4.3 -cov-core==1.15.0 -coverage==3.7.1 +-r requirements_test.txt diff --git a/requirements_test.txt b/requirements_test.txt new file mode 100644 --- /dev/null +++ b/requirements_test.txt @@ -0,0 +1,15 @@ +pytest==3.0.5 +py==1.4.31 +pytest-runner==2.9.0 +pytest-catchlog==1.2.2 +pytest-cov==2.4.0 +pytest-profiling==1.2.2 +gprof2dot==2016.10.13 +pytest-timeout==1.2.0 +pytest-sugar==0.7.1 +mock==1.0.1 +WebTest==1.4.3 +cov-core==1.15.0 +coverage==3.7.1 +cssselect==0.9.1 +lxml==3.4.4 diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -7,11 +7,33 @@ import os import sys import platform +from pip.download import PipSession +from pip.req import parse_requirements + + if sys.version_info < (2, 7): raise Exception('RhodeCode requires Python 2.7 or later') +here = os.path.abspath(os.path.dirname(__file__)) -here = os.path.abspath(os.path.dirname(__file__)) +try: + install_reqs = parse_requirements( + os.path.join(here, 'requirements.txt'), session=PipSession()) +except TypeError: + # try pip < 6.0.0, that doesn't support session + install_reqs = parse_requirements( + os.path.join(here, 'requirements.txt')) +install_requirements = [str(ir.req) for ir in install_reqs] + +try: + test_reqs = parse_requirements( + os.path.join(here, 'requirements_test.txt'), session=PipSession()) +except TypeError: + # try pip < 6.0.0, that doesn't support session + test_reqs = parse_requirements( + os.path.join(here, 'requirements_test.txt')) +extras = ['configobj'] +test_requirements = [str(ir.req) for ir in test_reqs] + extras def _get_meta_var(name, data, callback_handler=None): @@ -115,17 +137,6 @@ else: requirements.append('psutil') requirements.append('py-bcrypt') -test_requirements = [ - 'WebTest', - 'configobj', - 'cssselect', - 'lxml', - 'mock', - 'pytest', - 'pytest-cov', - 'pytest-runner', - 'pytest-sugar', -] setup_requirements = [ 'PasteScript',