Unverified Commit c00b9537 authored by Martin Weinelt's avatar Martin Weinelt
Browse files

python312Packages.pyvirtualdisplay: modernize, enable tests on linux

parent d7830d9e
Loading
Loading
Loading
Loading
+39 −5
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchPypi,
  substituteAll,
  xorg,

  # build-system
  setuptools,

  # tests
  easyprocess,
  entrypoint2,
  pillow,
  psutil,
  pytest-xdist,
  pytestCheckHook,
  vncdo,
}:

buildPythonPackage rec {
  pname = "pyvirtualdisplay";
  version = "3.0";
  format = "setuptools";

  propagatedBuildInputs = [ easyprocess ];
  pyproject = true;

  src = fetchPypi {
    pname = "PyVirtualDisplay";
@@ -18,8 +30,30 @@ buildPythonPackage rec {
    hash = "sha256-CXVbw86263JfsH7KVCX0PyNY078I4A0qm3kqGu3RYVk=";
  };

  # requires X server
  doCheck = false;
  patches = lib.optionals stdenv.isLinux [
    (substituteAll {
      src = ./paths.patch;
      xauth = lib.getExe xorg.xauth;
      xdpyinfo = lib.getExe xorg.xdpyinfo;
    })
  ];

  build-system = [ setuptools ];

  doCheck = stdenv.isLinux;

  nativeCheckInputs = [
    easyprocess
    entrypoint2
    pillow
    psutil
    pytest-xdist
    pytestCheckHook
    (vncdo.overridePythonAttrs { doCheck = false; })
    xorg.xorgserver
    xorg.xmessage
    xorg.xvfb
  ];

  meta = with lib; {
    description = "Python wrapper for Xvfb, Xephyr and Xvnc";
+35 −0
Original line number Diff line number Diff line
diff --git a/pyvirtualdisplay/abstractdisplay.py b/pyvirtualdisplay/abstractdisplay.py
index dd93943..c694209 100644
--- a/pyvirtualdisplay/abstractdisplay.py
+++ b/pyvirtualdisplay/abstractdisplay.py
@@ -242,7 +242,7 @@ class AbstractDisplay(object):
 
             try:
                 xdpyinfo = subprocess.Popen(
-                    ["xdpyinfo"],
+                    ["@xdpyinfo@"],
                     env=self._env(),
                     stdout=subprocess.PIPE,
                     stderr=subprocess.PIPE,
diff --git a/pyvirtualdisplay/xauth.py b/pyvirtualdisplay/xauth.py
index ce0f804..7734e21 100644
--- a/pyvirtualdisplay/xauth.py
+++ b/pyvirtualdisplay/xauth.py
@@ -14,7 +14,7 @@ def is_installed():
     """
     try:
         xauth = subprocess.Popen(
-            ["xauth", "-V"],
+            ["@xauth@", "-V"],
             # env=self._env(),
             stdout=subprocess.PIPE,
             stderr=subprocess.PIPE,
@@ -43,7 +43,7 @@ def call(*args):
     Call xauth with the given args.
     """
     xauth = subprocess.Popen(
-        ["xauth"] + list(args),
+        ["@xauth@"] + list(args),
         # env=self._env(),
         stdout=subprocess.PIPE,
         stderr=subprocess.PIPE,