1{lib, buildPythonPackage, fetchPypi, isPy3k, incremental, ipaddress, twisted
2, automat, zope_interface, idna, pyopenssl, service-identity, pytest, mock, lsof
3, GeoIP}:
4
5buildPythonPackage rec {
6 name = "${pname}-${version}";
7 pname = "txtorcon";
8 version = "0.19.3";
9
10 checkInputs = [ pytest mock lsof GeoIP ];
11 propagatedBuildInputs = [
12 incremental twisted automat zope_interface
13 # extra dependencies required by twisted[tls]
14 idna pyopenssl service-identity
15 ] ++ lib.optionals (!isPy3k) [ ipaddress ];
16
17 src = fetchPypi {
18 inherit pname version;
19 sha256 = "1za4qag4g2lbw695v4ssxqc2aspdyknnbn2diylwg8q9g5k9cczp";
20 };
21
22 # ipaddress isn't required for Python 3 although it's in requirements.txt.
23 # Because ipaddress doesn't install on Python 3, remove the requirement so the
24 # installation of this package doesn't fail on Python 3.
25 postPatch = "" + lib.optionalString isPy3k ''
26 substituteInPlace requirements.txt --replace "ipaddress>=1.0.16" ""
27 '';
28
29 # Skip a failing test until fixed upstream:
30 # https://github.com/meejah/txtorcon/issues/250
31 checkPhase = ''
32 pytest --ignore=test/test_util.py .
33 '';
34
35 meta = {
36 description = "Twisted-based Tor controller client, with state-tracking and configuration abstractions";
37 homepage = https://github.com/meejah/txtorcon;
38 maintainers = with lib.maintainers; [ jluttine ];
39 license = lib.licenses.mit;
40 };
41}