1{ lib
2, python
3, buildPythonPackage
4, fetchPypi
5, backports_abc
6, backports_ssl_match_hostname
7, certifi
8, singledispatch
9, pythonOlder
10, futures
11, version ? "5.1"
12}:
13
14let
15 versionMap = {
16 "4.5.3" = {
17 sha256 = "02jzd23l4r6fswmwxaica9ldlyc2p6q8dk6dyff7j58fmdzf853d";
18 };
19 "5.1" = {
20 sha256 = "4f66a2172cb947387193ca4c2c3e19131f1c70fa8be470ddbbd9317fd0801582";
21 };
22 };
23in
24
25with versionMap.${version};
26
27buildPythonPackage rec {
28 pname = "tornado";
29 inherit version;
30
31 propagatedBuildInputs = [ backports_abc certifi singledispatch ]
32 ++ lib.optional (pythonOlder "3.5") backports_ssl_match_hostname
33 ++ lib.optional (pythonOlder "3.2") futures;
34
35 # We specify the name of the test files to prevent
36 # https://github.com/NixOS/nixpkgs/issues/14634
37 checkPhase = ''
38 ${python.interpreter} -m unittest discover *_test.py
39 '';
40
41 src = fetchPypi {
42 inherit pname sha256 version;
43 };
44
45 __darwinAllowLocalNetworking = true;
46
47 meta = {
48 description = "A web framework and asynchronous networking library";
49 homepage = http://www.tornadoweb.org/;
50 license = lib.licenses.asl20;
51 };
52}