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