Hello community, here is the log from the commit of package python-PyVirtualDisplay for openSUSE:Factory checked in at 2020-03-08 22:22:04 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-PyVirtualDisplay (Old) and /work/SRC/openSUSE:Factory/.python-PyVirtualDisplay.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-PyVirtualDisplay" Sun Mar 8 22:22:04 2020 rev:14 rq:780800 version:0.2.5 Changes: -------- --- /work/SRC/openSUSE:Factory/python-PyVirtualDisplay/python-PyVirtualDisplay.changes 2019-11-22 10:20:56.013339280 +0100 +++ /work/SRC/openSUSE:Factory/.python-PyVirtualDisplay.new.26092/python-PyVirtualDisplay.changes 2020-03-08 22:22:06.320002230 +0100 @@ -1,0 +2,6 @@ +Mon Mar 2 04:20:32 UTC 2020 - Steve Kowalik <steven.kowa...@suse.com> + +- Update to 0.2.5: + * No changelog available + +------------------------------------------------------------------- Old: ---- PyVirtualDisplay-0.2.1.tar.gz New: ---- PyVirtualDisplay-0.2.5.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-PyVirtualDisplay.spec ++++++ --- /var/tmp/diff_new_pack.oxUnso/_old 2020-03-08 22:22:06.916002598 +0100 +++ /var/tmp/diff_new_pack.oxUnso/_new 2020-03-08 22:22:06.916002598 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-PyVirtualDisplay # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %bcond_without test Name: python-PyVirtualDisplay -Version: 0.2.1 +Version: 0.2.5 Release: 0 Summary: Python wrapper for Xvfb, Xephyr and Xvnc License: BSD-2-Clause ++++++ PyVirtualDisplay-0.2.1.tar.gz -> PyVirtualDisplay-0.2.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyVirtualDisplay-0.2.1/PKG-INFO new/PyVirtualDisplay-0.2.5/PKG-INFO --- old/PyVirtualDisplay-0.2.1/PKG-INFO 2016-10-03 19:10:29.000000000 +0200 +++ new/PyVirtualDisplay-0.2.5/PKG-INFO 2019-12-18 18:19:39.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: PyVirtualDisplay -Version: 0.2.1 +Version: 0.2.5 Summary: python wrapper for Xvfb, Xephyr and Xvnc Home-page: https://github.com/ponty/pyvirtualdisplay Author: ponty @@ -13,15 +13,13 @@ * documentation: http://pyvirtualdisplay.readthedocs.org * PYPI: https://pypi.python.org/pypi/pyvirtualdisplay - |Travis| |Coveralls| |Latest Version| |Supported Python versions| |License| |Downloads| |Code Health| |Documentation| + |Travis| |Coveralls| |Latest Version| |Supported Python versions| |License| |Code Health| |Documentation| Features: - python wrapper - - supported python versions: 2.6, 2.7, 3.3, 3.4, 3.5 + - supported python versions: 2.7, 3.5, 3.6, 3.7, 3.8 - back-ends: Xvfb_, Xephyr_, Xvnc_ - .. warning:: at least one back-end should be installed - Known problems: - only a few back-end options are supported @@ -57,7 +55,6 @@ * optional: pyscreenshot_ and PIL_ should be installed for ``smartdisplay`` submodule * install the program:: - # as root pip install pyvirtualdisplay Ubuntu 14.04 @@ -79,7 +76,6 @@ :: - # as root pip uninstall pyvirtualdisplay @@ -99,7 +95,9 @@ from pyvirtualdisplay import Display if __name__ == "__main__": + # start Xephyr Display(visible=1, size=(320, 240)).start() + # start Gnumeric EasyProcess('gnumeric').start() #-# @@ -125,12 +123,12 @@ with SmartDisplay(visible=0, bgcolor='black') as disp: with EasyProcess('xmessage hello'): img = disp.waitgrab() - - + + img.show() #-# - + Image: .. #-- screenshot('python -m pyvirtualdisplay.examples.screenshot3','screenshot3.png') --# @@ -166,7 +164,6 @@ ``pyvirtualdisplay.xauth.NotFoundError`` is raised. - .. _setuptools: http://peak.telecommunity.com/DevCenter/EasyInstall .. _pip: http://pip.openplans.org/ .. _Xvfb: http://en.wikipedia.org/wiki/Xvfb .. _Xephyr: http://en.wikipedia.org/wiki/Xephyr @@ -185,8 +182,6 @@ :target: https://pypi.python.org/pypi/PyVirtualDisplay/ .. |License| image:: https://img.shields.io/pypi/l/PyVirtualDisplay.svg :target: https://pypi.python.org/pypi/PyVirtualDisplay/ - .. |Downloads| image:: https://img.shields.io/pypi/dm/PyVirtualDisplay.svg - :target: https://pypi.python.org/pypi/PyVirtualDisplay/ .. |Code Health| image:: https://landscape.io/github/ponty/PyVirtualDisplay/master/landscape.svg?style=flat :target: https://landscape.io/github/ponty/PyVirtualDisplay/master .. |Documentation| image:: https://readthedocs.org/projects/pyvirtualdisplay/badge/?version=latest @@ -199,9 +194,9 @@ Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.3 -Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyVirtualDisplay-0.2.1/PyVirtualDisplay.egg-info/PKG-INFO new/PyVirtualDisplay-0.2.5/PyVirtualDisplay.egg-info/PKG-INFO --- old/PyVirtualDisplay-0.2.1/PyVirtualDisplay.egg-info/PKG-INFO 2016-10-03 19:10:28.000000000 +0200 +++ new/PyVirtualDisplay-0.2.5/PyVirtualDisplay.egg-info/PKG-INFO 2019-12-18 18:19:39.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: PyVirtualDisplay -Version: 0.2.1 +Version: 0.2.5 Summary: python wrapper for Xvfb, Xephyr and Xvnc Home-page: https://github.com/ponty/pyvirtualdisplay Author: ponty @@ -13,15 +13,13 @@ * documentation: http://pyvirtualdisplay.readthedocs.org * PYPI: https://pypi.python.org/pypi/pyvirtualdisplay - |Travis| |Coveralls| |Latest Version| |Supported Python versions| |License| |Downloads| |Code Health| |Documentation| + |Travis| |Coveralls| |Latest Version| |Supported Python versions| |License| |Code Health| |Documentation| Features: - python wrapper - - supported python versions: 2.6, 2.7, 3.3, 3.4, 3.5 + - supported python versions: 2.7, 3.5, 3.6, 3.7, 3.8 - back-ends: Xvfb_, Xephyr_, Xvnc_ - .. warning:: at least one back-end should be installed - Known problems: - only a few back-end options are supported @@ -57,7 +55,6 @@ * optional: pyscreenshot_ and PIL_ should be installed for ``smartdisplay`` submodule * install the program:: - # as root pip install pyvirtualdisplay Ubuntu 14.04 @@ -79,7 +76,6 @@ :: - # as root pip uninstall pyvirtualdisplay @@ -99,7 +95,9 @@ from pyvirtualdisplay import Display if __name__ == "__main__": + # start Xephyr Display(visible=1, size=(320, 240)).start() + # start Gnumeric EasyProcess('gnumeric').start() #-# @@ -125,12 +123,12 @@ with SmartDisplay(visible=0, bgcolor='black') as disp: with EasyProcess('xmessage hello'): img = disp.waitgrab() - - + + img.show() #-# - + Image: .. #-- screenshot('python -m pyvirtualdisplay.examples.screenshot3','screenshot3.png') --# @@ -166,7 +164,6 @@ ``pyvirtualdisplay.xauth.NotFoundError`` is raised. - .. _setuptools: http://peak.telecommunity.com/DevCenter/EasyInstall .. _pip: http://pip.openplans.org/ .. _Xvfb: http://en.wikipedia.org/wiki/Xvfb .. _Xephyr: http://en.wikipedia.org/wiki/Xephyr @@ -185,8 +182,6 @@ :target: https://pypi.python.org/pypi/PyVirtualDisplay/ .. |License| image:: https://img.shields.io/pypi/l/PyVirtualDisplay.svg :target: https://pypi.python.org/pypi/PyVirtualDisplay/ - .. |Downloads| image:: https://img.shields.io/pypi/dm/PyVirtualDisplay.svg - :target: https://pypi.python.org/pypi/PyVirtualDisplay/ .. |Code Health| image:: https://landscape.io/github/ponty/PyVirtualDisplay/master/landscape.svg?style=flat :target: https://landscape.io/github/ponty/PyVirtualDisplay/master .. |Documentation| image:: https://readthedocs.org/projects/pyvirtualdisplay/badge/?version=latest @@ -199,9 +194,9 @@ Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.3 -Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyVirtualDisplay-0.2.1/PyVirtualDisplay.egg-info/SOURCES.txt new/PyVirtualDisplay-0.2.5/PyVirtualDisplay.egg-info/SOURCES.txt --- old/PyVirtualDisplay-0.2.1/PyVirtualDisplay.egg-info/SOURCES.txt 2016-10-03 19:10:29.000000000 +0200 +++ new/PyVirtualDisplay-0.2.5/PyVirtualDisplay.egg-info/SOURCES.txt 2019-12-18 18:19:39.000000000 +0100 @@ -11,10 +11,12 @@ PyVirtualDisplay.egg-info/top_level.txt docs/.gitignore docs/__init__.py +docs/__init__.pyc docs/api.rst docs/conf.py docs/index.rst docs/screenshot.py +docs/screenshot.pyc docs/struct.rst docs/_img/lowres.png docs/_img/screenshot3.png @@ -22,6 +24,7 @@ pyvirtualdisplay/about.py pyvirtualdisplay/abstractdisplay.py pyvirtualdisplay/display.py +pyvirtualdisplay/randomize.py pyvirtualdisplay/smartdisplay.py pyvirtualdisplay/xauth.py pyvirtualdisplay/xephyr.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyVirtualDisplay-0.2.1/README.rst new/PyVirtualDisplay-0.2.5/README.rst --- old/PyVirtualDisplay-0.2.1/README.rst 2016-10-03 19:06:46.000000000 +0200 +++ new/PyVirtualDisplay-0.2.5/README.rst 2019-12-18 18:00:14.000000000 +0100 @@ -5,15 +5,13 @@ * documentation: http://pyvirtualdisplay.readthedocs.org * PYPI: https://pypi.python.org/pypi/pyvirtualdisplay -|Travis| |Coveralls| |Latest Version| |Supported Python versions| |License| |Downloads| |Code Health| |Documentation| +|Travis| |Coveralls| |Latest Version| |Supported Python versions| |License| |Code Health| |Documentation| Features: - python wrapper - - supported python versions: 2.6, 2.7, 3.3, 3.4, 3.5 + - supported python versions: 2.7, 3.5, 3.6, 3.7, 3.8 - back-ends: Xvfb_, Xephyr_, Xvnc_ -.. warning:: at least one back-end should be installed - Known problems: - only a few back-end options are supported @@ -49,7 +47,6 @@ * optional: pyscreenshot_ and PIL_ should be installed for ``smartdisplay`` submodule * install the program:: - # as root pip install pyvirtualdisplay Ubuntu 14.04 @@ -71,7 +68,6 @@ :: - # as root pip uninstall pyvirtualdisplay @@ -91,7 +87,9 @@ from pyvirtualdisplay import Display if __name__ == "__main__": + # start Xephyr Display(visible=1, size=(320, 240)).start() + # start Gnumeric EasyProcess('gnumeric').start() #-# @@ -117,12 +115,12 @@ with SmartDisplay(visible=0, bgcolor='black') as disp: with EasyProcess('xmessage hello'): img = disp.waitgrab() - - + + img.show() #-# - + Image: .. #-- screenshot('python -m pyvirtualdisplay.examples.screenshot3','screenshot3.png') --# @@ -158,7 +156,6 @@ ``pyvirtualdisplay.xauth.NotFoundError`` is raised. -.. _setuptools: http://peak.telecommunity.com/DevCenter/EasyInstall .. _pip: http://pip.openplans.org/ .. _Xvfb: http://en.wikipedia.org/wiki/Xvfb .. _Xephyr: http://en.wikipedia.org/wiki/Xephyr @@ -177,8 +174,6 @@ :target: https://pypi.python.org/pypi/PyVirtualDisplay/ .. |License| image:: https://img.shields.io/pypi/l/PyVirtualDisplay.svg :target: https://pypi.python.org/pypi/PyVirtualDisplay/ -.. |Downloads| image:: https://img.shields.io/pypi/dm/PyVirtualDisplay.svg - :target: https://pypi.python.org/pypi/PyVirtualDisplay/ .. |Code Health| image:: https://landscape.io/github/ponty/PyVirtualDisplay/master/landscape.svg?style=flat :target: https://landscape.io/github/ponty/PyVirtualDisplay/master .. |Documentation| image:: https://readthedocs.org/projects/pyvirtualdisplay/badge/?version=latest Binary files old/PyVirtualDisplay-0.2.1/docs/__init__.pyc and new/PyVirtualDisplay-0.2.5/docs/__init__.pyc differ Binary files old/PyVirtualDisplay-0.2.1/docs/screenshot.pyc and new/PyVirtualDisplay-0.2.5/docs/screenshot.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyVirtualDisplay-0.2.1/pyvirtualdisplay/about.py new/PyVirtualDisplay-0.2.5/pyvirtualdisplay/about.py --- old/PyVirtualDisplay-0.2.1/pyvirtualdisplay/about.py 2016-10-03 19:08:57.000000000 +0200 +++ new/PyVirtualDisplay-0.2.5/pyvirtualdisplay/about.py 2019-12-18 18:03:16.000000000 +0100 @@ -1 +1 @@ -__version__ = '0.2.1' +__version__ = '0.2.5' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyVirtualDisplay-0.2.1/pyvirtualdisplay/abstractdisplay.py new/PyVirtualDisplay-0.2.5/pyvirtualdisplay/abstractdisplay.py --- old/PyVirtualDisplay-0.2.1/pyvirtualdisplay/abstractdisplay.py 2016-10-03 19:06:46.000000000 +0200 +++ new/PyVirtualDisplay-0.2.5/pyvirtualdisplay/abstractdisplay.py 2019-12-18 18:00:14.000000000 +0100 @@ -1,10 +1,15 @@ -from easyprocess import EasyProcess +from easyprocess import EasyProcess, EasyProcessError import fnmatch import logging import os import time import tempfile from threading import Lock +import select +try: + import fcntl +except ImportError: + fcntl = None from pyvirtualdisplay import xauth @@ -12,35 +17,47 @@ log = logging.getLogger(__name__) -# TODO: not perfect -# randomize to avoid possible conflicts -RANDOMIZE_DISPLAY_NR = False -if RANDOMIZE_DISPLAY_NR: - import random - random.seed() - MIN_DISPLAY_NR = 1000 USED_DISPLAY_NR_LIST=[] +X_START_TIMEOUT = 10 +X_START_TIME_STEP = 0.1 +X_START_WAIT = 0.1 + +class XStartTimeoutError(Exception): + pass + class AbstractDisplay(EasyProcess): ''' Common parent for Xvfb and Xephyr ''' - - def __init__(self, use_xauth=False): - mutex.acquire() - try: - self.display = self.search_for_display() + def __init__(self, use_xauth=False, check_startup=False, randomizer=None): + with mutex: + self.display = self.search_for_display(randomizer=randomizer) while self.display in USED_DISPLAY_NR_LIST: self.display+=1 + USED_DISPLAY_NR_LIST.append(self.display) - finally: - mutex.release() - if xauth and not xauth.is_installed(): + + if use_xauth and not xauth.is_installed(): raise xauth.NotFoundError() + self.use_xauth = use_xauth self._old_xauth = None self._xauth_filename = None + self.check_startup = check_startup + if check_startup and not fcntl: + self.check_startup = False + log.warning("fcntl module can't be imported, 'check_startup' parameter has been disabled") + log.warning("fnctl module does not exist on Windows") + if self.check_startup: + rp, wp = os.pipe() + fcntl.fcntl(rp, fcntl.F_SETFD, fcntl.FD_CLOEXEC) + #to properly allow to inherit fds to subprocess on + #python 3.2+ the easyprocess needs small fix.. + fcntl.fcntl(wp, fcntl.F_SETFD, 0) + self.check_startup_fd = wp + self._check_startup_fd = rp EasyProcess.__init__(self, self._cmd) @property @@ -61,17 +78,18 @@ ls = [p for p in ls if os.path.isfile(p)] return ls - def search_for_display(self): + def search_for_display(self, randomizer=None): # search for free display - ls = map( - lambda x: int(x.split('X')[1].split('-')[0]), self.lock_files()) + ls = list(map( + lambda x: int(x.split('X')[1].split('-')[0]), self.lock_files())) if len(ls): display = max(MIN_DISPLAY_NR, max(ls) + 3) else: display = MIN_DISPLAY_NR - if RANDOMIZE_DISPLAY_NR: - display += random.randint(0, 100) + if randomizer: + display = randomizer.generate() + return display def redirect_display(self, on): @@ -105,9 +123,52 @@ self.old_display_var = os.environ.get('DISPLAY', None) self.redirect_display(True) + # wait until X server is active - # TODO: better method - time.sleep(0.1) + start_time = time.time() + if self.check_startup: + rp = self._check_startup_fd + display_check = None + rlist, wlist, xlist = select.select((rp,), (), (), X_START_TIMEOUT) + if rlist: + display_check = os.read(rp, 10).rstrip() + else: + msg = 'No display number returned by X server' + raise XStartTimeoutError(msg) + dnbs = str(self.display) + if bytes != str: + dnbs = bytes(dnbs, 'ascii') + if display_check != dnbs: + msg = 'Display number "%s" not returned by X server' + str(display_check) + raise XStartTimeoutError(msg % self.display) + + d = self.new_display_var + ok = False + while True: + try: + xdpyinfo = EasyProcess('xdpyinfo') + xdpyinfo.enable_stdout_log = False + xdpyinfo.enable_stderr_log = False + exit_code = xdpyinfo.call().return_code + except EasyProcessError: + log.warning('xdpyinfo was not found, X start can not be checked! Please install xdpyinfo!') + time.sleep(X_START_WAIT) # old method + ok = True + break + + if exit_code != 0: + pass + else: + log.info('Successfully started X with display "%s".', d) + ok = True + break + + if time.time() - start_time >= X_START_TIMEOUT: + break + time.sleep(X_START_TIME_STEP) + if not ok: + msg = 'Failed to start X on display "%s" (xdpyinfo check failed).' + raise XStartTimeoutError(msg % d) return self def stop(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyVirtualDisplay-0.2.1/pyvirtualdisplay/display.py new/PyVirtualDisplay-0.2.5/pyvirtualdisplay/display.py --- old/PyVirtualDisplay-0.2.1/pyvirtualdisplay/display.py 2016-10-03 19:06:46.000000000 +0200 +++ new/PyVirtualDisplay-0.2.5/pyvirtualdisplay/display.py 2019-06-23 18:16:23.000000000 +0200 @@ -15,7 +15,7 @@ :param backend: 'xvfb', 'xvnc' or 'xephyr', ignores ``visible`` :param xauth: If a Xauthority file should be created. ''' - def __init__(self, backend=None, visible=False, size=(1024, 768), color_depth=24, bgcolor='black', use_xauth=False, **kwargs): + def __init__(self, backend=None, visible=False, size=(1024, 768), color_depth=24, bgcolor='black', use_xauth=False, check_startup=False, randomizer=None, **kwargs): self.color_depth = color_depth self.size = size self.bgcolor = bgcolor @@ -35,8 +35,9 @@ size=size, color_depth=color_depth, bgcolor=bgcolor, + randomizer=randomizer, **kwargs) - AbstractDisplay.__init__(self, use_xauth=use_xauth) + AbstractDisplay.__init__(self, use_xauth=use_xauth, check_startup=check_startup, randomizer=randomizer) @property def display_class(self): @@ -56,4 +57,7 @@ @property def _cmd(self): self._obj.display = self.display + self._obj.check_startup = self.check_startup + if self.check_startup: + self._obj.check_startup_fd = self.check_startup_fd return self._obj._cmd diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyVirtualDisplay-0.2.1/pyvirtualdisplay/examples/lowres.py new/PyVirtualDisplay-0.2.5/pyvirtualdisplay/examples/lowres.py --- old/PyVirtualDisplay-0.2.1/pyvirtualdisplay/examples/lowres.py 2016-03-04 06:52:36.000000000 +0100 +++ new/PyVirtualDisplay-0.2.5/pyvirtualdisplay/examples/lowres.py 2018-10-09 20:46:52.000000000 +0200 @@ -2,5 +2,7 @@ from pyvirtualdisplay import Display if __name__ == "__main__": + # start Xephyr Display(visible=1, size=(320, 240)).start() + # start Gnumeric EasyProcess('gnumeric').start() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyVirtualDisplay-0.2.1/pyvirtualdisplay/randomize.py new/PyVirtualDisplay-0.2.5/pyvirtualdisplay/randomize.py --- old/PyVirtualDisplay-0.2.1/pyvirtualdisplay/randomize.py 1970-01-01 01:00:00.000000000 +0100 +++ new/PyVirtualDisplay-0.2.5/pyvirtualdisplay/randomize.py 2019-05-26 20:43:56.000000000 +0200 @@ -0,0 +1,22 @@ +import random + +class Randomizer(): + ''' + Class to generate random display numbers between a minimum and maximum + value. Note that the maximum value can be exceeded if every value between + the generated and maximum value is already in use. + ''' + def __init__(self, min_display_nr=1000, max_display_nr=1100): + self.min = min_display_nr + self.delta = max_display_nr - min_display_nr + + random.seed() + + def generate(self): + ''' + Generate a random display number + + :rtype: int + ''' + + return self.min + random.randint(0, self.delta) \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyVirtualDisplay-0.2.1/pyvirtualdisplay/xauth.py new/PyVirtualDisplay-0.2.5/pyvirtualdisplay/xauth.py --- old/PyVirtualDisplay-0.2.1/pyvirtualdisplay/xauth.py 2016-10-03 19:06:46.000000000 +0200 +++ new/PyVirtualDisplay-0.2.5/pyvirtualdisplay/xauth.py 2019-12-18 18:00:14.000000000 +0100 @@ -2,7 +2,7 @@ import os import hashlib -import easyprocess +from easyprocess import EasyProcess class NotFoundError(Exception): @@ -15,8 +15,11 @@ Return whether or not xauth is installed. ''' try: - easyprocess.EasyProcess(['xauth', '-h']).check_installed() - except easyprocess.EasyProcessCheckInstalledError: + p = EasyProcess(['xauth', '-V']) + p.enable_stdout_log = False + p.enable_stderr_log = False + p.call() + except Exception: return False else: return True @@ -34,4 +37,4 @@ ''' Call xauth with the given args. ''' - easyprocess.EasyProcess(['xauth'] + list(args)).call() + EasyProcess(['xauth'] + list(args)).call() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyVirtualDisplay-0.2.1/pyvirtualdisplay/xephyr.py new/PyVirtualDisplay-0.2.5/pyvirtualdisplay/xephyr.py --- old/PyVirtualDisplay-0.2.1/pyvirtualdisplay/xephyr.py 2014-04-09 15:00:04.000000000 +0200 +++ new/PyVirtualDisplay-0.2.5/pyvirtualdisplay/xephyr.py 2019-12-18 18:00:14.000000000 +0100 @@ -2,8 +2,6 @@ from pyvirtualdisplay.abstractdisplay import AbstractDisplay PROGRAM = 'Xephyr' -URL = None -PACKAGE = 'xephyr' class XephyrDisplay(AbstractDisplay): @@ -12,7 +10,7 @@ Xephyr is an X server outputting to a window on a pre-existing X display ''' - def __init__(self, size=(1024, 768), color_depth=24, bgcolor='black'): + def __init__(self, size=(1024, 768), color_depth=24, bgcolor='black', randomizer=None): ''' :param bgcolor: 'black' or 'white' ''' @@ -22,12 +20,14 @@ self.screen = 0 self.process = None self.display = None - AbstractDisplay.__init__(self) + AbstractDisplay.__init__(self, randomizer=randomizer) @classmethod def check_installed(cls): - EasyProcess([PROGRAM, '-help'], url=URL, - ubuntu_package=PACKAGE).check_installed() + p = EasyProcess([PROGRAM, '-help']) + p.enable_stdout_log = False + p.enable_stderr_log = False + p.call() @property def _cmd(self): @@ -35,6 +35,9 @@ dict(black='-br', white='-wr')[self.bgcolor], '-screen', 'x'.join(map(str, list(self.size) + [self.color_depth])), + '-resizeable', self.new_display_var, ] + if self.check_startup: + cmd += ['-displayfd', str(self.check_startup_fd)] return cmd diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyVirtualDisplay-0.2.1/pyvirtualdisplay/xvfb.py new/PyVirtualDisplay-0.2.5/pyvirtualdisplay/xvfb.py --- old/PyVirtualDisplay-0.2.1/pyvirtualdisplay/xvfb.py 2016-03-04 06:52:36.000000000 +0100 +++ new/PyVirtualDisplay-0.2.5/pyvirtualdisplay/xvfb.py 2019-12-18 18:00:14.000000000 +0100 @@ -5,8 +5,6 @@ log = logging.getLogger(__name__) PROGRAM = 'Xvfb' -URL = None -PACKAGE = 'xvfb' class XvfbDisplay(AbstractDisplay): @@ -17,11 +15,12 @@ hardware and no physical input devices. It emulates a dumb framebuffer using virtual memory. ''' - def __init__(self, size=(1024, 768), color_depth=24, bgcolor='black', fbdir=None): + def __init__(self, size=(1024, 768), color_depth=24, bgcolor='black', fbdir=None, dpi=None, randomizer=None): ''' :param bgcolor: 'black' or 'white' :param fbdir: If non-null, the virtual screen is memory-mapped to a file in the given directory ('-fbdir' option) + :param dpi: screen resolution in dots per inch if not None ''' self.screen = 0 self.size = size @@ -30,12 +29,15 @@ self.bgcolor = bgcolor self.display = None self.fbdir = fbdir - AbstractDisplay.__init__(self) + self.dpi = dpi + AbstractDisplay.__init__(self, randomizer=randomizer) @classmethod def check_installed(cls): - EasyProcess([PROGRAM, '-help'], url=URL, - ubuntu_package=PACKAGE).check_installed() + p = EasyProcess([PROGRAM, '-help']) + p.enable_stdout_log = False + p.enable_stderr_log = False + p.call() @property def _cmd(self): @@ -50,4 +52,8 @@ ] if self.fbdir: cmd += ['-fbdir', self.fbdir] + if self.dpi is not None: + cmd += ['-dpi', str(self.dpi)] + if self.check_startup: + cmd += ['-displayfd', str(self.check_startup_fd)] return [PROGRAM] + cmd diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyVirtualDisplay-0.2.1/pyvirtualdisplay/xvnc.py new/PyVirtualDisplay-0.2.5/pyvirtualdisplay/xvnc.py --- old/PyVirtualDisplay-0.2.1/pyvirtualdisplay/xvnc.py 2014-04-09 15:00:04.000000000 +0200 +++ new/PyVirtualDisplay-0.2.5/pyvirtualdisplay/xvnc.py 2019-12-18 18:00:14.000000000 +0100 @@ -5,18 +5,17 @@ log = logging.getLogger(__name__) PROGRAM = 'Xvnc' -URL = None -PACKAGE = 'tightvncserver' class XvncDisplay(AbstractDisplay): ''' Xvnc wrapper ''' - def __init__(self, size=(1024, 768), color_depth=24, bgcolor='black', rfbport=5900): + def __init__(self, size=(1024, 768), color_depth=24, bgcolor='black', rfbport=5900, rfbauth=None, randomizer=None): ''' :param bgcolor: 'black' or 'white' :param rfbport: Specifies the TCP port on which Xvnc listens for connections from viewers (the protocol used in VNC is called RFB - "remote framebuffer"). The default is 5900 plus the display number. + :param rfbauth: Specifies the file containing the password used to authenticate viewers. ''' self.screen = 0 self.size = size @@ -25,19 +24,28 @@ self.bgcolor = bgcolor self.display = None self.rfbport = rfbport - AbstractDisplay.__init__(self) + self.rfbauth = rfbauth + AbstractDisplay.__init__(self, randomizer=randomizer) @classmethod def check_installed(cls): - EasyProcess([PROGRAM, '-help'], url=URL, - ubuntu_package=PACKAGE).check_installed() + p = EasyProcess([PROGRAM, '-help']) + p.enable_stdout_log = False + p.enable_stderr_log = False + p.call() @property def _cmd(self): cmd = [PROGRAM, '-depth', str(self.color_depth), '-geometry', '%dx%d' % (self.size[0], self.size[1]), - '-rfbport', str(self.rfbport), - self.new_display_var, - ] + '-rfbport', str(self.rfbport)] + + if self.rfbauth: + cmd += ['-rfbauth', str(self.rfbauth)] + + cmd += [self.new_display_var,] + + if self.check_startup: + cmd += ['-displayfd', str(self.check_startup_fd)] return cmd diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyVirtualDisplay-0.2.1/setup.cfg new/PyVirtualDisplay-0.2.5/setup.cfg --- old/PyVirtualDisplay-0.2.1/setup.cfg 2016-10-03 19:10:29.000000000 +0200 +++ new/PyVirtualDisplay-0.2.5/setup.cfg 2019-12-18 18:19:39.000000000 +0100 @@ -1,5 +1,4 @@ [egg_info] tag_build = tag_date = 0 -tag_svn_revision = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyVirtualDisplay-0.2.1/setup.py new/PyVirtualDisplay-0.2.5/setup.py --- old/PyVirtualDisplay-0.2.1/setup.py 2016-03-04 06:52:36.000000000 +0100 +++ new/PyVirtualDisplay-0.2.5/setup.py 2019-12-18 18:00:14.000000000 +0100 @@ -35,19 +35,12 @@ 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 2', - # "Programming Language :: Python :: 2.3", - # "Programming Language :: Python :: 2.4", - #"Programming Language :: Python :: 2.5", - 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', - # "Programming Language :: Python :: 2 :: Only", - "Programming Language :: Python :: 3", -# 'Programming Language :: Python :: 3.0', - # "Programming Language :: Python :: 3.1", -# 'Programming Language :: Python :: 3.2', - 'Programming Language :: Python :: 3.3', - 'Programming Language :: Python :: 3.4', + "Programming Language :: Python :: 3", 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', ] install_requires = ['EasyProcess']