#NEWLINE# @ classmethod #NEWLINE# def from_dist( cls , dist , dependency_links , find_tags = False ) : #NEWLINE# #INDENT# location = os . path . normcase ( os . path . abspath ( dist . location ) ) #NEWLINE# comments = [ ] #NEWLINE# from pip.vcs import vcs , get_src_requirement #NEWLINE# if vcs . get_backend_name ( location ) : #NEWLINE# #INDENT# editable = True #NEWLINE# try : #NEWLINE# #INDENT# req = get_src_requirement ( dist , location , find_tags ) #NEWLINE# #UNINDENT# except InstallationError as exc : #NEWLINE# #INDENT# logger . warning ( 'Error when trying to get requirement for VCS system %s, falling back to uneditable format' , exc ) #NEWLINE# req = None #NEWLINE# #UNINDENT# if ( req is None ) : #NEWLINE# #INDENT# logger . warning ( 'Could not determine repository location of %s' , location ) #NEWLINE# comments . append ( '## !! Could not determine repository location' ) #NEWLINE# req = dist . as_requirement ( ) #NEWLINE# editable = False #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# editable = False #NEWLINE# req = dist . as_requirement ( ) #NEWLINE# specs = req . specs #NEWLINE# assert ( ( len ( specs ) == 1 ) and ( specs [ 0 ] [ 0 ] in [ '==' , '===' ] ) ) , ( 'Expected 1 spec with == or ===; specs = %r; dist = %r' % ( specs , dist ) ) #NEWLINE# version = specs [ 0 ] [ 1 ] #NEWLINE# ver_match = cls . _rev_re . search ( version ) #NEWLINE# date_match = cls . _date_re . search ( version ) #NEWLINE# if ( ver_match or date_match ) : #NEWLINE# #INDENT# svn_backend = vcs . get_backend ( 'svn' ) #NEWLINE# if svn_backend : #NEWLINE# #INDENT# svn_location = svn_backend ( ) . get_location ( dist , dependency_links ) #NEWLINE# #UNINDENT# if ( not svn_location ) : #NEWLINE# #INDENT# logger . warning ( 'Warning: cannot find svn location for %s' , req ) #NEWLINE# comments . append ( '## FIXME: could not find svn URL in dependency_links for this package:' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# comments . append ( ( '# Installing as editable to satisfy requirement %s:' % req ) ) #NEWLINE# if ver_match : #NEWLINE# #INDENT# rev = ver_match . group ( 1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# rev = ( '{%s}' % date_match . group ( 1 ) ) #NEWLINE# #UNINDENT# editable = True #NEWLINE# req = ( '%s@%s#egg=%s' % ( svn_location , rev , cls . egg_name ( dist ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return cls ( dist . project_name , req , editable , comments )