trash-cli: cleanup

Use wrapper instead of patch.
This commit is contained in:
Matthew Bauer 2018-05-03 00:32:44 -05:00
parent 54b90e5f96
commit 3216cf6cdf
2 changed files with 12 additions and 37 deletions

View File

@ -1,7 +1,5 @@
{ stdenv, fetchFromGitHub, fetchpatch, coreutils
, python3, python3Packages, substituteAll }:
assert stdenv.isLinux;
{ stdenv, fetchFromGitHub, fetchpatch, python3, python3Packages
, lib, makeWrapper, coreutils }:
python3Packages.buildPythonApplication rec {
name = "trash-cli-${version}";
@ -16,12 +14,6 @@ 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";
@ -30,10 +22,19 @@ 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 stdenv.lib; {
meta = with lib; {
homepage = https://github.com/andreafrancia/trash-cli;
description = "Command line tool for the desktop trash can";
maintainers = [ maintainers.rycee ];

View File

@ -1,26 +0,0 @@
--- 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)