summaryrefslogtreecommitdiff
path: root/dev-python/pip/files/pip-20.0.2-disable-system-install.patch
blob: e0b0034e407a0aa8684ca59cbedf3a87e8b1d9d8 (plain)
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
From 3aee04cbb93c0e479b040e682b2aef676629c9a2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Sat, 1 Feb 2020 09:14:46 +0100
Subject: [PATCH] install: Raise an error to avoid breaking python-exec

Running pip without --target, --prefix, --root, or --user will result
in packages being installed systemwide. This has a tendency to break
python-exec if setuptools gets installed or upgraded.
---
 src/pip/_internal/commands/install.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/pip/_internal/commands/install.py b/src/pip/_internal/commands/install.py
index 8c2c32fd..41bac878 100644
--- a/src/pip/_internal/commands/install.py
+++ b/src/pip/_internal/commands/install.py
@@ -238,6 +238,9 @@ class InstallCommand(RequirementCommand):
         if options.upgrade:
             upgrade_strategy = options.upgrade_strategy
 
+        if not options.use_user_site and not options.target_dir and not options.root_path and not options.prefix_path and not os.getenv('GENTOO_PIP_TESTING'):
+            raise CommandError("(Gentoo) Please run pip with the --user option to avoid breaking python-exec")
+
         cmdoptions.check_dist_restriction(options, check_target=True)
 
         install_options = options.install_options or []
-- 
2.28.0