1{ lib, buildPythonPackage, fetchPypi, python, mock, pythonAtLeast }:
2
3buildPythonPackage rec {
4 pname = "stem";
5 version = "1.8.1";
6
7 # As of May 2023, the master branch of stem contains fixes for Python 3.11
8 # that the last release (1.8.1) doesn't. The test suite fails on both master
9 # and the 1.8.1 release, so disabling rather than switching to an unstable
10 # source.
11 disabled = pythonAtLeast "3.11";
12
13 src = fetchPypi {
14 inherit pname version;
15 hash = "sha256-gdQ6fGaLqde8EQOy56kR6dFIKUs3PSelmujaee96Pi8=";
16 };
17
18 postPatch = ''
19 rm test/unit/installation.py
20 sed -i "/test.unit.installation/d" test/settings.cfg
21 # https://github.com/torproject/stem/issues/56
22 sed -i '/MOCK_VERSION/d' run_tests.py
23 '';
24
25 nativeCheckInputs = [ mock ];
26
27 checkPhase = ''
28 touch .gitignore
29 ${python.interpreter} run_tests.py -u
30 '';
31
32 meta = with lib; {
33 description = "Controller library that allows applications to interact with Tor";
34 homepage = "https://stem.torproject.org/";
35 license = licenses.gpl3;
36 maintainers = with maintainers; [ ];
37 };
38}