__init__.py 522 B

123456789101112131415161718
  1. from __future__ import annotations
  2. from collections.abc import Iterable
  3. from typing import TypeVar
  4. _IterableT = TypeVar("_IterableT", bound="Iterable[str]")
  5. def consolidate_linker_args(args: _IterableT) -> _IterableT | str:
  6. """
  7. Ensure the return value is a string for backward compatibility.
  8. Retain until at least 2025-04-31. See pypa/distutils#246
  9. """
  10. if not all(arg.startswith('-Wl,') for arg in args):
  11. return args
  12. return '-Wl,' + ','.join(arg.removeprefix('-Wl,') for arg in args)