1{ lib, fetchFromGitHub, python3Packages }:
2
3python3Packages.buildPythonApplication rec {
4 pname = "trash-cli";
5 version = "0.21.10.24";
6
7 src = fetchFromGitHub {
8 owner = "andreafrancia";
9 repo = "trash-cli";
10 rev = version;
11 sha256 = "01is32lk6prwhajvlmgn3xs4fcpmiqivizcqkj9k80jx6mqjifzs";
12 };
13
14 propagatedBuildInputs = [ python3Packages.psutil ];
15
16 checkInputs = with python3Packages; [
17 mock
18 pytestCheckHook
19 ];
20
21 doInstallCheck = true;
22 installCheckPhase = ''
23 runHook preInstallCheck
24
25 # Create a home directory with a test file.
26 HOME="$(mktemp -d)"
27 touch "$HOME/deleteme"
28
29 # Verify that trash list is initially empty.
30 [[ $($out/bin/trash-list) == "" ]]
31
32 # Trash a test file and verify that it shows up in the list.
33 $out/bin/trash "$HOME/deleteme"
34 [[ $($out/bin/trash-list) == *" $HOME/deleteme" ]]
35
36 # Empty the trash and verify that it is empty.
37 $out/bin/trash-empty
38 [[ $($out/bin/trash-list) == "" ]]
39
40 runHook postInstallCheck
41 '';
42
43 meta = with lib; {
44 homepage = "https://github.com/andreafrancia/trash-cli";
45 description = "Command line tool for the desktop trash can";
46 maintainers = [ maintainers.rycee ];
47 platforms = platforms.unix;
48 license = licenses.gpl2;
49 mainProgram = "trash";
50 };
51}