def merge_source_requirements(sources):
 projects = set()
 merged_requirements = []
 for infile_path in (locate_file(p, must_exist=True) for p in sources):
  for req in load_requirements(infile_path):
   if req.req:
    if (req.name in projects):
     continue
    projects.add(req.name)
    merged_requirements.append(req)
   elif req.link:
    merged_requirements.append(req)
   else:
    raise RuntimeError('Unexpected requirement {0}'.format(req))
 return merged_requirements

def merge_source_requirements ( sources ) : projects = set ( ) merged_requirements = [ ] for infile_path in ( locate_file ( p , must_exist = True ) for p in sources ) : for req in load_requirements ( infile_path ) : if req . req : if ( req . name in projects ) : continue projects . add ( req . name ) merged_requirements . append ( req ) elif req . link : merged_requirements . append ( req ) else : raise RuntimeError ( 'Unexpected requirement {0}' . format ( req ) ) return merged_requirements
read requirements source files and merge its content .