Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue 5085 (--user set in config causes pip wheel to fail) #5116

Merged
merged 3 commits into from
Mar 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/5085.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a ``--no-user`` option and use it when installing build dependencies.
6 changes: 6 additions & 0 deletions src/pip/_internal/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import operator
import os
import shutil
from optparse import SUPPRESS_HELP

from pip._internal import cmdoptions
from pip._internal.basecommand import RequirementCommand
Expand Down Expand Up @@ -83,6 +84,11 @@ def __init__(self, *args, **kw):
"platform. Typically ~/.local/, or %APPDATA%\\Python on "
"Windows. (See the Python documentation for site.USER_BASE "
"for full details.)")
cmd_opts.add_option(
'--no-user',
dest='use_user_site',
action='store_false',
help=SUPPRESS_HELP)
cmd_opts.add_option(
'--root',
dest='root_path',
Expand Down
2 changes: 1 addition & 1 deletion src/pip/_internal/operations/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def _install_build_reqs(finder, prefix, build_requirements):
]
args = [
sys.executable, '-m', 'pip', 'install', '--ignore-installed',
'--prefix', prefix,
'--no-user', '--prefix', prefix,
] + list(urls)

with open_spinner("Installing build dependencies") as spinner:
Expand Down
2 changes: 2 additions & 0 deletions tests/data/src/withpyproject/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build-system]
requires = ["setuptools", "wheel"]
2 changes: 2 additions & 0 deletions tests/data/src/withpyproject/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from setuptools import setup
setup(name='withpyproject', version='0.0.1')
12 changes: 12 additions & 0 deletions tests/functional/test_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,15 @@ def test_pip_wheel_with_pep518_build_reqs_no_isolation(script, data):
assert wheel_file_path in result.files_created, result.stdout
assert "Successfully built pep518" in result.stdout, result.stdout
assert "Installing build dependencies" not in result.stdout, result.stdout


def test_pip_wheel_with_user_set_in_config(script, data):
script.pip('install', 'wheel')
script.pip('download', 'setuptools', 'wheel', '-d', data.packages)
config_file = script.scratch_path / 'pip.conf'
script.environ['PIP_CONFIG_FILE'] = str(config_file)
config_file.write("[install]\nuser = true")
result = script.pip(
'wheel', data.src / 'withpyproject',
)
assert "Successfully built withpyproject" in result.stdout, result.stdout