Skip to content

Commit

Permalink
Python 2.5 as statement removed, parse_editable without options
Browse files Browse the repository at this point in the history
  • Loading branch information
niedbalski committed May 23, 2012
1 parent 126b1ba commit e720e7f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions pip/req.py
Expand Up @@ -64,7 +64,11 @@ def __init__(self, req, comes_from, source_dir=None, editable=False,

@classmethod
def from_editable(cls, editable_req, comes_from=None, default_vcs=None):
name, url, options = parse_editable(editable_req, default_vcs)
try:
name, url, options = parse_editable(editable_req, default_vcs)
except:
name, url = parse_editable(editable_req, default_vcs)

if url.startswith('file:'):
source_dir = url_to_path(url)
else:
Expand Down Expand Up @@ -1350,8 +1354,8 @@ def _build_editable_options(req):
regexp = re.compile(r"[\?#&](?P<name>[^&=]+)=(?P<value>[^&=]+)")
matched = regexp.findall(req)

ret = dict()
if matched:
ret = dict()
for option in matched:
(name, value) = option
if name in ret:
Expand All @@ -1361,7 +1365,8 @@ def _build_editable_options(req):
except KeyError:
pass
ret[name] = value
return ret
return ret
return None

def parse_editable(editable_req, default_vcs=None):
"""
Expand Down Expand Up @@ -1397,11 +1402,11 @@ def parse_editable(editable_req, default_vcs=None):

try:
options = _build_editable_options(editable_req)
except Exception as ex:
except Exception , ex:
raise InstallationError(
'--editable=%s error in editable options: %s' % (editable_req, ex))

if 'egg' not in options:
if not options or 'egg' not in options:
req = _build_req_from_url(editable_req)
if not req:
raise InstallationError(
Expand Down

0 comments on commit e720e7f

Please sign in to comment.