2018-07-23 15:22:50 +00:00
|
|
|
diff -ru pip-18.0/src/pip/_internal/commands/install.py pip-18.0_patched/src/pip/_internal/commands/install.py
|
|
|
|
--- pip-18.0/src/pip/_internal/commands/install.py 2018-07-20 06:10:48.000000000 +0200
|
|
|
|
+++ pip-18.0_patched/src/pip/_internal/commands/install.py 2018-07-31 12:15:43.777317780 +0200
|
|
|
|
@@ -5,6 +5,8 @@
|
|
|
|
import operator
|
|
|
|
import os
|
2017-02-23 11:16:46 +00:00
|
|
|
import shutil
|
|
|
|
+import sys
|
|
|
|
+from os import path
|
2018-07-23 15:22:50 +00:00
|
|
|
from optparse import SUPPRESS_HELP
|
|
|
|
|
|
|
|
from pip._vendor import pkg_resources
|
|
|
|
@@ -205,6 +207,18 @@
|
|
|
|
def run(self, options, args):
|
2017-02-16 10:48:01 +00:00
|
|
|
cmdoptions.check_install_build_global(options)
|
|
|
|
|
2017-03-03 14:15:18 +00:00
|
|
|
+ def is_venv():
|
|
|
|
+ return hasattr(sys, 'real_prefix') or \
|
|
|
|
+ (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix)
|
|
|
|
+
|
|
|
|
+ # Check whether we have root privileges and aren't in venv/virtualenv
|
|
|
|
+ if os.getuid() == 0 and not is_venv():
|
2017-02-16 10:48:01 +00:00
|
|
|
+ logger.warning(
|
2017-03-21 11:09:02 +00:00
|
|
|
+ "WARNING: Running pip install with root privileges is "
|
2017-02-23 11:16:46 +00:00
|
|
|
+ "generally not a good idea. Try `%s install --user` instead."
|
|
|
|
+ % path.basename(sys.argv[0])
|
2017-02-16 10:48:01 +00:00
|
|
|
+ )
|
|
|
|
+
|
2018-07-23 15:22:50 +00:00
|
|
|
upgrade_strategy = "to-satisfy-only"
|
|
|
|
if options.upgrade:
|
|
|
|
upgrade_strategy = options.upgrade_strategy
|