2023-04-29 16:46:19 +00:00
|
|
|
{ lib, fetchFromGitHub, installShellFiles, python3Packages }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
python3Packages.buildPythonApplication rec {
|
|
|
|
pname = "trash-cli";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "0.24.4.17";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "andreafrancia";
|
|
|
|
repo = "trash-cli";
|
|
|
|
rev = version;
|
2024-05-15 15:35:15 +00:00
|
|
|
hash = "sha256-pXDqn+QuhTE12zXq6A4GSGSCtYJ6hBahv2p9aYQXxaI=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-10-30 15:09:59 +00:00
|
|
|
propagatedBuildInputs = with python3Packages; [ psutil six ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
nativeBuildInputs = with python3Packages; [
|
|
|
|
installShellFiles
|
|
|
|
shtab
|
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = with python3Packages; [
|
2020-04-24 23:36:52 +00:00
|
|
|
mock
|
2021-05-20 23:08:51 +00:00
|
|
|
pytestCheckHook
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
2021-05-03 20:48:10 +00:00
|
|
|
|
2023-03-27 19:17:25 +00:00
|
|
|
postPatch = ''
|
|
|
|
sed -i '/typing/d' setup.cfg
|
|
|
|
'';
|
|
|
|
|
2021-07-24 12:14:16 +00:00
|
|
|
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
|
|
|
|
'';
|
2023-04-29 16:46:19 +00:00
|
|
|
postInstall = ''
|
|
|
|
for bin in trash-empty trash-list trash-restore trash-put trash; do
|
|
|
|
installShellCompletion --cmd "$bin" \
|
|
|
|
--bash <("$out/bin/$bin" --print-completion bash) \
|
|
|
|
--zsh <("$out/bin/$bin" --print-completion zsh)
|
|
|
|
done
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/andreafrancia/trash-cli";
|
2023-03-27 19:17:25 +00:00
|
|
|
description = "Command line interface to the freedesktop.org trashcan";
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = [ maintainers.rycee ];
|
|
|
|
platforms = platforms.unix;
|
2022-09-09 14:08:57 +00:00
|
|
|
license = licenses.gpl2Plus;
|
2021-05-03 20:48:10 +00:00
|
|
|
mainProgram = "trash";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|