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 = "pyclip";
22 tag = "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 ]
34 ++ lib.optionals stdenv.hostPlatform.isLinux [
35 xclip
36 xvfb-run
37 ];
38
39 checkPhase = ''
40 runHook preCheck
41 ${lib.optionalString stdenv.hostPlatform.isLinux "xvfb-run -s '-screen 0 800x600x24'"} pytest tests
42 runHook postCheck
43 '';
44
45 meta = {
46 broken = stdenv.hostPlatform.isDarwin;
47 description = "Cross-platform clipboard utilities supporting both binary and text data";
48 mainProgram = "pyclip";
49 homepage = "https://github.com/spyoungtech/pyclip";
50 license = lib.licenses.asl20;
51 maintainers = with lib.maintainers; [ ];
52 };
53}