Skip to content

Commit d7eaede

Browse files
authored
Revert "Add new option: pip wheel --save-wheel-names (#6377)" (#7420)
This reverts commit bcad1b1, reversing changes made to f864903. As discussed, we should rethink the interface of this command output as part of larger CLI usability review. In the interim, the same functionality can be achieved using straightforward shell commands.
1 parent b695606 commit d7eaede

File tree

5 files changed

+0
-138
lines changed

5 files changed

+0
-138
lines changed

news/6340.feature

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/pip/_internal/commands/wheel.py

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,6 @@ def __init__(self, *args, **kw):
102102
cmd_opts.add_option(cmdoptions.no_clean())
103103
cmd_opts.add_option(cmdoptions.require_hashes())
104104

105-
cmd_opts.add_option(
106-
'--save-wheel-names',
107-
dest='path_to_wheelnames',
108-
action='store',
109-
metavar='path',
110-
help=("Store the filenames of the built or downloaded wheels "
111-
"in a new file of given path. Filenames are separated "
112-
"by new line and file ends with new line"),
113-
)
114-
115105
index_opts = cmdoptions.make_option_group(
116106
cmdoptions.index_group,
117107
self.parser,
@@ -120,28 +110,6 @@ def __init__(self, *args, **kw):
120110
self.parser.insert_option_group(0, index_opts)
121111
self.parser.insert_option_group(0, cmd_opts)
122112

123-
def save_wheelnames(
124-
self,
125-
links_filenames,
126-
path_to_wheelnames,
127-
wheel_filenames,
128-
):
129-
if path_to_wheelnames is None:
130-
return
131-
132-
entries_to_save = wheel_filenames + links_filenames
133-
entries_to_save = [
134-
filename + '\n' for filename in entries_to_save
135-
if filename.endswith('whl')
136-
]
137-
try:
138-
with open(path_to_wheelnames, 'w') as f:
139-
f.writelines(entries_to_save)
140-
except EnvironmentError as e:
141-
logger.error('Cannot write to the given path: %s\n%s' %
142-
(path_to_wheelnames, e))
143-
raise
144-
145113
def run(self, options, args):
146114
# type: (Values, List[Any]) -> None
147115
cmdoptions.check_install_build_global(options)
@@ -192,18 +160,10 @@ def run(self, options, args):
192160
preparer, wheel_cache,
193161
build_options=options.build_options or [],
194162
global_options=options.global_options or [],
195-
path_to_wheelnames=options.path_to_wheelnames
196163
)
197164
build_failures = wb.build(
198165
requirement_set.requirements.values(),
199166
)
200-
self.save_wheelnames(
201-
[req.link.filename for req in
202-
requirement_set.successfully_downloaded
203-
if req.link is not None],
204-
wb.path_to_wheelnames,
205-
wb.wheel_filenames,
206-
)
207167
if len(build_failures) != 0:
208168
raise CommandError(
209169
"Failed to build one or more wheels"

src/pip/_internal/wheel_builder.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@ def __init__(
242242
build_options=None, # type: Optional[List[str]]
243243
global_options=None, # type: Optional[List[str]]
244244
check_binary_allowed=None, # type: Optional[BinaryAllowedPredicate]
245-
path_to_wheelnames=None, # type: Optional[Union[bytes, Text]]
246245
):
247246
# type: (...) -> None
248247
if check_binary_allowed is None:
@@ -257,8 +256,6 @@ def __init__(
257256
self.build_options = build_options or []
258257
self.global_options = global_options or []
259258
self.check_binary_allowed = check_binary_allowed
260-
# path where to save built names of built wheels
261-
self.path_to_wheelnames = path_to_wheelnames
262259
# file names of built wheel names
263260
self.wheel_filenames = [] # type: List[Union[bytes, Text]]
264261

@@ -472,9 +469,6 @@ def build(
472469
)
473470
build_failure.append(req)
474471
continue
475-
self.wheel_filenames.append(
476-
os.path.relpath(wheel_file, output_dir)
477-
)
478472
build_success.append(req)
479473
else:
480474
build_failure.append(req)

tests/functional/test_wheel.py

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""'pip wheel' tests"""
22
import os
33
import re
4-
import stat
54
from os.path import exists
65

76
import pytest
@@ -280,65 +279,3 @@ def test_legacy_wheels_are_not_confused_with_other_files(script, tmpdir, data):
280279
wheel_file_name = 'simplewheel-1.0-py%s-none-any.whl' % pyversion[0]
281280
wheel_file_path = script.scratch / wheel_file_name
282281
assert wheel_file_path in result.files_created, result.stdout
283-
284-
285-
def test_pip_option_save_wheel_name(script, data):
286-
"""Check if the option saves the filenames of built wheels
287-
"""
288-
script.pip(
289-
'wheel', '--no-index', '-f', data.find_links,
290-
'require_simple==1.0',
291-
'--save-wheel-name', 'wheelnames',
292-
)
293-
294-
wheel_file_names = [
295-
'require_simple-1.0-py%s-none-any.whl' % pyversion[0],
296-
'simple-3.0-py%s-none-any.whl' % pyversion[0],
297-
]
298-
wheelnames_path = script.scratch_path / 'wheelnames'
299-
with open(wheelnames_path, 'r') as wheelnames_file:
300-
wheelnames_entries = (wheelnames_file.read()).splitlines()
301-
assert wheel_file_names == wheelnames_entries
302-
303-
304-
def test_pip_option_save_wheel_name_Permission_error(script, data):
305-
306-
temp_file = script.base_path / 'scratch' / 'wheelnames'
307-
308-
wheel_file_names = [
309-
'require_simple-1.0-py%s-none-any.whl' % pyversion[0],
310-
'simple-3.0-py%s-none-any.whl' % pyversion[0],
311-
]
312-
313-
script.pip(
314-
'wheel', '--no-index', '-f', data.find_links,
315-
'require_simple==1.0',
316-
'--save-wheel-name', 'wheelnames',
317-
)
318-
os.chmod(temp_file, stat.S_IREAD)
319-
result = script.pip(
320-
'wheel', '--no-index', '-f', data.find_links,
321-
'require_simple==1.0',
322-
'--save-wheel-name', 'wheelnames', expect_error=True,
323-
)
324-
os.chmod(temp_file, stat.S_IREAD | stat.S_IWRITE)
325-
326-
assert "ERROR: Cannot write to the given path: wheelnames\n" \
327-
"[Errno 13] Permission denied: 'wheelnames'\n" in result.stderr
328-
329-
with open(temp_file) as f:
330-
result = f.read().splitlines()
331-
# check that file stays same
332-
assert result == wheel_file_names
333-
334-
335-
def test_pip_option_save_wheel_name_error_during_build(script, data):
336-
script.pip(
337-
'wheel', '--no-index', '--save-wheel-name', 'wheelnames',
338-
'-f', data.find_links, 'wheelbroken==0.1',
339-
expect_error=True,
340-
)
341-
wheelnames_path = script.base_path / 'scratch' / 'wheelnames'
342-
with open(wheelnames_path) as f:
343-
wheelnames = f.read().splitlines()
344-
assert wheelnames == []

tests/unit/test_wheel.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from mock import patch
99
from pip._vendor.packaging.requirements import Requirement
1010

11-
from pip._internal.commands.wheel import WheelCommand
1211
from pip._internal.exceptions import UnsupportedWheel
1312
from pip._internal.locations import get_scheme
1413
from pip._internal.models.scheme import Scheme
@@ -525,30 +524,3 @@ def test_rehash(self, tmpdir):
525524
h, length = wheel.rehash(self.test_file)
526525
assert length == str(self.test_file_len)
527526
assert h == self.test_file_hash_encoded
528-
529-
530-
class TestWheelCommand(object):
531-
532-
def test_save_wheelnames(self, tmpdir):
533-
wheel_filenames = ['Flask-1.1.dev0-py2.py3-none-any.whl']
534-
links_filenames = [
535-
'flask',
536-
'Werkzeug-0.15.4-py2.py3-none-any.whl',
537-
'Jinja2-2.10.1-py2.py3-none-any.whl',
538-
'itsdangerous-1.1.0-py2.py3-none-any.whl',
539-
'Click-7.0-py2.py3-none-any.whl'
540-
]
541-
542-
expected = wheel_filenames + links_filenames[1:]
543-
expected = [filename + '\n' for filename in expected]
544-
temp_file = tmpdir.joinpath('wheelfiles')
545-
546-
WheelCommand('name', 'summary').save_wheelnames(
547-
links_filenames,
548-
temp_file,
549-
wheel_filenames
550-
)
551-
552-
with open(temp_file, 'r') as f:
553-
test_content = f.readlines()
554-
assert test_content == expected

0 commit comments

Comments
 (0)