about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/python-dbusmock/default.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2022-12-06 19:57:55 +0000
committerAlyssa Ross <hi@alyssa.is>2023-02-08 13:48:30 +0000
commitbf3aadfdd39aa197e18bade671fab6726349ffa4 (patch)
tree698567af766ed441d757b57a7b21e68d4a342a2b /nixpkgs/pkgs/development/python-modules/python-dbusmock/default.nix
parentf4afc5a01d9539ce09e47494e679c51f80723d07 (diff)
parent99665eb45f58d959d2cb9e49ddb960c79d596f33 (diff)
downloadnixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.gz
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.bz2
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.lz
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.xz
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.zst
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.zip
Merge commit '99665eb45f58d959d2cb9e49ddb960c79d596f33'
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/python-dbusmock/default.nix')
-rw-r--r--nixpkgs/pkgs/development/python-modules/python-dbusmock/default.nix61
1 files changed, 40 insertions, 21 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/python-dbusmock/default.nix b/nixpkgs/pkgs/development/python-modules/python-dbusmock/default.nix
index 60e6f2e74552..cc8181e7325c 100644
--- a/nixpkgs/pkgs/development/python-modules/python-dbusmock/default.nix
+++ b/nixpkgs/pkgs/development/python-modules/python-dbusmock/default.nix
@@ -1,29 +1,54 @@
-{ lib, buildPythonPackage, fetchFromGitHub, runtimeShell,
-  nose, dbus, dbus-python, pygobject3,
-  which, pyflakes, pycodestyle, bluez, networkmanager
+{ lib
+, buildPythonPackage
+, fetchFromGitHub
+, nose
+, dbus
+, dbus-python
+, pygobject3
+, bluez
+, networkmanager
+, setuptools-scm
+, runCommand
 }:
 
-buildPythonPackage rec {
+let
+  # Cannot just add it to path in preCheck since that attribute will be passed to
+  # mkDerivation even with doCheck = false, causing a dependency cycle.
+  pbap-client = runCommand "pbap-client" { } ''
+    mkdir -p "$out/bin"
+    ln -s "${bluez.test}/test/pbap-client" "$out/bin/pbap-client"
+  '';
+in buildPythonPackage rec {
   pname = "python-dbusmock";
-  version = "0.25.0";
+  version = "0.28.4";
 
   src = fetchFromGitHub {
     owner = "martinpitt";
     repo = pname;
-    rev = version;
-    sha256 = "0zg2aib0k6hc1vvlbdcmp003m85dvkv7pndzgkc4vv2y9qpi0jp9";
+    rev = "refs/tags/${version}";
+    sha256 = "sha256-gsGg9zHVyDTCVZmFUI8qqXDt0ui+o3hPwjRlsYUmShg=";
   };
 
-  prePatch = ''
-    substituteInPlace tests/test_code.py \
-      --replace "pyflakes3" "pyflakes" \
-      --replace "/bin/bash" "${runtimeShell}" \
-      --replace "--ignore=E124,E402,E731,W504" "--ignore=E124,E402,E731,W504,E501" # ignore long lines too
-  '';
+  SETUPTOOLS_SCM_PRETEND_VERSION = version;
+
+  nativeBuildInputs = [
+    setuptools-scm
+  ];
+
+  propagatedBuildInputs = [
+    dbus-python
+  ];
+
+  checkInputs = [
+    dbus
+    pygobject3
+    bluez
+    pbap-client
+    networkmanager
+    nose
+  ];
 
   # TODO: Get the rest of these tests running?
-  # This is a mocking library used as a check dependency for a single derivation.
-  # That derivation's tests pass. Maybe not worth the effort to fix these...
   NOSE_EXCLUDE = lib.concatStringsSep "," [
     "test_bluez4" # NixOS ships BlueZ5
     # These appear to fail because they're expecting to run in an Ubuntu chroot?
@@ -46,14 +71,8 @@ buildPythonPackage rec {
     # "test_networkmanager"
   ];
 
-  checkInputs = [
-    nose dbus dbus-python which pycodestyle pyflakes
-    pygobject3 bluez (lib.getOutput "test" bluez) networkmanager
-  ];
-
   checkPhase = ''
     runHook preCheck
-    export PATH="$PATH:${lib.getOutput "test" bluez}/test";
     nosetests -v
     runHook postCheck
   '';