Unverified Commit 45f523ae authored by Florian Klink's avatar Florian Klink Committed by GitHub
Browse files

python313Packages.pystemd: fix build, fetch src from GitHub (#438924)

parents 0b4bd7a2 756b6b88
Loading
Loading
Loading
Loading
+19 −21
Original line number Diff line number Diff line
{
  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 ];
  };