def req_missing(names, purpose, python=True, optional=False):
 if (not (isinstance(names, tuple) or isinstance(names, list) or isinstance(names, set))):
  names = (names,)
 if (not names):
  return False
 if python:
  whatarethey_s = u'Python package'
  whatarethey_p = u'Python packages'
 else:
  whatarethey_s = whatarethey_p = u'software'
 if (len(names) == 1):
  msg = u'In order to {0}, you must install the "{1}" {2}.'.format(purpose, names[0], whatarethey_s)
 else:
  most = u'", "'.join(names[:(-1)])
  pnames = ((most + u'" and "') + names[(-1)])
  msg = u'In order to {0}, you must install the "{1}" {2}.'.format(purpose, pnames, whatarethey_p)
 if optional:
  LOGGER.warn(msg)
 else:
  LOGGER.error(msg)
  LOGGER.error(u'Exiting due to missing dependencies.')
  sys.exit(5)
 return msg

def req_missing ( names , purpose , python = True , optional = False ) : if ( not ( isinstance ( names , tuple ) or isinstance ( names , list ) or isinstance ( names , set ) ) ) : names = ( names , ) if ( not names ) : return False if python : whatarethey_s = u'Python package' whatarethey_p = u'Python packages' else : whatarethey_s = whatarethey_p = u'software' if ( len ( names ) == 1 ) : msg = u'In order to {0}, you must install the "{1}" {2}.' . format ( purpose , names [ 0 ] , whatarethey_s ) else : most = u'", "' . join ( names [ : ( - 1 ) ] ) pnames = ( ( most + u'" and "' ) + names [ ( - 1 ) ] ) msg = u'In order to {0}, you must install the "{1}" {2}.' . format ( purpose , pnames , whatarethey_p ) if optional : LOGGER . warn ( msg ) else : LOGGER . error ( msg ) LOGGER . error ( u'Exiting due to missing dependencies.' ) sys . exit ( 5 ) return msg
log that we are missing some requirements .