Skip to content

Commit

Permalink
Bump delocate version
Browse files Browse the repository at this point in the history
  • Loading branch information
jvolkman committed Dec 14, 2023
1 parent 5400369 commit ef0df29
Show file tree
Hide file tree
Showing 15 changed files with 441 additions and 499 deletions.
4 changes: 2 additions & 2 deletions src/repairwheel/_vendor/delocate/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
__version_tuple__: VERSION_TUPLE
version_tuple: VERSION_TUPLE

__version__ = version = '0.10.6'
__version_tuple__ = version_tuple = (0, 10, 6)
__version__ = version = '0.10.7'
__version_tuple__ = version_tuple = (0, 10, 7)
158 changes: 83 additions & 75 deletions src/repairwheel/_vendor/delocate/cmd/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,91 +4,84 @@
"""
from __future__ import annotations

import glob
import logging
import os
import sys
from optparse import Option, OptionParser, Values
from typing import Callable, List
from argparse import ArgumentParser, Namespace
from pathlib import Path
from typing import Callable, Iterable, Iterator, List

from ..delocating import filter_system_libs
from typing_extensions import Literal, TypedDict

logger = logging.getLogger(__name__)

from .. import __version__
from ..delocating import filter_system_libs

def verbosity_args(parser: OptionParser) -> None:
"""Logging arguments shared by all commands."""
parser.add_options(
[
Option(
"-v",
"--verbose",
action="count",
help=(
"Show a more verbose report of progress and failure."
" Additional flags show even more info, up to -vv."
),
default=0,
),
]
)
logger = logging.getLogger(__name__)


def verbosity_config(opts: Values) -> None:
common_parser = ArgumentParser(add_help=False)
"""Version and logging arguments shared by all commands."""

common_parser.add_argument(
"--version", action="version", version=f"%(prog)s {__version__}"
)
common_parser.add_argument(
"-v",
"--verbose",
action="count",
help="Show a more verbose report of progress and failure,"
" additional flags show even more info, up to -vv",
default=0,
)


delocate_parser = ArgumentParser(add_help=False)
"""Arguments shared by delocate-path and delocate-wheel commands."""

delocate_parser.add_argument(
"-d",
"--dylibs-only",
action="store_true",
help="Only analyze files with known dynamic library extensions",
)
delocate_parser.add_argument(
"-e",
"--exclude",
action="append",
default=[],
type=str,
help="Exclude any libraries where path includes the given string",
)
delocate_parser.add_argument(
"--executable-path",
action="store",
type=str,
default=os.path.dirname(sys.executable),
help="The path used to resolve @executable_path in dependencies",
)
delocate_parser.add_argument(
"--ignore-missing-dependencies",
action="store_true",
help="Skip dependencies which couldn't be found and delocate"
" as much as possible",
)
delocate_parser.add_argument(
"--sanitize-rpaths",
action="store_true",
help="Remove absolute and relative rpaths from binaries",
)


def verbosity_config(args: Namespace) -> None:
"""Configure logging from parsed verbosity arguments."""
logging.basicConfig(
level={0: logging.WARNING, 1: logging.INFO, 2: logging.DEBUG}.get(
opts.verbose, logging.DEBUG
args.verbose, logging.DEBUG
)
)


def delocate_args(parser: OptionParser):
"""Arguments shared by delocate-path and delocate-wheel commands."""
parser.add_options(
[
Option(
"-d",
"--dylibs-only",
action="store_true",
help="Only analyze files with known dynamic library extensions",
),
Option(
"-e",
"--exclude",
action="append",
default=[],
type="string",
help=(
"Exclude any libraries where path includes the given string"
),
),
Option(
"--executable-path",
action="store",
type="string",
default=os.path.dirname(sys.executable),
help=(
"The path used to resolve @executable_path in dependencies"
),
),
Option(
"--ignore-missing-dependencies",
action="store_true",
help=(
"Skip dependencies which couldn't be found and delocate "
"as much as possible"
),
),
Option(
"--sanitize-rpaths",
action="store_true",
help="Remove absolute and relative rpaths from binaries",
),
]
)


class DelocateArgs(TypedDict):
"""Common kwargs for delocate_path and delocate_wheel."""

Expand All @@ -99,10 +92,10 @@ class DelocateArgs(TypedDict):
sanitize_rpaths: bool


def delocate_values(opts: Values) -> DelocateArgs:
def delocate_values(args: Namespace) -> DelocateArgs:
"""Return the common kwargs for delocate_path and delocate_wheel."""

exclude_files: List[str] = opts.exclude
exclude_files: List[str] = args.exclude

def copy_filter_exclude(name: str) -> bool:
"""Returns False if name is excluded, uses normal rules otherwise."""
Expand All @@ -118,8 +111,23 @@ def copy_filter_exclude(name: str) -> bool:

return {
"copy_filt_func": copy_filter_exclude,
"executable_path": opts.executable_path,
"lib_filt_func": "dylibs-only" if opts.dylibs_only else None,
"ignore_missing": opts.ignore_missing_dependencies,
"sanitize_rpaths": opts.sanitize_rpaths,
"executable_path": args.executable_path,
"lib_filt_func": "dylibs-only" if args.dylibs_only else None,
"ignore_missing": args.ignore_missing_dependencies,
"sanitize_rpaths": args.sanitize_rpaths,
}


def glob_paths(paths: Iterable[str]) -> Iterator[str]:
"""Iterate over the expanded paths of potential glob paths.
Does not try to glob paths which match existing files.
"""
for path in paths:
if Path(path).exists():
yield path # Don't try to expand paths when their target exists
continue
expanded_paths = glob.glob(path)
if not expanded_paths:
raise FileNotFoundError(path)
yield from expanded_paths
Loading

0 comments on commit ef0df29

Please sign in to comment.