def run_setup_py(cmd, pypath=None, path=None, data_stream=0, env=None):
 if (env is None):
  env = dict()
  for envname in os.environ:
   env[envname] = os.environ[envname]
 if (pypath is not None):
  env['PYTHONPATH'] = pypath
 if (path is not None):
  env['PATH'] = path
 if (not env.get('PATH', '')):
  env['PATH'] = _which_dirs('tar').union(_which_dirs('gzip'))
  env['PATH'] = os.pathsep.join(env['PATH'])
 cmd = ([sys.executable, 'setup.py'] + list(cmd))
 try:
  proc = _Popen(cmd, stdout=_PIPE, stderr=_PIPE, shell=(sys.platform == 'win32'), env=env)
  data = proc.communicate()[data_stream]
 except OSError:
  return (1, '')
 if hasattr(data, 'decode'):
  data = data.decode()
  data = unicodedata.normalize('NFC', data)
 return (proc.returncode, data)

def run_setup_py ( cmd , pypath = None , path = None , data_stream = 0 , env = None ) : if ( env is None ) : env = dict ( ) for envname in os . environ : env [ envname ] = os . environ [ envname ] if ( pypath is not None ) : env [ 'PYTHONPATH' ] = pypath if ( path is not None ) : env [ 'PATH' ] = path if ( not env . get ( 'PATH' , '' ) ) : env [ 'PATH' ] = _which_dirs ( 'tar' ) . union ( _which_dirs ( 'gzip' ) ) env [ 'PATH' ] = os . pathsep . join ( env [ 'PATH' ] ) cmd = ( [ sys . executable , 'setup.py' ] + list ( cmd ) ) try : proc = _Popen ( cmd , stdout = _PIPE , stderr = _PIPE , shell = ( sys . platform == 'win32' ) , env = env ) data = proc . communicate ( ) [ data_stream ] except OSError : return ( 1 , '' ) if hasattr ( data , 'decode' ) : data = data . decode ( ) data = unicodedata . normalize ( 'NFC' , data ) return ( proc . returncode , data )
execution command for tests .