File: pip-test_urlparse_uses_fragment.patch

package info (click to toggle)
python-virtualenv 1.7.1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 2,880 kB
  • sloc: sh: 4,940; python: 2,992; makefile: 20; csh: 18
file content (36 lines) | stat: -rw-r--r-- 1,589 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Description: fix the improper use of urllib.parse.uses_fragment
Since  Python >= 2.7.3, 3.2.3 the module urlparse/urllib.parse (python3) do not
have a uses_fragment attribute. This patch tests if it exists before using it.
Origin: upstream
Bug: https://github.com/pypa/pip/issues/552
Bug-Debian: http://bugs.debian.org/677801
Last-Update: 2012-06-19

--- python-pip-1.1.orig/pip/vcs/__init__.py
+++ python-pip-1.1/pip/vcs/__init__.py
@@ -19,7 +19,9 @@ class VcsSupport(object):
     def __init__(self):
         # Register more schemes with urlparse for various version control systems
         urlparse.uses_netloc.extend(self.schemes)
-        urlparse.uses_fragment.extend(self.schemes)
+        # Python >= 2.7.4, 3.3 doesn't have uses_fragment
+        if getattr(urlparse, 'uses_fragment', None):
+            urlparse.uses_fragment.extend(self.schemes)
         super(VcsSupport, self).__init__()
 
     def __iter__(self):
--- python-pip-1.1.orig/pip/vcs/bazaar.py
+++ python-pip-1.1/pip/vcs/bazaar.py
@@ -20,8 +20,10 @@ class Bazaar(VersionControl):
 
     def __init__(self, url=None, *args, **kwargs):
         super(Bazaar, self).__init__(url, *args, **kwargs)
-        urlparse.non_hierarchical.extend(['lp'])
-        urlparse.uses_fragment.extend(['lp'])
+        # Python >= 2.7.4, 3.3 doesn't have uses_fragment or non_hierarchical
+        if getattr(urlparse, 'uses_fragment', None):
+            urlparse.uses_fragment.extend(self.schemes)
+            urlparse.non_hierarchical.extend(['lp'])
 
     def parse_vcs_bundle_file(self, content):
         url = rev = None