pip install defaults to --user

The default would be python-prefix, which is rubbish. We could mangle this to TEA_PREFIX/python.org which is also fairly rubbish. TEA_PREFIX is a possible, but still lame. ~/.local is a standard and our magic adds the bin there to PATH
This commit is contained in:
Max Howell 2023-03-17 17:14:56 -04:00
parent d619c00c39
commit 17ea239a3f
Failed to extract signature
2 changed files with 67 additions and 0 deletions

View file

@ -15,7 +15,10 @@ runtime:
build:
dependencies:
curl.se: '*'
gnu.org/patch: '*'
script: |
patch -p1 <props/user-install.patch
curl -O https://bootstrap.pypa.io/get-pip.py
test -d bootstrap || mkdir bootstrap

View file

@ -0,0 +1,64 @@
diff --git a/src/pip/_internal/commands/configuration.py b/src/pip/_internal/commands/configuration.py
index 84b134e..c7e6775 100644
--- a/src/pip/_internal/commands/configuration.py
+++ b/src/pip/_internal/commands/configuration.py
@@ -79,7 +79,7 @@ class ConfigurationCommand(Command):
"--user",
dest="user_file",
action="store_true",
- default=False,
+ default=True,
help="Use the user configuration file only",
)
diff --git a/src/pip/_internal/commands/freeze.py b/src/pip/_internal/commands/freeze.py
index 5fa6d39..e7f5891 100644
--- a/src/pip/_internal/commands/freeze.py
+++ b/src/pip/_internal/commands/freeze.py
@@ -51,7 +51,7 @@ class FreezeCommand(Command):
"--user",
dest="user",
action="store_true",
- default=False,
+ default=True,
help="Only output packages installed in user-site.",
)
self.cmd_opts.add_option(cmdoptions.list_path())
diff --git a/src/pip/_internal/commands/inspect.py b/src/pip/_internal/commands/inspect.py
index 27c8fa3..6058356 100644
--- a/src/pip/_internal/commands/inspect.py
+++ b/src/pip/_internal/commands/inspect.py
@@ -39,7 +39,7 @@ class InspectCommand(Command):
"--user",
dest="user",
action="store_true",
- default=False,
+ default=True,
help="Only output packages installed in user-site.",
)
self.cmd_opts.add_option(cmdoptions.list_path())
diff --git a/src/pip/_internal/commands/install.py b/src/pip/_internal/commands/install.py
index b20aedd..d2151e0 100644
--- a/src/pip/_internal/commands/install.py
+++ b/src/pip/_internal/commands/install.py
@@ -129,6 +129,7 @@ class InstallCommand(RequirementCommand):
"--user",
dest="use_user_site",
action="store_true",
+ default=True,
help=(
"Install to the Python user install directory for your "
"platform. Typically ~/.local/, or %APPDATA%\\Python on "
diff --git a/src/pip/_internal/commands/list.py b/src/pip/_internal/commands/list.py
index 8e1426d..1e269dc 100644
--- a/src/pip/_internal/commands/list.py
+++ b/src/pip/_internal/commands/list.py
@@ -83,7 +83,7 @@ class ListCommand(IndexGroupCommand):
"--user",
dest="user",
action="store_true",
- default=False,
+ default=True,
help="Only output packages installed in user-site.",
)
self.cmd_opts.add_option(cmdoptions.list_path())