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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ A brief description of the categories of changes:
* Nothing yet

### Added
* Nothing yet
* (py_wheel) Now supports `compress = (True|False)` to allow disabling
compression to speed up development.

### Removed
* Nothing yet
Expand Down
7 changes: 7 additions & 0 deletions python/private/py_wheel.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ _distribution_attrs = {
default = "none",
doc = "Python ABI tag. 'none' for pure-Python wheels.",
),
"compress": attr.bool(
default = True,
doc = "Enable compression of the final archive.",
),
"distribution": attr.string(
mandatory = True,
doc = """\
Expand Down Expand Up @@ -466,6 +470,9 @@ def _py_wheel_impl(ctx):
args.add("--description_file", description_file)
other_inputs.append(description_file)

if not ctx.attr.compress:
args.add("--no_compress")

for target, filename in ctx.attr.extra_distinfo_files.items():
target_files = target.files.to_list()
if len(target_files) != 1:
Expand Down
9 changes: 9 additions & 0 deletions tools/wheelmaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ def __init__(
python_tag,
abi,
platform,
compress,
outfile=None,
strip_path_prefixes=None,
):
Expand All @@ -238,6 +239,7 @@ def __init__(
self._platform = platform
self._outfile = outfile
self._strip_path_prefixes = strip_path_prefixes
self._compress = compress
self._wheelname_fragment_distribution_name = escape_filename_distribution_name(
self._name
)
Expand All @@ -254,6 +256,7 @@ def __enter__(self):
mode="w",
distribution_prefix=self._distribution_prefix,
strip_path_prefixes=self._strip_path_prefixes,
compression=zipfile.ZIP_DEFLATED if self._compress else zipfile.ZIP_STORED,
)
return self

Expand Down Expand Up @@ -388,6 +391,11 @@ def parse_args() -> argparse.Namespace:
output_group.add_argument(
"--out", type=str, default=None, help="Override name of ouptut file"
)
output_group.add_argument(
"--no_compress",
action="store_true",
help="Disable compression of the final archive",
)
output_group.add_argument(
"--name_file",
type=Path,
Expand Down Expand Up @@ -516,6 +524,7 @@ def main() -> None:
platform=arguments.platform,
outfile=arguments.out,
strip_path_prefixes=strip_prefixes,
compress=not arguments.no_compress,
) as maker:
for package_filename, real_filename in all_files:
maker.add_file(package_filename, real_filename)
Expand Down