Skip to content
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ Breaking changes:
`incompatible_normalize_version` to `True` by default to enforce `PEP440`
for wheel names built by `rules_python`.

* (tools/wheelmaker.py) drop support for Python 2 as only Python 3 is tested.

### Fixed

* Skip aliases for unloaded toolchains. Some Python versions that don't have full
Expand Down
24 changes: 8 additions & 16 deletions tools/wheelmaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def arcname_from(name):

def add_string(self, filename, contents):
"""Add given 'contents' as filename to the distribution."""
if sys.version_info[0] > 2 and isinstance(contents, str):
if isinstance(contents, str):
contents = contents.encode("utf-8", "surrogateescape")
zinfo = self._zipinfo(filename)
self.writestr(zinfo, contents)
Expand Down Expand Up @@ -199,7 +199,7 @@ def add_recordfile(self):
entries = self._record + [(record_path, b"", b"")]
contents = b""
for filename, digest, size in entries:
if sys.version_info[0] > 2 and isinstance(filename, str):
if isinstance(filename, str):
filename = filename.lstrip("/").encode("utf-8", "surrogateescape")
contents += b"%s,%s,%s\n" % (filename, digest, size)

Expand Down Expand Up @@ -530,22 +530,14 @@ def main() -> None:

description = None
if arguments.description_file:
if sys.version_info[0] == 2:
with open(arguments.description_file, "rt") as description_file:
description = description_file.read()
else:
with open(
arguments.description_file, "rt", encoding="utf-8"
) as description_file:
description = description_file.read()
with open(
arguments.description_file, "rt", encoding="utf-8"
) as description_file:
description = description_file.read()

metadata = None
if sys.version_info[0] == 2:
with open(arguments.metadata_file, "rt") as metadata_file:
metadata = metadata_file.read()
else:
with open(arguments.metadata_file, "rt", encoding="utf-8") as metadata_file:
metadata = metadata_file.read()
with open(arguments.metadata_file, "rt", encoding="utf-8") as metadata_file:
metadata = metadata_file.read()

if arguments.noincompatible_normalize_version:
version_in_metadata = version
Expand Down