nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 87 lines 2.0 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 installShellFiles, 6 nix-update-script, 7 python3Packages, 8}: 9 10python3Packages.buildPythonApplication rec { 11 pname = "trash-cli"; 12 version = "0.24.5.26"; 13 pyproject = true; 14 15 src = fetchFromGitHub { 16 owner = "andreafrancia"; 17 repo = "trash-cli"; 18 rev = version; 19 hash = "sha256-ltuMnxtG4jTTSZd6ZHWl8wI0oQMMFqW0HAPetZMfGtc="; 20 }; 21 22 nativeBuildInputs = [ 23 installShellFiles 24 ]; 25 26 build-system = with python3Packages; [ 27 setuptools 28 shtab # for shell completions 29 ]; 30 31 dependencies = with python3Packages; [ 32 psutil 33 six 34 ]; 35 36 nativeCheckInputs = with python3Packages; [ 37 mock 38 pytestCheckHook 39 ]; 40 41 postPatch = '' 42 sed -i '/typing/d' setup.cfg 43 ''; 44 45 doInstallCheck = true; 46 installCheckPhase = '' 47 runHook preInstallCheck 48 49 # Create a home directory with a test file. 50 HOME="$(mktemp -d)" 51 touch "$HOME/deleteme" 52 53 # Verify that trash list is initially empty. 54 [[ $($out/bin/trash-list) == "" ]] 55 56 # Trash a test file and verify that it shows up in the list. 57 $out/bin/trash "$HOME/deleteme" 58 [[ $($out/bin/trash-list) == *" $HOME/deleteme" ]] 59 60 # Empty the trash and verify that it is empty. 61 $out/bin/trash-empty 62 [[ $($out/bin/trash-list) == "" ]] 63 64 runHook postInstallCheck 65 ''; 66 67 pythonImportsCheck = [ "trashcli" ]; 68 69 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' 70 for bin in trash-empty trash-list trash-restore trash-put trash; do 71 installShellCompletion --cmd "$bin" \ 72 --bash <("$out/bin/$bin" --print-completion bash) \ 73 --zsh <("$out/bin/$bin" --print-completion zsh) 74 done 75 ''; 76 77 passthru.updateScript = nix-update-script { }; 78 79 meta = { 80 homepage = "https://github.com/andreafrancia/trash-cli"; 81 description = "Command line interface to the freedesktop.org trashcan"; 82 maintainers = [ lib.maintainers.rycee ]; 83 platforms = lib.platforms.unix; 84 license = lib.licenses.gpl2Plus; 85 mainProgram = "trash"; 86 }; 87}