diff options
Diffstat (limited to 'pkgs/tools/misc/trash-cli/default.nix')
-rw-r--r-- | pkgs/tools/misc/trash-cli/default.nix | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/pkgs/tools/misc/trash-cli/default.nix b/pkgs/tools/misc/trash-cli/default.nix index 141cceff24d..301f6163d76 100644 --- a/pkgs/tools/misc/trash-cli/default.nix +++ b/pkgs/tools/misc/trash-cli/default.nix @@ -1,49 +1,51 @@ -{ stdenv, fetchFromGitHub, fetchpatch, coreutils -, python3Packages, substituteAll }: +{ lib, fetchFromGitHub, python3Packages }: python3Packages.buildPythonApplication rec { pname = "trash-cli"; - version = "0.17.1.14"; + version = "0.21.7.23"; src = fetchFromGitHub { owner = "andreafrancia"; repo = "trash-cli"; rev = version; - sha256 = "1bqazna223ibqjwbc1wfvfnspfyrvjy8347qlrgv4cpng72n7gfi"; + sha256 = "1kdkzs9mbyac8ndc6r0wa39z8d3fj8zglqp149id4j37aydxb10l"; }; - patches = [ - (substituteAll { - src = ./nix-paths.patch; - df = "${coreutils}/bin/df"; - libc = let ext = if stdenv.isDarwin then ".dylib" else ".so.6"; - in "${stdenv.cc.libc}/lib/libc${ext}"; - }) - - # Fix build on Python 3.6. - (fetchpatch { - url = "https://github.com/andreafrancia/trash-cli/commit/a21b80d1e69783bb09376c3f60dd2f2a10578805.patch"; - sha256 = "0w49rjh433sjfc2cl5a9wlbr6kcn9f1qg905qsyv7ay3ar75wvyp"; - }) - - # Fix listing trashed files over mount points, see https://github.com/andreafrancia/trash-cli/issues/95 - (fetchpatch { - url = "https://github.com/andreafrancia/trash-cli/commit/436dfddb4c2932ba3ff696e4732750b7bdc58461.patch"; - sha256 = "02pkcz7nj67jbnqpw1943nrv95m8xyjvab4j62fa64r73fagm8m4"; - }) - ]; + propagatedBuildInputs = [ python3Packages.psutil ]; checkInputs = with python3Packages; [ - nose mock + pytestCheckHook ]; - checkPhase = "nosetests"; - meta = with stdenv.lib; { + doInstallCheck = true; + installCheckPhase = '' + runHook preInstallCheck + + # Create a home directory with a test file. + HOME="$(mktemp -d)" + touch "$HOME/deleteme" + + # Verify that trash list is initially empty. + [[ $($out/bin/trash-list) == "" ]] + + # Trash a test file and verify that it shows up in the list. + $out/bin/trash "$HOME/deleteme" + [[ $($out/bin/trash-list) == *" $HOME/deleteme" ]] + + # Empty the trash and verify that it is empty. + $out/bin/trash-empty + [[ $($out/bin/trash-list) == "" ]] + + runHook postInstallCheck + ''; + + meta = with lib; { homepage = "https://github.com/andreafrancia/trash-cli"; description = "Command line tool for the desktop trash can"; maintainers = [ maintainers.rycee ]; platforms = platforms.unix; license = licenses.gpl2; + mainProgram = "trash"; }; } |