Fix root warning when pip is invoked via python -m pip
Fixes https://github.com/pypa/pip/issues/6576
This commit is contained in:
parent
fa2f84fe5b
commit
de5ce17674
@ -11,7 +11,7 @@ index 1279d4a..aeb9d26 100644
|
||||
from optparse import SUPPRESS_HELP
|
||||
|
||||
from pip._vendor import pkg_resources
|
||||
@@ -217,6 +219,20 @@ class InstallCommand(RequirementCommand):
|
||||
@@ -217,6 +219,23 @@ class InstallCommand(RequirementCommand):
|
||||
|
||||
def run(self, options, args):
|
||||
cmdoptions.check_install_build_global(options)
|
||||
@ -23,10 +23,13 @@ index 1279d4a..aeb9d26 100644
|
||||
+
|
||||
+ # Check whether we have root privileges and aren't in venv/virtualenv
|
||||
+ if os.getuid() == 0 and not is_venv():
|
||||
+ command = path.basename(sys.argv[0])
|
||||
+ if command == "__main__.py":
|
||||
+ command = path.basename(sys.executable) + " -m pip"
|
||||
+ logger.warning(
|
||||
+ "WARNING: Running pip install with root privileges is "
|
||||
+ "generally not a good idea. Try `%s install --user` instead."
|
||||
+ % path.basename(sys.argv[0])
|
||||
+ % command
|
||||
+ )
|
||||
+
|
||||
upgrade_strategy = "to-satisfy-only"
|
||||
|
@ -23,7 +23,7 @@ Name: python-%{srcname}
|
||||
# When updating, update the bundled libraries versions bellow!
|
||||
# You can use vendor_meta.sh in the dist git repo
|
||||
Version: 19.1.1
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Summary: A tool for installing and managing Python packages
|
||||
|
||||
# We bundle a lot of libraries with pip, which itself is under MIT license.
|
||||
@ -493,6 +493,9 @@ ln -sf %{buildroot}%{_bindir}/pip3 _bin/pip
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Mon Jun 10 2019 Miro Hrončok <mhroncok@redhat.com> - 19.1.1-2
|
||||
- Fix root warning when pip is invoked via python -m pip
|
||||
|
||||
* Wed May 15 2019 Miro Hrončok <mhroncok@redhat.com> - 19.1.1-1
|
||||
- Update to 19.1.1 (#1706995)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user