parameters: (editable_req, default_vcs=None)
return_statement: return req, url, None
docstring: Parses svn+http://blahblah@rev#egg=Foobar into a requirement
      (Foobar) and a URL
docstring_summary: Parses svn+http://blahblah
docstring_tokens: Parses svn + http : // blahblah
function: def parse_editable(editable_req, default_vcs=None):
      """Parses svn+http://blahblah@rev#egg=Foobar into a requirement
      (Foobar) and a URL"""
  
      url = editable_req
      extras = None
  
      # If a file path is specified with extras, strip off the extras.
      m = re.match(r'^(.+)(\[[^\]]+\])$', url)
      if m:
          url_no_extras = m.group(1)
          extras = m.group(2)
      else:
          url_no_extras = url
  
      if os.path.isdir(url_no_extras):
          if not os.path.exists(os.path.join(url_no_extras, 'setup.py')):
              raise InstallationError("Directory %r is not installable. File 'setup.py' not found." % url_no_extras)
          # Treating it as code that has already been checked out
          url_no_extras = path_to_url(url_no_extras)
  
      if url_no_extras.lower().startswith('file:'):
          if extras:
              return None, url_no_extras, pkg_resources.Requirement.parse('__placeholder__' + extras).extras
          else:
              return None, url_no_extras, None
  
      for version_control in vcs:
          if url.lower().startswith('%s:' % version_control):
              url = '%s+%s' % (version_control, url)
      if '+' not in url:
          if default_vcs:
              url = default_vcs + '+' + url
          else:
              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)
      vc_type = url.split('+', 1)[0].lower()
      if not vcs.get_backend(vc_type):
          error_message = 'For --editable=%s only ' % editable_req + \
              ', '.join([backend.name + '+URL' for backend in vcs.backends]) + \
              ' is currently supported'
          raise InstallationError(error_message)
      match = re.search(r'(?:#|#.*?&)egg=([^&]*)', editable_req)
      if (not match or not match.group(1)) and vcs.get_backend(vc_type):
          parts = [p for p in editable_req.split('#', 1)[0].split('/') if p]
          if parts[-2] in ('tags', 'branches', 'tag', 'branch'):
              req = parts[-3]
          elif parts[-1] == 'trunk':
              req = parts[-2]
          else:
              raise InstallationError(
                  '--editable=%s is not the right format; it must have #egg=Package'
                  % editable_req)
      else:
          req = match.group(1)
      ## FIXME: use package_to_requirement?
      match = re.search(r'^(.*?)(?:-dev|-\d.*)$', req)
      if match:
          # Strip off -dev, -0.2, etc.
          req = match.group(1)
      return req, url, None
function_tokens: def parse_editable ( editable_req , default_vcs = None ) : url = editable_req extras = None # If a file path is specified with extras, strip off the extras. m = re . match ( r'^(.+)(\[[^\]]+\])$' , url ) if m : url_no_extras = m . group ( 1 ) extras = m . group ( 2 ) else : url_no_extras = url if os . path . isdir ( url_no_extras ) : if not os . path . exists ( os . path . join ( url_no_extras , 'setup.py' ) ) : raise InstallationError ( "Directory %r is not installable. File 'setup.py' not found." % url_no_extras ) # Treating it as code that has already been checked out url_no_extras = path_to_url ( url_no_extras ) if url_no_extras . lower ( ) . startswith ( 'file:' ) : if extras : return None , url_no_extras , pkg_resources . Requirement . parse ( '__placeholder__' + extras ) . extras else : return None , url_no_extras , None for version_control in vcs : if url . lower ( ) . startswith ( '%s:' % version_control ) : url = '%s+%s' % ( version_control , url ) if '+' not in url : if default_vcs : url = default_vcs + '+' + url else : 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 ) vc_type = url . split ( '+' , 1 ) [ 0 ] . lower ( ) if not vcs . get_backend ( vc_type ) : error_message = 'For --editable=%s only ' % editable_req + ', ' . join ( [ backend . name + '+URL' for backend in vcs . backends ] ) + ' is currently supported' raise InstallationError ( error_message ) match = re . search ( r'(?:#|#.*?&)egg=([^&]*)' , editable_req ) if ( not match or not match . group ( 1 ) ) and vcs . get_backend ( vc_type ) : parts = [ p for p in editable_req . split ( '#' , 1 ) [ 0 ] . split ( '/' ) if p ] if parts [ - 2 ] in ( 'tags' , 'branches' , 'tag' , 'branch' ) : req = parts [ - 3 ] elif parts [ - 1 ] == 'trunk' : req = parts [ - 2 ] else : raise InstallationError ( '--editable=%s is not the right format; it must have #egg=Package' % editable_req ) else : req = match . group ( 1 ) ## FIXME: use package_to_requirement? match = re . search ( r'^(.*?)(?:-dev|-\d.*)$' , req ) if match : # Strip off -dev, -0.2, etc. req = match . group ( 1 ) return req , url , None