summary refs log tree commit diff
path: root/pkgs/tools/misc/crudini
diff options
context:
space:
mode:
authorPeter Hoeg <peter@hoeg.com>2019-09-26 21:24:42 +0800
committerPeter Hoeg <peter@hoeg.com>2019-09-26 21:24:42 +0800
commit85ecfecdbe6be48edc617e690a2a3efba3348766 (patch)
treec7d6ffaff3cfc6aada42715b056ed78e1ac37fbc /pkgs/tools/misc/crudini
parentf0fec244ca380b9d3e617ee7b419c59758c8b0f1 (diff)
downloadnixpkgs-85ecfecdbe6be48edc617e690a2a3efba3348766.tar
nixpkgs-85ecfecdbe6be48edc617e690a2a3efba3348766.tar.gz
nixpkgs-85ecfecdbe6be48edc617e690a2a3efba3348766.tar.bz2
nixpkgs-85ecfecdbe6be48edc617e690a2a3efba3348766.tar.lz
nixpkgs-85ecfecdbe6be48edc617e690a2a3efba3348766.tar.xz
nixpkgs-85ecfecdbe6be48edc617e690a2a3efba3348766.tar.zst
nixpkgs-85ecfecdbe6be48edc617e690a2a3efba3348766.zip
crudini: 0.9 -> 0.9.3
Diffstat (limited to 'pkgs/tools/misc/crudini')
-rw-r--r--pkgs/tools/misc/crudini/default.nix48
1 files changed, 27 insertions, 21 deletions
diff --git a/pkgs/tools/misc/crudini/default.nix b/pkgs/tools/misc/crudini/default.nix
index f5291d0789e..f63cd0d32c9 100644
--- a/pkgs/tools/misc/crudini/default.nix
+++ b/pkgs/tools/misc/crudini/default.nix
@@ -1,47 +1,53 @@
-{ stdenv, fetchFromGitHub, python2Packages, help2man }:
+{ stdenv, fetchFromGitHub, python2Packages, help2man, installShellFiles }:
 
-python2Packages.buildPythonApplication rec {
+let
+  # py3 is supposedly working in version 0.9.3 but the tests fail so stick to py2
+  pypkgs = python2Packages;
+
+in
+pypkgs.buildPythonApplication rec {
   pname = "crudini";
-  version = "0.9";
+  version = "0.9.3";
 
   src = fetchFromGitHub {
     owner  = "pixelb";
     repo   = "crudini";
     rev    = version;
-    sha256 = "0x9z9lsygripj88gadag398pc9zky23m16wmh8vbgw7ld1nhkiav";
+    sha256 = "0298hvg0fpk0m0bjpwryj3icksbckwqqsr9w1ain55wf5s0v24k3";
   };
 
-  nativeBuildInputs = [ help2man ];
-  propagatedBuildInputs = with python2Packages; [ iniparse ];
-
-  doCheck = true;
+  nativeBuildInputs = [ help2man installShellFiles ];
 
-  prePatch = ''
-    # make runs the unpatched version in src so we need to patch them in addition to tests
-    patchShebangs .
-  '';
+  propagatedBuildInputs = with pypkgs; [ iniparse ];
 
-  postBuild = ''
-    make all
+  postPatch = ''
+    substituteInPlace crudini-help \
+      --replace ./crudini $out/bin/crudini
+    substituteInPlace tests/test.sh \
+      --replace ..: $out/bin:
   '';
 
   postInstall = ''
-    mkdir -p $out/share/{man/man1,doc/crudini}
+    # this just creates the man page
+    make all
 
-    cp README EXAMPLES $out/share/doc/crudini/
-    for f in *.1 ; do
-      gzip -c $f > $out/share/man/man1/$(basename $f).gz
-    done
+    install -Dm444 -t $out/share/doc/${pname} README EXAMPLES
+    installManPage *.1
   '';
 
   checkPhase = ''
+    runHook preCheck
+
     pushd tests >/dev/null
-    ./test.sh
+    bash ./test.sh
+    popd >/dev/null
+
+    runHook postCheck
   '';
 
   meta = with stdenv.lib; {
     description = "A utility for manipulating ini files ";
-    homepage = http://www.pixelbeat.org/programs/crudini/;
+    homepage = "https://www.pixelbeat.org/programs/crudini/";
     license = licenses.gpl2;
     maintainers = with maintainers; [ peterhoeg ];
   };