1{ lib, buildPythonPackage, fetchPypi, isPy3k
2, cheroot, contextlib2, portend, routes, six
3, setuptools_scm, zc_lockfile, more-itertools
4, backports_unittest-mock, objgraph, pathpy, pytest, pytestcov
5, backports_functools_lru_cache, requests_toolbelt, pytest-services
6}:
7
8let
9 srcInfo = if isPy3k then {
10 version = "18.1.0";
11 sha256 = "4dd2f59b5af93bd9ca85f1ed0bb8295cd0f5a8ee2b84d476374d4e070aa5c615";
12 } else {
13 version = "17.4.1";
14 sha256 = "1kl17anzz535jgkn9qcy0c2m0zlafph0iv7ph3bb9mfrs2bgvagv";
15 };
16in buildPythonPackage rec {
17 pname = "CherryPy";
18 inherit (srcInfo) version;
19
20 src = fetchPypi {
21 inherit pname;
22 inherit (srcInfo) version sha256;
23 };
24
25 propagatedBuildInputs = if isPy3k then [
26 # required
27 cheroot portend more-itertools zc_lockfile
28 # optional
29 routes
30 ] else [
31 cheroot contextlib2 portend routes six zc_lockfile
32 ];
33
34 buildInputs = [ setuptools_scm ];
35
36 checkInputs = if isPy3k then [
37 objgraph pytest pytestcov pathpy requests_toolbelt pytest-services
38 ] else [
39 backports_unittest-mock objgraph pathpy pytest pytestcov backports_functools_lru_cache requests_toolbelt
40 ];
41
42 checkPhase = ''
43 # 3 out of 5 SignalHandlingTests need network access
44 # test_2_File_Concurrency also fails upstream: https://github.com/cherrypy/cherrypy/issues/1306
45 # ...and skipping it makes 2 other tests fail
46 LANG=en_US.UTF-8 pytest -k "not SignalHandlingTests and not test_4_Autoreload \
47 and not test_2_File_Concurrency and not test_3_Redirect and not test_4_File_deletion"
48 '';
49
50 meta = with lib; {
51 homepage = "http://www.cherrypy.org";
52 description = "A pythonic, object-oriented HTTP framework";
53 license = licenses.bsd3;
54 };
55}