2024-05-26 19:58:24 +00:00
|
|
|
{ lib, fetchFromGitHub, installShellFiles, nix-update-script, python3Packages }:
|
2018-06-07 17:17:20 +00:00
|
|
|
|
2017-03-03 01:44:17 +00:00
|
|
|
python3Packages.buildPythonApplication rec {
|
2020-03-29 10:34:50 +00:00
|
|
|
pname = "trash-cli";
|
2024-05-26 19:58:24 +00:00
|
|
|
version = "0.24.5.26";
|
2014-12-23 07:35:26 +00:00
|
|
|
|
2017-03-03 01:44:17 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "andreafrancia";
|
|
|
|
repo = "trash-cli";
|
2019-09-08 23:38:31 +00:00
|
|
|
rev = version;
|
2024-05-26 19:58:24 +00:00
|
|
|
hash = "sha256-ltuMnxtG4jTTSZd6ZHWl8wI0oQMMFqW0HAPetZMfGtc=";
|
2014-12-23 07:35:26 +00:00
|
|
|
};
|
|
|
|
|
2022-10-24 08:54:22 +00:00
|
|
|
propagatedBuildInputs = with python3Packages; [ psutil six ];
|
2014-12-23 07:35:26 +00:00
|
|
|
|
2023-04-03 20:15:12 +00:00
|
|
|
nativeBuildInputs = with python3Packages; [
|
|
|
|
installShellFiles
|
|
|
|
shtab
|
|
|
|
];
|
|
|
|
|
2023-01-21 12:00:00 +00:00
|
|
|
nativeCheckInputs = with python3Packages; [
|
2019-03-04 13:52:33 +00:00
|
|
|
mock
|
2021-05-15 17:23:02 +00:00
|
|
|
pytestCheckHook
|
2019-03-04 13:52:33 +00:00
|
|
|
];
|
2021-04-29 19:58:42 +00:00
|
|
|
|
2023-03-23 15:35:23 +00:00
|
|
|
postPatch = ''
|
|
|
|
sed -i '/typing/d' setup.cfg
|
|
|
|
'';
|
|
|
|
|
2021-07-23 20:32:14 +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-03-30 08:34:55 +00:00
|
|
|
postInstall = ''
|
2023-04-03 20:15:12 +00:00
|
|
|
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)
|
2023-03-30 08:34:55 +00:00
|
|
|
done
|
|
|
|
'';
|
2014-12-23 07:35:26 +00:00
|
|
|
|
2024-05-26 19:58:24 +00:00
|
|
|
passthru.updateScript = nix-update-script { };
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://github.com/andreafrancia/trash-cli";
|
2023-03-23 15:35:23 +00:00
|
|
|
description = "Command line interface to the freedesktop.org trashcan";
|
2016-02-10 13:59:36 +00:00
|
|
|
maintainers = [ maintainers.rycee ];
|
2018-06-11 10:26:52 +00:00
|
|
|
platforms = platforms.unix;
|
2022-08-24 09:56:28 +00:00
|
|
|
license = licenses.gpl2Plus;
|
2021-04-27 17:46:48 +00:00
|
|
|
mainProgram = "trash";
|
2014-12-23 07:35:26 +00:00
|
|
|
};
|
|
|
|
}
|