aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTarek Ziade <tarek@ziade.org>2010-05-25 12:13:44 +0200
committerTarek Ziade <tarek@ziade.org>2010-05-25 12:13:44 +0200
commitdd45c0df44049d27db2b16ba5170cd00825dc960 (patch)
treec4929503b0d945faa0ea761f9f003944628205a8
parentc68c5c96f49efec1ad6768a7679e18afe6e0a45b (diff)
downloadexternal_python_setuptools-dd45c0df44049d27db2b16ba5170cd00825dc960.tar.gz
external_python_setuptools-dd45c0df44049d27db2b16ba5170cd00825dc960.tar.bz2
external_python_setuptools-dd45c0df44049d27db2b16ba5170cd00825dc960.zip
using urlparse to extract the fragment
--HG-- branch : distribute extra : rebase_source : a377df45aa49dd8eb33c52875b590401c5ddbef8
-rw-r--r--pkg_resources.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/pkg_resources.py b/pkg_resources.py
index bd318522..6ef06296 100644
--- a/pkg_resources.py
+++ b/pkg_resources.py
@@ -14,6 +14,7 @@ method.
"""
import sys, os, zipimport, time, re, imp, types
+from urlparse import urlparse, urlunparse
try:
frozenset
@@ -2044,8 +2045,13 @@ class EntryPoint(object):
parse_map = classmethod(parse_map)
-
-
+def _remove_md5_fragment(location):
+ if not location:
+ return ''
+ parsed = urlparse(location)
+ if 'md5' in parsed[-1]:
+ return urlunparse(parsed[:-1] + ('',))
+ return location
class Distribution(object):
@@ -2079,12 +2085,13 @@ class Distribution(object):
)
from_location = classmethod(from_location)
+
hashcmp = property(
lambda self: (
getattr(self,'parsed_version',()),
self.precedence,
self.key,
- (self.location or '').split('#md5=')[0],
+ _remove_md5_fragment(self.location),
self.py_version,
self.platform
)