summary refs log tree commit diff
path: root/pkgs/tools/misc
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2018-06-07 13:17:20 -0400
committerMatthew Bauer <mjbauer95@gmail.com>2018-06-07 13:17:53 -0400
commitc923e938a3de8738ac881bd8762a18961aadc796 (patch)
tree230e8fcc0083a71b99dd1e3c3011954f1f34c75f /pkgs/tools/misc
parentde4cbd048834f17e1143762be6df300d552cc80b (diff)
downloadnixlib-c923e938a3de8738ac881bd8762a18961aadc796.tar
nixlib-c923e938a3de8738ac881bd8762a18961aadc796.tar.gz
nixlib-c923e938a3de8738ac881bd8762a18961aadc796.tar.bz2
nixlib-c923e938a3de8738ac881bd8762a18961aadc796.tar.lz
nixlib-c923e938a3de8738ac881bd8762a18961aadc796.tar.xz
nixlib-c923e938a3de8738ac881bd8762a18961aadc796.tar.zst
nixlib-c923e938a3de8738ac881bd8762a18961aadc796.zip
Revert "trash-cli: cleanup"
This reverts commit 3216cf6cdf5a9d0e77af10add1a9cd5c0d6106c2.
Diffstat (limited to 'pkgs/tools/misc')
-rw-r--r--pkgs/tools/misc/trash-cli/default.nix23
-rw-r--r--pkgs/tools/misc/trash-cli/nix-paths.patch26
2 files changed, 37 insertions, 12 deletions
diff --git a/pkgs/tools/misc/trash-cli/default.nix b/pkgs/tools/misc/trash-cli/default.nix
index 7be2e3fc61d7..77308ecf2ed8 100644
--- a/pkgs/tools/misc/trash-cli/default.nix
+++ b/pkgs/tools/misc/trash-cli/default.nix
@@ -1,5 +1,7 @@
-{ stdenv, fetchFromGitHub, fetchpatch, python3, python3Packages
-, lib, makeWrapper, coreutils }:
+{ stdenv, fetchFromGitHub, fetchpatch, coreutils
+, python3, python3Packages, substituteAll }:
+
+assert stdenv.isLinux;
 
 python3Packages.buildPythonApplication rec {
   name = "trash-cli-${version}";
@@ -14,6 +16,12 @@ python3Packages.buildPythonApplication rec {
   };
 
   patches = [
+    (substituteAll {
+      src = ./nix-paths.patch;
+      df = "${coreutils}/bin/df";
+      libc = "${stdenv.cc.libc.out}/lib/libc.so.6";
+    })
+
     # Fix build on Python 3.6.
     (fetchpatch {
       url = "https://github.com/andreafrancia/trash-cli/commit/a21b80d1e69783bb09376c3f60dd2f2a10578805.patch";
@@ -22,19 +30,10 @@ python3Packages.buildPythonApplication rec {
   ];
 
   buildInputs = with python3Packages; [ nose mock ];
-  nativeBuildInputs = [ makeWrapper ];
-
-  preFixup = ''
-    for bin in $out/bin/*; do
-      wrapProgram $bin \
-        --prefix PATH : ${lib.makeBinPath [ coreutils ]} \
-        --prefix DYLD_LIBRARY_PATH : ${lib.makeSearchPath "lib" (lib.optional (stdenv.hostPlatform.libc == "glibc") (lib.getDev stdenv.cc.libc))}
-    done
-  '';
 
   checkPhase = "nosetests";
 
-  meta = with lib; {
+  meta = with stdenv.lib; {
     homepage = https://github.com/andreafrancia/trash-cli;
     description = "Command line tool for the desktop trash can";
     maintainers = [ maintainers.rycee ];
diff --git a/pkgs/tools/misc/trash-cli/nix-paths.patch b/pkgs/tools/misc/trash-cli/nix-paths.patch
new file mode 100644
index 000000000000..d7b485eec158
--- /dev/null
+++ b/pkgs/tools/misc/trash-cli/nix-paths.patch
@@ -0,0 +1,26 @@
+--- a/trashcli/list_mount_points.py	2014-12-23 10:10:43.808470486 +0100
++++ a/trashcli/list_mount_points.py	2014-12-23 10:19:04.954796457 +0100
+@@ -12,7 +12,7 @@ def mount_points_from_getmnt():
+ 
+ def mount_points_from_df():
+     import subprocess
+-    df_output = subprocess.Popen(["df", "-P"], stdout=subprocess.PIPE).stdout
++    df_output = subprocess.Popen(["@df@", "-P"], stdout=subprocess.PIPE).stdout
+     return list(_mount_points_from_df_output(df_output))
+ 
+ def _mount_points_from_df_output(df_output):
+@@ -46,13 +46,7 @@ def _mounted_filesystems_from_getmnt() :
+                     ("mnt_freq", c_int),       # Dump frequency (in days).
+                     ("mnt_passno", c_int)]     # Pass number for `fsck'.
+ 
+-    if sys.platform == "cygwin":
+-        libc_name = "cygwin1.dll"
+-    else:
+-        libc_name = find_library("c")
+-
+-    if libc_name == None :
+-        libc_name="/lib/libc.so.6" # fix for my Gentoo 4.0
++    libc_name = "@libc@"
+ 
+     libc = cdll.LoadLibrary(libc_name)
+     libc.getmntent.restype = POINTER(mntent_struct)