def requirements_list_from_file(requirements_file, dependency_links):
 requirements = []
 with open(requirements_file) as f:
  for line in f:
   line = line.rstrip()
   if line.startswith('#'):
    continue
   elif line.startswith('--find-links'):
    link = line.split(None, 1)[1]
    dependency_links.append(link)
   else:
    parsed_requirements = parse_requirements(line)
    try:
     (req,) = list(parsed_requirements)
    except RequirementParseError as original_error:
     message = unicode(original_error)
     if (environ['HOME'] != '/srv/buildslave'):
      raise
     if (not message.startswith('Expected version spec in ')):
      raise
     if (';' not in line):
      raise
     continue
    if (getattr(req, 'marker', None) and (not req.marker.evaluate())):
     continue
    requirements.append(unicode(req))
 return requirements

def requirements_list_from_file ( requirements_file , dependency_links ) : requirements = [ ] with open ( requirements_file ) as f : for line in f : line = line . rstrip ( ) if line . startswith ( '#' ) : continue elif line . startswith ( '--find-links' ) : link = line . split ( None , 1 ) [ 1 ] dependency_links . append ( link ) else : parsed_requirements = parse_requirements ( line ) try : ( req , ) = list ( parsed_requirements ) except RequirementParseError as original_error : message = unicode ( original_error ) if ( environ [ 'HOME' ] != '/srv/buildslave' ) : raise if ( not message . startswith ( 'Expected version spec in ' ) ) : raise if ( ';' not in line ) : raise continue if ( getattr ( req , 'marker' , None ) and ( not req . marker . evaluate ( ) ) ) : continue requirements . append ( unicode ( req ) ) return requirements
parse a requirements file .