<s> """<STR_LIT>""" <EOL> import subprocess <EOL> import inspect <EOL> def use ( app = None , gl = None ) : <EOL> """<STR_LIT>""" <EOL> if app is None and gl is None : <EOL> raise TypeError ( '<STR_LIT>' ) <EOL> if app == '<STR_LIT>' : <EOL> app = '<STR_LIT>' <EOL> gl = '<STR_LIT>' <EOL> if app == '<STR_LIT>' : <EOL> from vispy . util . osmesa_gl import fix_osmesa_gl_lib <EOL> fix_osmesa_gl_lib ( ) <EOL> if gl is not None : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> if gl : <EOL> import vispy . gloo <EOL> from vispy import config <EOL> config [ '<STR_LIT>' ] = gl <EOL> vispy . gloo . gl . use_gl ( gl ) <EOL> if app : <EOL> import vispy . app <EOL> vispy . app . use_app ( app ) <EOL> def run_subprocess ( command , return_code = False , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> use_kwargs = dict ( stderr = subprocess . PIPE , stdout = subprocess . PIPE ) <EOL> use_kwargs . update ( kwargs ) <EOL> p = subprocess . Popen ( command , ** use_kwargs ) <EOL> output = p . communicate ( ) <EOL> output = [ '<STR_LIT>' if s is None else s for s in output ] <EOL> output = [ s . decode ( '<STR_LIT:utf-8>' ) if isinstance ( s , bytes ) else s for s in output ] <EOL> output = tuple ( output ) <EOL> if not return_code and p . returncode : <EOL> print ( output [ <NUM_LIT:0> ] ) <EOL> print ( output [ <NUM_LIT:1> ] ) <EOL> err_fun = subprocess . CalledProcessError . __init__ <EOL> if '<STR_LIT>' in inspect . getargspec ( err_fun ) . args : <EOL> raise subprocess . CalledProcessError ( p . returncode , command , output ) <EOL> else : <EOL> raise subprocess . CalledProcessError ( p . returncode , command ) <EOL> if return_code : <EOL> output = output + ( p . returncode , ) <EOL> return output </s>
