1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 fetchFromGitHub,
6 fetchpatch,
7 setuptools,
8 cryptography,
9 mock,
10 python,
11}:
12
13buildPythonPackage rec {
14 pname = "stem";
15 version = "1.8.3-unstable-2024-02-13";
16
17 disabled = pythonOlder "3.6";
18
19 pyproject = true;
20
21 src = fetchFromGitHub {
22 owner = "torproject";
23 repo = "stem";
24 rev = "9a9c7d43a7fdcde6d4a9cf95b831fb5e5923a160";
25 hash = "sha256-Oc73Jx31SLzuhT9Iym5HHszKfflKZ+3aky5flXudvmI=";
26 };
27
28 patches = [
29 # fixes deprecated test assertion, assertRaisesRegexp in python 3
30 (fetchpatch {
31 url = "https://github.com/trishtzy/stem/commit/d5012a1039f05c69ebe832723ce96ecbe8f79fe1.patch";
32 hash = "sha256-ozOTx4/c86sW/9Ss5eZ6ZxX63ByJT5x7JF6wBBd+VFY=";
33 })
34 ];
35
36 nativeBuildInputs = [ setuptools ];
37
38 nativeCheckInputs = [
39 cryptography
40 mock
41 ];
42
43 checkPhase = ''
44 runHook preCheck
45
46 ${python.interpreter} run_tests.py --unit
47
48 runHook postCheck
49 '';
50
51 meta = with lib; {
52 changelog = "https://github.com/torproject/stem/blob/${src.rev}/docs/change_log.rst";
53 description = "Controller library that allows applications to interact with Tor";
54 mainProgram = "tor-prompt";
55 downloadPage = "https://github.com/torproject/stem";
56 homepage = "https://stem.torproject.org/";
57 license = licenses.lgpl3Only;
58 maintainers = with maintainers; [ dotlambda ];
59 };
60}