diff --git a/pkgs/development/python-modules/pystemd/default.nix b/pkgs/development/python-modules/pystemd/default.nix index f3847e030065..67143d6bfd49 100644 --- a/pkgs/development/python-modules/pystemd/default.nix +++ b/pkgs/development/python-modules/pystemd/default.nix @@ -1,13 +1,12 @@ { - buildPythonPackage, lib, - fetchPypi, + buildPythonPackage, + fetchFromGitHub, setuptools, systemd, lxml, psutil, - pytest, - mock, + pytestCheckHook, pkg-config, cython, }: @@ -17,16 +16,13 @@ buildPythonPackage rec { version = "0.13.4"; pyproject = true; - src = fetchPypi { - inherit pname version; - hash = "sha256-8G1OWyGIGnyRAEkuYMzC9LZOULTWt3c8lAE9LG8aANs="; + src = fetchFromGitHub { + owner = "systemd"; + repo = "pystemd"; + tag = "v${version}"; + hash = "sha256-Ph0buiyH2cLRXyqgA8DmpE9crb/x8OaerIoZuv8hjMI="; }; - postPatch = '' - # remove cythonized sources, build them anew to support more python version - rm pystemd/*.c - ''; - buildInputs = [ systemd ]; build-system = [ @@ -38,23 +34,24 @@ buildPythonPackage rec { pkg-config ]; - propagatedBuildInputs = [ + dependencies = [ lxml psutil ]; nativeCheckInputs = [ - mock - pytest + pytestCheckHook ]; - checkPhase = '' - runHook preCheck - # pytestCheckHook doesn't work - pytest tests - runHook postCheck + # Having the source root in `sys.path` causes import issues + preCheck = '' + cd tests ''; + disabledTestPaths = [ + "test_version.py" # Requires cstq which is not in nixpkgs + ]; + pythonImportsCheck = [ "pystemd" ]; meta = { @@ -62,7 +59,8 @@ buildPythonPackage rec { Thin Cython-based wrapper on top of libsystemd, focused on exposing the dbus API via sd-bus in an automated and easy to consume way ''; - homepage = "https://github.com/facebookincubator/pystemd/"; + homepage = "https://github.com/facebookincubator/pystemd"; + changelog = "https://github.com/systemd/pystemd/releases/tag/${src.tag}"; license = lib.licenses.lgpl21Plus; maintainers = with lib.maintainers; [ flokli ]; };