#NEWLINE# def parse_editable( editable_req , default_vcs = None ) : #NEWLINE# #INDENT# 'Parses svn+http://blahblah@rev#egg=Foobar into a requirement\n    (Foobar) and a URL' #NEWLINE# url = editable_req #NEWLINE# extras = None #NEWLINE# m = re . match ( '^(.+)(\\[[^\\]]+\\])$' , url ) #NEWLINE# if m : #NEWLINE# #INDENT# url_no_extras = m . group ( 1 ) #NEWLINE# extras = m . group ( 2 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# url_no_extras = url #NEWLINE# #UNINDENT# if os . path . isdir ( match ) : #NEWLINE# #INDENT# if ( not os . path . exists ( os . path . join ( url_no_extras , 'setup.py' ) ) ) : #NEWLINE# #INDENT# raise InstallationError ( ( "Directory %r is not installable. File 'setup.py' not found." % url_no_extras ) ) #NEWLINE# #UNINDENT# url_no_extras = path_to_url ( url_no_extras ) #NEWLINE# #UNINDENT# if url_no_extras . lower ( ) . startswith ( 'file:' ) : #NEWLINE# #INDENT# if extras : #NEWLINE# #INDENT# return ( None , url_no_extras , pkg_resources . Requirement . parse ( ( '__placeholder__' + extras ) ) . extras ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return ( None , url_no_extras , None ) #NEWLINE# #UNINDENT# #UNINDENT# for version_control in vcs : #NEWLINE# #INDENT# if url . lower ( ) . startswith ( ( '%s:' % version_control ) ) : #NEWLINE# #INDENT# url = ( '%s+%s' % ( version_control , url ) ) #NEWLINE# #UNINDENT# #UNINDENT# if ( '+' not in url ) : #NEWLINE# #INDENT# if default_vcs : #NEWLINE# #INDENT# url = ( ( default_vcs + '+' ) + url ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise InstallationError ( ( '%s should either by a path to a local project or a VCS url beginning with svn+, git+, hg+, or bzr+' % editable_req ) ) #NEWLINE# #UNINDENT# #UNINDENT# vc_type = url . split ( '+' , 1 ) [ 0 ] . lower ( ) #NEWLINE# if ( not vcs . get_backend ( vc_type ) ) : #NEWLINE# #INDENT# error_message = ( ( ( 'For --editable=%s only ' % editable_req ) + ', ' . join ( [ ( backend . name + '+URL' ) for backend in vcs . backends ] ) ) + ' is currently supported' ) #NEWLINE# raise InstallationError ( error_message ) #NEWLINE# #UNINDENT# match = re . search ( '(?:#|#.*?&)egg=([^&]*)' , editable_req ) #NEWLINE# if ( ( ( not match ) or ( not match . group ( 1 ) ) ) and vcs . get_backend ( vc_type ) ) : #NEWLINE# #INDENT# parts = [ p for p in editable_req . split ( '#' , 1 ) [ 0 ] . split ( '/' ) if p ] #NEWLINE# if ( parts [ ( - 2 ) ] in ( 'tags' , 'branches' , 'tag' , 'branch' ) ) : #NEWLINE# #INDENT# req = parts [ ( - 3 ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( parts [ ( - 1 ) ] == 'trunk' ) : #NEWLINE# #INDENT# req = parts [ ( - 2 ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise InstallationError ( ( '--editable=%s is not the right format; it must have #egg=Package' % editable_req ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# req = match . group ( 1 ) #NEWLINE# #UNINDENT# match = re . search ( '^(.*?)(?:-dev|-\\d.*)$' , req ) #NEWLINE# if match : #NEWLINE# #INDENT# req = match . group ( 1 ) #NEWLINE# #UNINDENT# return ( req , url , None )