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) diff --git a/tests/integration/test_nonplatform_wheel.py b/tests/integration/test_nonplatform_wheel.py index 817d084e..ff1ac144 100644 --- a/tests/integration/test_nonplatform_wheel.py +++ b/tests/integration/test_nonplatform_wheel.py @@ -8,7 +8,7 @@ HERE = pathlib.Path(__file__).parent.resolve() -@pytest.mark.parametrize("mode", ["repair", "addtag", "show"]) +@pytest.mark.parametrize("mode", ["repair", "show"]) def test_non_platform_wheel_repair(mode): wheel = HERE / "plumbum-1.6.8-py2.py3-none-any.whl" proc = subprocess.run(