From 5c690080212c66354cdf5f46f53b52616a73cf11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Kiss=20Koll=C3=A1r?= Date: Mon, 25 Sep 2023 20:53:38 +0100 Subject: [PATCH] Remove the `addtag` subcommand This subcommand has been broken for at least a few releases and doesn't provide any useful functionality. Removing it will at least avoid confusing users when they try to use it. --- src/auditwheel/main.py | 3 +- src/auditwheel/main_addtag.py | 69 -------------------------------- tests/integration/test_addtag.py | 17 -------- 3 files changed, 1 insertion(+), 88 deletions(-) delete mode 100644 src/auditwheel/main_addtag.py delete mode 100644 tests/integration/test_addtag.py diff --git a/src/auditwheel/main.py b/src/auditwheel/main.py index d6de90d7..595ac197 100644 --- a/src/auditwheel/main.py +++ b/src/auditwheel/main.py @@ -13,7 +13,7 @@ import auditwheel -from . import main_addtag, main_lddtree, main_repair, main_show +from . import main_lddtree, main_repair, main_show def main() -> int | None: @@ -40,7 +40,6 @@ def main() -> int | None: sub_parsers = p.add_subparsers(metavar="command", dest="cmd") main_show.configure_parser(sub_parsers) - main_addtag.configure_parser(sub_parsers) main_repair.configure_parser(sub_parsers) main_lddtree.configure_subparser(sub_parsers) diff --git a/src/auditwheel/main_addtag.py b/src/auditwheel/main_addtag.py deleted file mode 100644 index 53a9fc04..00000000 --- a/src/auditwheel/main_addtag.py +++ /dev/null @@ -1,69 +0,0 @@ -from __future__ import annotations - -import logging -from os.path import abspath, basename, exists, join - -logger = logging.getLogger(__name__) - - -def configure_parser(sub_parsers): - help = "Add new platform ABI tags to a wheel" - - p = sub_parsers.add_parser("addtag", help=help, description=help) - p.add_argument("WHEEL_FILE", help="Path to wheel file") - p.add_argument( - "-w", - "--wheel-dir", - dest="WHEEL_DIR", - help=("Directory to store new wheel file (default:" ' "wheelhouse/")'), - type=abspath, - default="wheelhouse/", - ) - p.set_defaults(func=execute) - - -def execute(args, p): - import os - - from packaging.utils import parse_wheel_filename - - from .wheel_abi import NonPlatformWheel, analyze_wheel_abi - from .wheeltools import InWheelCtx, WheelToolsError, add_platforms - - try: - wheel_abi = analyze_wheel_abi(args.WHEEL_FILE) - except NonPlatformWheel: - logger.info(NonPlatformWheel.LOG_MESSAGE) - return 1 - - _, _, _, in_tags = parse_wheel_filename(basename(args.WHEEL_FILE)) - in_fname_tags = {tag.platform for tag in in_tags} - - logger.info( - '%s receives the following tag: "%s".', - basename(args.WHEEL_FILE), - wheel_abi.overall_tag, - ) - logger.info("Use ``auditwheel show`` for more details") - - if wheel_abi.overall_tag in in_fname_tags: - logger.info("No tags to be added. Exiting.") - return 1 - - # todo: move more of this logic to separate file - if not exists(args.WHEEL_DIR): - os.makedirs(args.WHEEL_DIR) - - with InWheelCtx(args.WHEEL_FILE) as ctx: - try: - out_wheel = add_platforms(ctx, [wheel_abi.overall_tag]) - except WheelToolsError as e: - logger.exception("\n%s.", repr(e)) - return 1 - - if out_wheel: - # tell context manager to write wheel on exit with - # the proper output directory - ctx.out_wheel = join(args.WHEEL_DIR, basename(out_wheel)) - logger.info("\nUpdated wheel written to %s", out_wheel) - return 0 diff --git a/tests/integration/test_addtag.py b/tests/integration/test_addtag.py deleted file mode 100644 index 06ff82a9..00000000 --- a/tests/integration/test_addtag.py +++ /dev/null @@ -1,17 +0,0 @@ -from __future__ import annotations - -from pathlib import Path -from unittest.mock import Mock - -from auditwheel.main_addtag import execute - -HERE = Path(__file__).parent.resolve() - - -def test_smoke(tmpdir): - """Simple test to exercise the 'addtag' code path""" - args = Mock( - WHEEL_FILE=str(HERE / "cffi-1.5.0-cp27-none-linux_x86_64.whl"), - WHEEL_DIR=str(tmpdir / "wheelhouse/"), - ) - execute(args, None)