mirror of https://github.com/pypa/pip
Allow downloading of sdists for specific platform with --no-deps
This commit is contained in:
parent
2f90cd0735
commit
2d97891497
|
@ -139,12 +139,17 @@ class DownloadCommand(RequirementCommand):
|
|||
options.implementation,
|
||||
])
|
||||
binary_only = FormatControl(set(), {':all:'})
|
||||
if dist_restriction_set and options.format_control != binary_only:
|
||||
no_sdist_dependencies = (
|
||||
options.format_control != binary_only and
|
||||
not options.ignore_dependencies
|
||||
)
|
||||
if dist_restriction_set and no_sdist_dependencies:
|
||||
raise CommandError(
|
||||
"--only-binary=:all: must be set and --no-binary must not "
|
||||
"be set (or must be set to :none:) when restricting platform "
|
||||
"and interpreter constraints using --python-version, "
|
||||
"--platform, --abi, or --implementation."
|
||||
"When restricting platform and interpreter constraints using "
|
||||
"--python-version, --platform, --abi, or --implementation, "
|
||||
"either --no-deps must be set, or --only-binary=:all: must be "
|
||||
"set and --no-binary must not be set (or must be set to "
|
||||
":none:)."
|
||||
)
|
||||
|
||||
options.src_dir = os.path.abspath(options.src_dir)
|
||||
|
|
|
@ -187,10 +187,30 @@ def test_only_binary_set_then_download_specific_platform(script, data):
|
|||
)
|
||||
|
||||
|
||||
def test_not_only_binary_then_download_specific_platform_fails(script, data):
|
||||
def test_no_deps_set_then_download_specific_platform(script, data):
|
||||
"""
|
||||
Confirm that specifying an interpreter/platform constraint
|
||||
enforces that ``--only-binary=:all:`` is set.
|
||||
is allowed when ``--no-deps`` is set.
|
||||
"""
|
||||
fake_wheel(data, 'fake-1.0-py2.py3-none-any.whl')
|
||||
|
||||
result = script.pip(
|
||||
'download', '--no-index', '--find-links', data.find_links,
|
||||
'--no-deps',
|
||||
'--dest', '.',
|
||||
'--platform', 'linux_x86_64',
|
||||
'fake'
|
||||
)
|
||||
assert (
|
||||
Path('scratch') / 'fake-1.0-py2.py3-none-any.whl'
|
||||
in result.files_created
|
||||
)
|
||||
|
||||
|
||||
def test_download_specific_platform_fails(script, data):
|
||||
"""
|
||||
Confirm that specifying an interpreter/platform constraint
|
||||
enforces that ``--no-deps`` or ``--only-binary=:all:`` is set.
|
||||
"""
|
||||
fake_wheel(data, 'fake-1.0-py2.py3-none-any.whl')
|
||||
|
||||
|
|
Loading…
Reference in New Issue