Skip to content

Commit

Permalink
Improve log message in case of NonPlatformWheel error (#393)
Browse files Browse the repository at this point in the history
* Improve log message in case of NonPlatformWheel error

* Improve message used in case of NonPlatformWheel

* Refactoring after review

* Refactoring after review
  • Loading branch information
CaselIT committed Oct 9, 2022
1 parent 72c642c commit 73c9f17
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ build-backend = "setuptools.build_meta"

[tool.black]
target-version = ["py36", "py37", "py38", "py39"]
extend-exclude = "src/auditwheel/_vendor"

[tool.isort]
profile = "black"
extend_skip_glob = "src/auditwheel/_vendor/**/*.py"

[tool.mypy]
follow_imports = "silent"
Expand Down
2 changes: 1 addition & 1 deletion src/auditwheel/main_addtag.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def execute(args, p):
try:
wheel_abi = analyze_wheel_abi(args.WHEEL_FILE)
except NonPlatformWheel:
logger.info("This does not look like a platform wheel")
logger.info(NonPlatformWheel.LOG_MESSAGE)
return 1

parsed_fname = WHEEL_INFO_RE.search(basename(args.WHEEL_FILE))
Expand Down
2 changes: 1 addition & 1 deletion src/auditwheel/main_repair.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def execute(args, p):
try:
wheel_abi = analyze_wheel_abi(wheel_file)
except NonPlatformWheel:
logger.info("This does not look like a platform wheel")
logger.info(NonPlatformWheel.LOG_MESSAGE)
return 1

policy = get_policy_by_name(args.PLAT)
Expand Down
2 changes: 1 addition & 1 deletion src/auditwheel/main_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def execute(args, p):
try:
winfo = analyze_wheel_abi(args.WHEEL_FILE)
except NonPlatformWheel:
logger.info("This does not look like a platform wheel")
logger.info(NonPlatformWheel.LOG_MESSAGE)
return 1

libs_with_versions = [
Expand Down
6 changes: 6 additions & 0 deletions src/auditwheel/wheel_abi.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ class WheelAbiError(Exception):
class NonPlatformWheel(WheelAbiError):
"""No ELF binaries in the wheel"""

LOG_MESSAGE = (
"This does not look like a platform wheel, no ELF executable "
"or shared library file (including compiled Python C extension) "
"found in the wheel archive"
)


@functools.lru_cache()
def get_wheel_elfdata(wheel_fn: str):
Expand Down

0 comments on commit 73c9f17

Please sign in to comment.