1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 buildPythonPackage,
6 pytest,
7 pythonOlder,
8 xclip,
9 xvfb-run,
10}:
11
12buildPythonPackage rec {
13 pname = "pyclip";
14 version = "0.7.0";
15 format = "setuptools";
16
17 disabled = pythonOlder "3.7";
18
19 src = fetchFromGitHub {
20 owner = "spyoungtech";
21 repo = pname;
22 rev = "refs/tags/v${version}";
23 hash = "sha256-0nOkNgT8XCwtXI9JZntkhoMspKQU602rTKBFajVKBoM=";
24 };
25
26 postPatch = ''
27 substituteInPlace setup.py \
28 --replace docs/README.md README.md
29 '';
30
31 nativeCheckInputs =
32 [ pytest ]
33 ++ lib.optionals stdenv.isLinux [
34 xclip
35 xvfb-run
36 ];
37
38 checkPhase = ''
39 runHook preCheck
40 ${lib.optionalString stdenv.isLinux "xvfb-run -s '-screen 0 800x600x24'"} pytest tests
41 runHook postCheck
42 '';
43
44 meta = {
45 broken = stdenv.isDarwin;
46 description = "Cross-platform clipboard utilities supporting both binary and text data";
47 mainProgram = "pyclip";
48 homepage = "https://github.com/spyoungtech/pyclip";
49 license = lib.licenses.asl20;
50 maintainers = with lib.maintainers; [ mcaju ];
51 };
52}