diff options
-rw-r--r-- | config/deps/prerequisites.json | 5 | ||||
-rw-r--r-- | config/packages/deps.json | 11 | ||||
-rw-r--r-- | devbot/xvfb.py | 13 |
3 files changed, 26 insertions, 3 deletions
diff --git a/config/deps/prerequisites.json b/config/deps/prerequisites.json index b055a68..da1844d 100644 --- a/config/deps/prerequisites.json +++ b/config/deps/prerequisites.json @@ -5,6 +5,11 @@ "name": "Xvfb" }, { + "check": "xdpyinfo", + "checker": "binary", + "name": "Xvfb" + }, + { "check": "pkg-config", "checker": "binary", "name": "pkg-config" diff --git a/config/packages/deps.json b/config/packages/deps.json index 67f0772..f07182b 100644 --- a/config/packages/deps.json +++ b/config/packages/deps.json @@ -846,6 +846,17 @@ "x11-apps" ] }, + "xdpyinfo": { + "debian": [ + "x11-utils" + ], + "fedora": [ + "xorg-x11-utils" + ], + "ubuntu": [ + "x11-utils" + ] + }, "xinit": { "debian": [ "xinit" diff --git a/devbot/xvfb.py b/devbot/xvfb.py index eed1468..a70b4c8 100644 --- a/devbot/xvfb.py +++ b/devbot/xvfb.py @@ -1,12 +1,19 @@ import os import subprocess -from gi.repository import SugarRunner - from devbot import utils +def _find_free_display(): + for i in range (100, 1000): + display = ":%s" % i + result = subprocess.call(args=["xdpyinfo", "--display", display], + stdout=utils.devnull, + stderr=subprocess.STDOUT) + if result > 0: + return display + def start(): - xvfb_display = SugarRunner.find_free_display() + xvfb_display = _find_free_display() xvfb_proc = subprocess.Popen(args=["Xvfb", xvfb_display], stdout=utils.devnull, stderr=subprocess.STDOUT) |