Skip to content

Commit d6e050a

Browse files
authoredMar 26, 2018
Merge pull request #5116 from pfmoore/issue5085
Fix for issue 5085 (--user set in config causes pip wheel to fail)
2 parents eb62a44 + 54c4456 commit d6e050a

File tree

6 files changed

+24
-1
lines changed

6 files changed

+24
-1
lines changed
 

‎news/5085.bugfix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add a ``--no-user`` option and use it when installing build dependencies.

‎src/pip/_internal/commands/install.py

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import operator
66
import os
77
import shutil
8+
from optparse import SUPPRESS_HELP
89

910
from pip._internal import cmdoptions
1011
from pip._internal.basecommand import RequirementCommand
@@ -83,6 +84,11 @@ def __init__(self, *args, **kw):
8384
"platform. Typically ~/.local/, or %APPDATA%\\Python on "
8485
"Windows. (See the Python documentation for site.USER_BASE "
8586
"for full details.)")
87+
cmd_opts.add_option(
88+
'--no-user',
89+
dest='use_user_site',
90+
action='store_false',
91+
help=SUPPRESS_HELP)
8692
cmd_opts.add_option(
8793
'--root',
8894
dest='root_path',

‎src/pip/_internal/operations/prepare.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def _install_build_reqs(finder, prefix, build_requirements):
6060
]
6161
args = [
6262
sys.executable, '-m', 'pip', 'install', '--ignore-installed',
63-
'--prefix', prefix,
63+
'--no-user', '--prefix', prefix,
6464
] + list(urls)
6565

6666
with open_spinner("Installing build dependencies") as spinner:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[build-system]
2+
requires = ["setuptools", "wheel"]

‎tests/data/src/withpyproject/setup.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from setuptools import setup
2+
setup(name='withpyproject', version='0.0.1')

‎tests/functional/test_wheel.py

+12
Original file line numberDiff line numberDiff line change
@@ -236,3 +236,15 @@ def test_pip_wheel_with_pep518_build_reqs_no_isolation(script, data):
236236
assert wheel_file_path in result.files_created, result.stdout
237237
assert "Successfully built pep518" in result.stdout, result.stdout
238238
assert "Installing build dependencies" not in result.stdout, result.stdout
239+
240+
241+
def test_pip_wheel_with_user_set_in_config(script, data):
242+
script.pip('install', 'wheel')
243+
script.pip('download', 'setuptools', 'wheel', '-d', data.packages)
244+
config_file = script.scratch_path / 'pip.conf'
245+
script.environ['PIP_CONFIG_FILE'] = str(config_file)
246+
config_file.write("[install]\nuser = true")
247+
result = script.pip(
248+
'wheel', data.src / 'withpyproject',
249+
)
250+
assert "Successfully built withpyproject" in result.stdout, result.stdout

0 commit comments

Comments
 (0)
Please sign in to comment.