git.iko.soy/typeable/nixpkgs
on master help sign in
trash-cli: cleanup

Use wrapper instead of patch.

commit3216cf6cdf5a9d0e77af10add1a9cd5c0d6106c2 authorMatthew Bauer <mjbauer95@gmail.com> dateThu 3 May 2018, 00:32 (9 years ago) parent54b90e5
2 files changed+12−37
pkgs/tools/misc/trash-cli/default.nix+12−11 pkgs/tools/misc/trash-cli/nix-paths.patch−26
pkgs/tools/misc/trash-cli/default.nix+12−11
@@ -1,7 +1,5 @@
1−{ stdenv, fetchFromGitHub, fetchpatch, coreutils
2−, python3, python3Packages, substituteAll }:
3−
4−assert stdenv.isLinux;
1+{ stdenv, fetchFromGitHub, fetchpatch, python3, python3Packages
2+, lib, makeWrapper, coreutils }:
53
64python3Packages.buildPythonApplication rec {
75 name = "trash-cli-${version}";
@@ -16,12 +14,6 @@ python3Packages.buildPythonApplication rec {
1614 };
1715
1816 patches = [
19− (substituteAll {
20− src = ./nix-paths.patch;
21− df = "${coreutils}/bin/df";
22− libc = "${stdenv.cc.libc.out}/lib/libc.so.6";
23− })
24−
2517 # Fix build on Python 3.6.
2618 (fetchpatch {
2719 url = "https://github.com/andreafrancia/trash-cli/commit/a21b80d1e69783bb09376c3f60dd2f2a10578805.patch";
@@ -30,10 +22,19 @@ python3Packages.buildPythonApplication rec {
3022 ];
3123
3224 buildInputs = with python3Packages; [ nose mock ];
25+ nativeBuildInputs = [ makeWrapper ];
26+
27+ preFixup = ''
28+ for bin in $out/bin/*; do
29+ wrapProgram $bin \
30+ --prefix PATH : ${lib.makeBinPath [ coreutils ]} \
31+ --prefix DYLD_LIBRARY_PATH : ${lib.makeSearchPath "lib" (lib.optional (stdenv.hostPlatform.libc == "glibc") (lib.getDev stdenv.cc.libc))}
32+ done
33+ '';
3334
3435 checkPhase = "nosetests";
3536
36− meta = with stdenv.lib; {
37+ meta = with lib; {
3738 homepage = https://github.com/andreafrancia/trash-cli;
3839 description = "Command line tool for the desktop trash can";
3940 maintainers = [ maintainers.rycee ];
pkgs/tools/misc/trash-cli/nix-paths.patchdeleted−26
@@ -1,26 +0,0 @@
1−--- a/trashcli/list_mount_points.py 2014-12-23 10:10:43.808470486 +0100
2−+++ a/trashcli/list_mount_points.py 2014-12-23 10:19:04.954796457 +0100
3−@@ -12,7 +12,7 @@ def mount_points_from_getmnt():
4−
5− def mount_points_from_df():
6− import subprocess
7−- df_output = subprocess.Popen(["df", "-P"], stdout=subprocess.PIPE).stdout
8−+ df_output = subprocess.Popen(["@df@", "-P"], stdout=subprocess.PIPE).stdout
9− return list(_mount_points_from_df_output(df_output))
10−
11− def _mount_points_from_df_output(df_output):
12−@@ -46,13 +46,7 @@ def _mounted_filesystems_from_getmnt() :
13− ("mnt_freq", c_int), # Dump frequency (in days).
14− ("mnt_passno", c_int)] # Pass number for `fsck'.
15−
16−- if sys.platform == "cygwin":
17−- libc_name = "cygwin1.dll"
18−- else:
19−- libc_name = find_library("c")
20−-
21−- if libc_name == None :
22−- libc_name="/lib/libc.so.6" # fix for my Gentoo 4.0
23−+ libc_name = "@libc@"
24−
25− libc = cdll.LoadLibrary(libc_name)
26− libc.getmntent.restype = POINTER(mntent_struct)