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