1{ lib, stdenv
2, buildPythonPackage
3, fetchFromGitHub
4, setuptools
5, pytestCheckHook
6}:
7
8buildPythonPackage rec {
9 pname = "Send2Trash";
10 version = "1.8.1b0";
11 format = "pyproject";
12
13 src = fetchFromGitHub {
14 owner = "hsoft";
15 repo = "send2trash";
16 rev = "refs/tags/${version}";
17 hash = "sha256-kDUEfyMTk8CXSxTEi7E6kl09ohnWHeaoif+EIaIJh9Q=";
18 };
19
20 postPatch = ''
21 # Confuses setuptools validation
22 # setuptools.extern.packaging.requirements.InvalidRequirement: One of the parsed requirements in `extras_require[win32]` looks like a valid environment marker: 'sys_platform == "win32"'
23 sed -i '/win32 =/d' setup.cfg
24
25 # setuptools.extern.packaging.requirements.InvalidRequirement: One of the parsed requirements in `extras_require[objc]` looks like a valid environment marker: 'sys_platform == "darwin"'
26 sed -i '/objc =/d' setup.cfg
27 '';
28
29 nativeBuildInputs = [
30 setuptools
31 ];
32
33 doCheck = !stdenv.isDarwin;
34
35 preCheck = ''
36 export HOME=$TMPDIR
37 '';
38
39 nativeCheckInputs = [
40 pytestCheckHook
41 ];
42
43 meta = with lib; {
44 description = "Send file to trash natively under macOS, Windows and Linux";
45 homepage = "https://github.com/hsoft/send2trash";
46 changelog = "https://github.com/arsenetar/send2trash/blob/${version}/CHANGES.rst";
47 license = licenses.bsd3;
48 maintainers = with maintainers; [ ];
49 };
50}