1{
2 stdenv,
3 lib,
4 buildPythonPackage,
5 fetchFromGitHub,
6 libX11,
7 libXinerama,
8 libXrandr,
9 poetry-core,
10 pytestCheckHook,
11 pythonOlder,
12}:
13
14buildPythonPackage rec {
15 pname = "screeninfo";
16 version = "0.8.1";
17 format = "pyproject";
18
19 disabled = pythonOlder "3.7";
20
21 src = fetchFromGitHub {
22 owner = "rr-";
23 repo = "screeninfo";
24 tag = version;
25 hash = "sha256-TEy4wff0eRRkX98yK9054d33Tm6G6qWrd9Iv+ITcFmA=";
26 };
27
28 nativeBuildInputs = [ poetry-core ];
29
30 postPatch = ''
31 substituteInPlace screeninfo/enumerators/xinerama.py \
32 --replace 'load_library("X11")' 'ctypes.cdll.LoadLibrary("${libX11}/lib/libX11.so")' \
33 --replace 'load_library("Xinerama")' 'ctypes.cdll.LoadLibrary("${libXinerama}/lib/libXinerama.so")'
34 substituteInPlace screeninfo/enumerators/xrandr.py \
35 --replace 'load_library("X11")' 'ctypes.cdll.LoadLibrary("${libX11}/lib/libX11.so")' \
36 --replace 'load_library("Xrandr")' 'ctypes.cdll.LoadLibrary("${libXrandr}/lib/libXrandr.so")'
37 '';
38
39 nativeCheckInputs = [ pytestCheckHook ];
40
41 disabledTestPaths = [
42 # We don't have a screen
43 "tests/test_screeninfo.py"
44 ];
45
46 pythonImportsCheck = [ "screeninfo" ];
47
48 meta = with lib; {
49 broken = stdenv.hostPlatform.isDarwin;
50 description = "Fetch location and size of physical screens";
51 homepage = "https://github.com/rr-/screeninfo";
52 license = licenses.mit;
53 maintainers = with maintainers; [ nickhu ];
54 };
55}