File: ensurepip-disabled

package info (click to toggle)
pypy 5.6.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 97,040 kB
  • ctags: 185,069
  • sloc: python: 1,147,862; ansic: 49,642; cpp: 5,245; asm: 5,169; makefile: 529; sh: 481; xml: 232; lisp: 45
file content (52 lines) | stat: -rw-r--r-- 1,683 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
Description: Disable ensurepip in Debian for now
Origin: Debian cpython packaging
Last-Update: 2015-03-26

--- a/lib-python/2.7/ensurepip/__init__.py
+++ b/lib-python/2.7/ensurepip/__init__.py
@@ -12,6 +12,21 @@
 
 __all__ = ["version", "bootstrap"]
 
+def _ensurepip_is_disabled_in_debian():
+    if True:
+        print ('''\
+ensurepip is disabled in Debian/Ubuntu for the system python.
+
+Python modules For the system python are usually handled by dpkg and apt-get.
+
+    apt-get install pypy-<module name>
+
+Install the python-pip package to use pip itself.  Using pip together
+with the system python might have unexpected results for any system installed
+module, so use it on your own risk, or make sure to only use it in virtual
+environments.
+''')
+        sys.exit(1)
 
 # pip currently requires ssl support, so we try to provide a nicer
 # error message when that is missing (http://bugs.python.org/issue19744)
@@ -47,6 +62,7 @@
     """
     Returns a string specifying the bundled version of pip.
     """
+    _ensurepip_is_disabled_in_debian()
     whl_name = 'pip'
     wheel_names = glob.glob('/usr/share/python-wheels/%s-*.whl' % whl_name)
     if len(wheel_names) == 1:
@@ -75,6 +91,7 @@
 
     Note that calling this function will alter both sys.path and os.environ.
     """
+    _ensurepip_is_disabled_in_debian()
     if altinstall and default_pip:
         raise ValueError("Cannot use altinstall and default_pip together")
 
--- a/lib-python/2.7/test/test_ensurepip.py
+++ b/lib-python/2.7/test/test_ensurepip.py
@@ -1,4 +1,5 @@
 import unittest
+raise unittest.SkipTest('ensurepip is disabled in debian')
 import os
 import os.path
 import contextlib