[devtools] make xvfb-run not wait 3s each time (closes #2265710)
Ask Xvfb to tell us when it's ready instead of unconditionally waiting 3
seconds.
Sync from
http://anonscm.debian.org/gitweb/?p=pkg-xorg/xserver/xorg-server.git;a=blob_plain;f=debian/local/xvfb-run;hb=HEAD
#!/usr/bin/env python# pylint: disable=W0142,W0403,W0404,W0613,W0622,W0622,W0704,R0904,C0103,E0611## copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr## This file is part of CubicWeb tag cube.## CubicWeb is free software: you can redistribute it and/or modify it under the# terms of the GNU Lesser General Public License as published by the Free# Software Foundation, either version 2.1 of the License, or (at your option)# any later version.## CubicWeb is distributed in the hope that it will be useful, but WITHOUT# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more# details.## You should have received a copy of the GNU Lesser General Public License along# with CubicWeb. If not, see <http://www.gnu.org/licenses/>."""Generic Setup script, takes package info from __pkginfo__.py file"""__docformat__="restructuredtext en"importosimportsysimportshutilfromos.pathimportisdir,exists,join,walktry:ifos.environ.get('NO_SETUPTOOLS'):raiseImportError()# do as there is no setuptoolsfromsetuptoolsimportsetupfromsetuptools.commandimportinstall_libUSE_SETUPTOOLS=TrueexceptImportError:fromdistutils.coreimportsetupfromdistutils.commandimportinstall_libUSE_SETUPTOOLS=Falsefromdistutils.commandimportinstall_data# import required featuresfrom__pkginfo__importmodname,version,license,description,web, \author,author_emailifexists('README'):long_description=file('README').read()else:long_description=''# import optional featuresimport__pkginfo__ifUSE_SETUPTOOLS:requires={}forentryin("__depends__",):# "__recommends__"):requires.update(getattr(__pkginfo__,entry,{}))install_requires=[("%s%s"%(d,vandvor"")).strip()ford,vinrequires.iteritems()]else:install_requires=[]distname=getattr(__pkginfo__,'distname',modname)scripts=getattr(__pkginfo__,'scripts',())include_dirs=getattr(__pkginfo__,'include_dirs',())data_files=getattr(__pkginfo__,'data_files',None)ext_modules=getattr(__pkginfo__,'ext_modules',None)dependency_links=getattr(__pkginfo__,'dependency_links',())BASE_BLACKLIST=('CVS','.svn','.hg','debian','dist','build')IGNORED_EXTENSIONS=('.pyc','.pyo','.elc','~')defensure_scripts(linux_scripts):""" Creates the proper script names required for each platform (taken from 4Suite) """fromdistutilsimportutilifutil.get_platform()[:3]=='win':scripts_=[script+'.bat'forscriptinlinux_scripts]else:scripts_=linux_scriptsreturnscripts_defexport(from_dir,to_dir,blacklist=BASE_BLACKLIST,ignore_ext=IGNORED_EXTENSIONS,verbose=True):"""make a mirror of from_dir in to_dir, omitting directories and files listed in the black list """defmake_mirror(arg,directory,fnames):"""walk handler"""fornorecursinblacklist:try:fnames.remove(norecurs)exceptValueError:passforfilenameinfnames:# don't include binary filesiffilename[-4:]inignore_ext:continueiffilename[-1]=='~':continuesrc=join(directory,filename)dest=to_dir+src[len(from_dir):]ifverbose:sys.stderr.write('%s -> %s\n'%(src,dest))ifos.path.isdir(src):ifnotexists(dest):os.mkdir(dest)else:ifexists(dest):os.remove(dest)shutil.copy2(src,dest)try:os.mkdir(to_dir)exceptOSError,ex:# file exists ?importerrnoifex.errno!=errno.EEXIST:raisewalk(from_dir,make_mirror,None)classMyInstallLib(install_lib.install_lib):"""extend install_lib command to handle package __init__.py and include_dirs variable if necessary """defrun(self):"""overridden from install_lib class"""install_lib.install_lib.run(self)# manually install included directories if anyifinclude_dirs:base=modnamefordirectoryininclude_dirs:dest=join(self.install_dir,base,directory)export(directory,dest,verbose=False)# re-enable copying data files in sys.prefixold_install_data=install_data.install_dataifUSE_SETUPTOOLS:# overwrite InstallData to use sys.prefix instead of the egg directoryclassMyInstallData(old_install_data):"""A class that manages data files installation"""defrun(self):_old_install_dir=self.install_dirifself.install_dir.endswith('egg'):self.install_dir=sys.prefixold_install_data.run(self)self.install_dir=_old_install_dirtry:importsetuptools.command.easy_install# only if easy_install avaible# monkey patch: Crack SandboxViolation verificationfromsetuptools.sandboximportDirectorySandboxasDSold_ok=DS._okdef_ok(self,path):"""Return True if ``path`` can be written during installation."""out=old_ok(self,path)# here for side effect from setuptoolsrealpath=os.path.normcase(os.path.realpath(path))allowed_path=os.path.normcase(sys.prefix)ifrealpath.startswith(allowed_path):out=TruereturnoutDS._ok=_okexceptImportError:passdefinstall(**kwargs):"""setup entry point"""ifUSE_SETUPTOOLS:if'--force-manifest'insys.argv:sys.argv.remove('--force-manifest')# install-layout option was introduced in 2.5.3-1~exp1elifsys.version_info<(2,5,4)and'--install-layout=deb'insys.argv:sys.argv.remove('--install-layout=deb')cmdclass={'install_lib':MyInstallLib}ifUSE_SETUPTOOLS:kwargs['install_requires']=install_requireskwargs['dependency_links']=dependency_linkskwargs['zip_safe']=Falsecmdclass['install_data']=MyInstallDatareturnsetup(name=distname,version=version,license=license,description=description,long_description=long_description,author=author,author_email=author_email,url=web,scripts=ensure_scripts(scripts),data_files=data_files,ext_modules=ext_modules,cmdclass=cmdclass,**kwargs)if__name__=='__main__':install()