def stop(self): ''' stop display :rtype: self ''' self.redirect_display(False) EasyProcess.stop(self) if self.use_xauth: self._clear_xauth() return self
def __init__(self, use_xauth=False): mutex.acquire() try: self.display = self.search_for_display() 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(): raise xauth.NotFoundError() self.use_xauth = use_xauth self._old_xauth = None self._xauth_filename = None EasyProcess.__init__(self, self._cmd)
def start(self): ''' start display :rtype: self ''' if self.use_xauth: self._setup_xauth() EasyProcess.start(self) # https://github.com/ponty/PyVirtualDisplay/issues/2 # https://github.com/ponty/PyVirtualDisplay/issues/14 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) return self
def is_installed(): ''' Return whether or not xauth is installed. ''' try: p = EasyProcess(['xauth', '-V']) p.enable_stdout_log = False p.enable_stderr_log = False p.call() except Exception: return False else: return True
def is_installed(): """ Return whether or not xauth is installed. """ try: p = EasyProcess(["xauth", "-V"]) p.enable_stdout_log = False p.enable_stderr_log = False p.call() except Exception: return False else: return True
def check_installed(cls): p = EasyProcess([PROGRAM, '-help']) p.enable_stdout_log = False p.enable_stderr_log = False p.call()
def call(*args): ''' Call xauth with the given args. ''' EasyProcess(['xauth'] + list(args)).call()
def check_installed(cls): EasyProcess([PROGRAM, '-help'], url=URL, ubuntu_package=PACKAGE).check_installed()
def call(*args): """ Call xauth with the given args. """ EasyProcess(["xauth"] + list(args)).call()