File: add_distribute.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 (55 lines) | stat: -rw-r--r-- 2,543 bytes parent folder | download
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Description: Add --distribute as an option in virtualenv.py
 Enable --distribute by default in virtualenv.py but add --setuptools
 and $VIRTUALENV_USE_SETUPTOOLS to fallback to the default upstream
 behavior.
Origin: vendor, http://patches.ubuntu.com/p/python-virtualenv/python-virtualenv_1.4.5-1ubuntu1.patch
Author: Piotr Ożarowski <piotr@debian.org>, Carl Chenet <chaica@ohmytux.com>

--- a/virtualenv.py
+++ b/virtualenv.py
@@ -828,9 +828,16 @@
     parser.add_option(
         '--distribute',
         dest='use_distribute',
-        action='store_true',
-        help='Use Distribute instead of Setuptools. Set environ variable '
-        'VIRTUALENV_DISTRIBUTE to make it the default ')
+        action='store_true', default=True,
+        help='Ignored.  Distribute is used by default. See --setuptools '
+        'to use Setuptools instead of Distribute.')
+
+    parser.add_option(
+        '--setuptools',
+        dest='use_distribute',
+        action='store_false',
+        help='Use Setuptools instead of Distribute. Set environ variable '
+        'VIRTUALENV_SETUPTOOLS to make it the default.')
 
     default_search_dirs = file_search_dirs()
     parser.add_option(
@@ -1012,7 +1019,7 @@
 
 
 def create_environment(home_dir, site_packages=False, clear=False,
-                       unzip_setuptools=False, use_distribute=False,
+                       unzip_setuptools=False, use_distribute=True,
                        prompt=None, search_dirs=None, never_download=False):
     """
     Creates a new environment in ``home_dir``.
@@ -1033,11 +1040,13 @@
 
     # use_distribute also is True if VIRTUALENV_DISTRIBUTE env var is set
     # we also check VIRTUALENV_USE_DISTRIBUTE for backwards compatibility
-    if use_distribute or os.environ.get('VIRTUALENV_USE_DISTRIBUTE'):
-        install_distribute(py_executable, unzip=unzip_setuptools,
+    if ((not use_distribute or os.environ.get('VIRTUALENV_USE_SETUPTOOLS')
+                or os.environ.get('VIRTUALENV_SETUPTOOLS'))
+            and not os.environ.get('VIRTUALENV_USE_DISTRIBUTE')):
+        install_setuptools(py_executable, unzip=unzip_setuptools,
                            search_dirs=search_dirs, never_download=never_download)
     else:
-        install_setuptools(py_executable, unzip=unzip_setuptools,
+        install_distribute(py_executable, unzip=unzip_setuptools,
                            search_dirs=search_dirs, never_download=never_download)
 
     install_pip(py_executable, search_dirs=search_dirs, never_download=never_download)