Skip to content

Commit

Permalink
fixup! Add delocate as a generator to wheel info
Browse files Browse the repository at this point in the history
  • Loading branch information
HexDecimal committed Dec 17, 2024
1 parent 3b04fda commit 22d2211
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
12 changes: 6 additions & 6 deletions delocate/delocating.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from __future__ import annotations

import functools
import importlib.metadata
import logging
import os
import re
Expand Down Expand Up @@ -52,6 +51,11 @@
)
from .wheeltools import InWheel, rewrite_record

try:
from delocate._version import __version__
except ImportError:
__version__ = ""

Check warning on line 57 in delocate/delocating.py

View check run for this annotation

Codecov / codecov/patch

delocate/delocating.py#L56-L57

Added lines #L56 - L57 were not covered by tests

logger = logging.getLogger(__name__)

# Prefix for install_name_id of copied libraries
Expand Down Expand Up @@ -926,11 +930,7 @@ def _check_and_update_wheel_name(

def _get_delocate_generator_header() -> tuple[str, str]:
"""Return Delocate's version info to be appended to the WHEEL metadata."""
try:
tag = f"delocate {importlib.metadata.version('delocate')}"
except importlib.metadata.PackageNotFoundError:
tag = "delocate" # pragma: no cover
return ("Generator", tag)
return ("Generator", f"delocate {__version__}".rstrip())


def _update_wheelfile(wheel_dir: Path, wheel_name: str) -> None:
Expand Down
13 changes: 6 additions & 7 deletions delocate/tests/test_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from __future__ import annotations

import importlib.metadata
import os
import shutil
import subprocess
Expand Down Expand Up @@ -48,15 +47,15 @@
assert_winfo_similar,
)

DATA_PATH = (Path(__file__).parent / "data").resolve(strict=True)

try:
DELOCATE_GENERATOR_HEADER = (
f"Generator: delocate {importlib.metadata.version('delocate')}"
)
except importlib.metadata.PackageNotFoundError:
from delocate._version import __version__

DELOCATE_GENERATOR_HEADER = f"Generator: delocate {__version__}"
except ImportError:
DELOCATE_GENERATOR_HEADER = "Generator: delocate"

DATA_PATH = (Path(__file__).parent / "data").resolve(strict=True)


def _proc_lines(in_str: str) -> list[str]:
"""Return input split across lines, striping whitespace, without blanks.
Expand Down

0 comments on commit 22d2211

Please sign in to comment.