Skip to content

Commit fbd8904

Browse files
committed
Revert "Add new option: pip wheel --save-wheel-names (pypa#6377)"
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 b8c16a0 commit fbd8904

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)
@@ -197,18 +165,10 @@ def run(self, options, args):
197165
preparer, wheel_cache,
198166
build_options=options.build_options or [],
199167
global_options=options.global_options or [],
200-
path_to_wheelnames=options.path_to_wheelnames
201168
)
202169
build_failures = wb.build(
203170
requirement_set.requirements.values(),
204171
)
205-
self.save_wheelnames(
206-
[req.link.filename for req in
207-
requirement_set.successfully_downloaded
208-
if req.link is not None],
209-
wb.path_to_wheelnames,
210-
wb.wheel_filenames,
211-
)
212172
if len(build_failures) != 0:
213173
raise CommandError(
214174
"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
@@ -253,7 +253,6 @@ def __init__(
253253
build_options=None, # type: Optional[List[str]]
254254
global_options=None, # type: Optional[List[str]]
255255
check_binary_allowed=None, # type: Optional[BinaryAllowedPredicate]
256-
path_to_wheelnames=None, # type: Optional[Union[bytes, Text]]
257256
):
258257
# type: (...) -> None
259258
if check_binary_allowed is None:
@@ -268,8 +267,6 @@ def __init__(
268267
self.build_options = build_options or []
269268
self.global_options = global_options or []
270269
self.check_binary_allowed = check_binary_allowed
271-
# path where to save built names of built wheels
272-
self.path_to_wheelnames = path_to_wheelnames
273270
# file names of built wheel names
274271
self.wheel_filenames = [] # type: List[Union[bytes, Text]]
275272

@@ -508,9 +505,6 @@ def build(
508505
)
509506
build_failure.append(req)
510507
continue
511-
self.wheel_filenames.append(
512-
os.path.relpath(wheel_file, output_dir)
513-
)
514508
build_success.append(req)
515509
else:
516510
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
@@ -9,7 +9,6 @@
99
from pip._vendor.packaging.requirements import Requirement
1010

1111
from pip._internal import wheel
12-
from pip._internal.commands.wheel import WheelCommand
1312
from pip._internal.exceptions import UnsupportedWheel
1413
from pip._internal.locations import get_scheme
1514
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)