1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 pythonOlder,
6 stdenv,
7 replaceVars,
8
9 # build-system
10 hatchling,
11
12 # native dependencies
13 xorg,
14
15 # tests
16 lsof,
17 pillow,
18 pytest-cov-stub,
19 pytest,
20 pyvirtualdisplay,
21 xvfb-run,
22}:
23
24buildPythonPackage rec {
25 pname = "mss";
26 version = "10.1.0";
27 pyproject = true;
28
29 disabled = pythonOlder "3.6";
30
31 src = fetchPypi {
32 inherit pname version;
33 hash = "sha256-cYK69+4WylaeKAQCi2q5vL9r5cRvwogIQPM7UTuctPg=";
34 };
35
36 patches = lib.optionals stdenv.hostPlatform.isLinux [
37 (replaceVars ./linux-paths.patch {
38 x11 = "${xorg.libX11}/lib/libX11.so";
39 xfixes = "${xorg.libXfixes}/lib/libXfixes.so";
40 xrandr = "${xorg.libXrandr}/lib/libXrandr.so";
41 })
42 ];
43
44 build-system = [ hatchling ];
45
46 doCheck = stdenv.hostPlatform.isLinux;
47
48 nativeCheckInputs = [
49 lsof
50 pillow
51 pytest-cov-stub
52 pytest
53 pyvirtualdisplay
54 xvfb-run
55 ];
56
57 checkPhase = ''
58 runHook preCheck
59 xvfb-run pytest -k "not test_grab_with_tuple and not test_grab_with_tuple_percents and not test_resource_leaks"
60 runHook postCheck
61 '';
62
63 pythonImportsCheck = [ "mss" ];
64
65 meta = with lib; {
66 description = "Cross-platform multiple screenshots module";
67 mainProgram = "mss";
68 homepage = "https://github.com/BoboTiG/python-mss";
69 changelog = "https://github.com/BoboTiG/python-mss/blob/v${version}/CHANGELOG.md";
70 license = licenses.mit;
71 maintainers = with maintainers; [ austinbutler ];
72 };
73}