summary refs log tree commit diff
path: root/pkgs/os-specific/linux/dstat
diff options
context:
space:
mode:
authorDaniel Nagy <danielnagy@posteo.de>2020-12-16 17:11:27 +0100
committerDaniel Nagy <danielnagy@posteo.de>2021-01-18 10:50:46 +0100
commit993c9fad7b4bcfbea0a52f33b403736cebd7f3cd (patch)
treebf8c4be8c0ca8dc80bc65844a2704b3e93f3a3d4 /pkgs/os-specific/linux/dstat
parent2b014ef903e62145157f3f0a15bd311a40ce7ab6 (diff)
downloadnixpkgs-993c9fad7b4bcfbea0a52f33b403736cebd7f3cd.tar
nixpkgs-993c9fad7b4bcfbea0a52f33b403736cebd7f3cd.tar.gz
nixpkgs-993c9fad7b4bcfbea0a52f33b403736cebd7f3cd.tar.bz2
nixpkgs-993c9fad7b4bcfbea0a52f33b403736cebd7f3cd.tar.lz
nixpkgs-993c9fad7b4bcfbea0a52f33b403736cebd7f3cd.tar.xz
nixpkgs-993c9fad7b4bcfbea0a52f33b403736cebd7f3cd.tar.zst
nixpkgs-993c9fad7b4bcfbea0a52f33b403736cebd7f3cd.zip
dstat: 0.7.3 -> 0.7.4
This change also switches dstat to python3. The patches introduced in this
commit are inspired by archlinux[0][1].

[0]:
https://github.com/archlinux/svntogit-community/blob/e688b126c561e842b459ea1cc88e725f1f2a29cc/trunk/PKGBUILD
[1]: https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/dstat&id=e688b126c561e842b459ea1cc88e725f1f2a29cc
Diffstat (limited to 'pkgs/os-specific/linux/dstat')
-rw-r--r--pkgs/os-specific/linux/dstat/default.nix31
1 files changed, 23 insertions, 8 deletions
diff --git a/pkgs/os-specific/linux/dstat/default.nix b/pkgs/os-specific/linux/dstat/default.nix
index 7d0b87609b3..76abeff42db 100644
--- a/pkgs/os-specific/linux/dstat/default.nix
+++ b/pkgs/os-specific/linux/dstat/default.nix
@@ -1,21 +1,36 @@
-{ lib, stdenv, fetchurl, python2Packages }:
+{ lib, fetchFromGitHub, fetchpatch, python3Packages }:
 
-python2Packages.buildPythonApplication rec {
+python3Packages.buildPythonApplication rec {
   pname = "dstat";
   format = "other";
-  version = "0.7.3";
+  version = "0.7.4";
 
-  src = fetchurl {
-    url = "https://github.com/dagwieers/dstat/archive/${version}.tar.gz";
-    sha256 = "16286z3y2lc9nsq8njzjkv6k2vyxrj9xiixj1k3gnsbvhlhkirj6";
+  src = fetchFromGitHub {
+    owner = "dstat-real";
+    repo = "dstat";
+    rev = "v${version}";
+    sha256 = "1qnmkhqmjd1m3if05jj29dvr5hn6kayq9bkkkh881w472c0zhp8v";
   };
 
-  propagatedBuildInputs = with python2Packages; [ python-wifi ];
+  propagatedBuildInputs = with python3Packages; [ six ];
 
-  patches = [ ./fix_pluginpath.patch ];
+  patches = [
+    ./fix_pluginpath.patch
+    # this fixes another bug with python3
+    (fetchpatch {
+      url = https://github.com/efexgee/dstat/commit/220a785321b13b6df92a536080aca6ef1cb644ad.patch ;
+      sha256 = "08kcz3yxvl35m55y7g1pr73x3bjcqnv0qlswxqyq8cqxg9zd64cn";
+    })
+  ];
 
   makeFlags = [ "prefix=$(out)" ];
 
+  # remove deprecation warnings
+  preFixup = ''
+    sed -i "s/import collections/import collections.abc/g" $out/share/dstat/dstat.py $out/bin/dstat
+    sed -i "s/collections.Sequence/collections.abc.Sequence/g" "$out"/bin/dstat
+  '';
+
   meta = with lib; {
     homepage = "http://dag.wieers.com/home-made/dstat/";
     description = "Versatile resource statistics tool";