diff --git a/pkgs/development/python-modules/stem/default.nix b/pkgs/development/python-modules/stem/default.nix index fd7cf8c9d6bf..21924aee174f 100644 --- a/pkgs/development/python-modules/stem/default.nix +++ b/pkgs/development/python-modules/stem/default.nix @@ -1,9 +1,8 @@ { lib, buildPythonPackage, - pythonOlder, fetchFromGitHub, - fetchpatch, + fetchurl, setuptools, cryptography, mock, @@ -12,28 +11,35 @@ buildPythonPackage rec { pname = "stem"; - version = "1.8.3-unstable-2024-02-13"; - - disabled = pythonOlder "3.6"; - + version = "1.8.3"; pyproject = true; src = fetchFromGitHub { owner = "torproject"; repo = "stem"; - rev = "9a9c7d43a7fdcde6d4a9cf95b831fb5e5923a160"; - hash = "sha256-Oc73Jx31SLzuhT9Iym5HHszKfflKZ+3aky5flXudvmI="; + tag = version; + hash = "sha256-FK7ldpOGEQ+VYLgwL7rGSGNtD/2iz11b0YOa78zNGDk="; }; patches = [ - # fixes deprecated test assertion, assertRaisesRegexp in python 3 - (fetchpatch { - url = "https://github.com/trishtzy/stem/commit/d5012a1039f05c69ebe832723ce96ecbe8f79fe1.patch"; - hash = "sha256-ozOTx4/c86sW/9Ss5eZ6ZxX63ByJT5x7JF6wBBd+VFY="; + (fetchurl { + url = "https://gitlab.archlinux.org/archlinux/packaging/packages/python-stem/-/raw/729ce635a4dbf519bab0cd4195d507b0b9bf6c9a/fix-build-cryptography.patch"; + hash = "sha256-RTh3RVpDaNRFrSoAEfMVAO1VPWmnhdd5W+M0N9AEr24="; + }) + (fetchurl { + name = "cryptography-42-compat.patch"; + url = "https://gitlab.archlinux.org/archlinux/packaging/packages/python-stem/-/raw/main/9f1fa4ac.patch"; + hash = "sha256-2pj5eeurGN9HC02U2gZibt8gNWHYU92tlETZlbaT35A="; }) ]; - nativeBuildInputs = [ setuptools ]; + postPatch = '' + # https://github.com/torproject/stem/pull/155 + substituteInPlace stem/util/test_tools.py test/integ/*/*.py test/unit/*/*.py test/unit/version.py \ + --replace-quiet assertRaisesRegexp assertRaisesRegex + ''; + + build-system = [ setuptools ]; nativeCheckInputs = [ cryptography @@ -48,13 +54,13 @@ buildPythonPackage rec { runHook postCheck ''; - meta = with lib; { - changelog = "https://github.com/torproject/stem/blob/${src.rev}/docs/change_log.rst"; + meta = { + changelog = "https://github.com/torproject/stem/blob/${src.tag}/docs/change_log.rst"; description = "Controller library that allows applications to interact with Tor"; mainProgram = "tor-prompt"; downloadPage = "https://github.com/torproject/stem"; homepage = "https://stem.torproject.org/"; - license = licenses.lgpl3Only; - maintainers = with maintainers; [ dotlambda ]; + license = lib.licenses.lgpl3Only; + maintainers = with lib.maintainers; [ dotlambda ]; }; }