<s> import pkg_resources <EOL> import os <EOL> import sys <EOL> class RequirementNotFoundError ( Exception ) : <EOL> pass <EOL> def collect_dependency_paths ( package_name ) : <EOL> """<STR_LIT>""" <EOL> deps = [ ] <EOL> try : <EOL> dist = pkg_resources . get_distribution ( package_name ) <EOL> except ( pkg_resources . DistributionNotFound , ValueError ) : <EOL> message = "<STR_LIT>" . format ( package_name ) <EOL> raise RequirementNotFoundError ( message ) <EOL> if dist . has_metadata ( '<STR_LIT>' ) : <EOL> for line in dist . get_metadata ( '<STR_LIT>' ) . split ( ) : <EOL> if not os . path . split ( line ) [ <NUM_LIT:0> ] : <EOL> pkg = os . path . join ( dist . location , line ) <EOL> if not os . path . isdir ( pkg ) and os . path . exists ( pkg + '<STR_LIT>' ) : <EOL> pkg += '<STR_LIT>' <EOL> deps . append ( pkg ) <EOL> for req in dist . requires ( ) : <EOL> deps . extend ( collect_dependency_paths ( req . project_name ) ) <EOL> return deps <EOL> def parse_requirements_file ( req_file ) : <EOL> """<STR_LIT>""" <EOL> lines = [ ] <EOL> for line in req_file . readlines ( ) : <EOL> line = line . strip ( ) <EOL> if not line or line . startswith ( '<STR_LIT:#>' ) : <EOL> continue <EOL> lines . append ( line ) <EOL> return lines <EOL> def make_simlinks ( dest_dir , paths_list ) : <EOL> """<STR_LIT>""" <EOL> for path in paths_list : <EOL> dest = os . path . join ( dest_dir , os . path . split ( path ) [ - <NUM_LIT:1> ] ) <EOL> if os . path . exists ( dest ) : <EOL> if os . path . islink ( dest ) : <EOL> os . remove ( dest ) <EOL> else : <EOL> sys . stderr . write ( '<STR_LIT>' . format ( dest ) ) <EOL> continue <EOL> os . symlink ( path , dest ) <EOL> def get_config_code ( dependencies_root ) : <EOL> """<STR_LIT>""" <EOL> code = ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" . format ( dependencies_root ) ) <EOL> return code </s>
