Skip to content

Commit

Permalink
take the get_platform_debug_info into use
Browse files Browse the repository at this point in the history
  • Loading branch information
fohrloop committed Sep 17, 2024
1 parent bd59ce1 commit 9f1caa4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/wakepy/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from wakepy import ModeExit
from wakepy.core.constants import ModeName
from wakepy.core.mode import Mode
from wakepy.core.platform import get_platform_debug_info

if typing.TYPE_CHECKING:
from typing import List, Tuple
Expand Down Expand Up @@ -67,9 +68,10 @@ def handle_activation_error(result: ActivationResult) -> None:


def _get_activation_error_text(result: ActivationResult) -> str:
import textwrap

from wakepy import __version__

# LATER: This should be improved in https://github.com/fohrloop/wakepy/issues/378
error_text = f"""
Wakepy could not activate the "{result.mode_name}" mode. This might occur because of a bug or because your current platform is not yet supported or your system is missing required software.
Expand All @@ -79,8 +81,7 @@ def _get_activation_error_text(result: ActivationResult) -> str:
- wakepy version: {__version__}
- Mode: {result.mode_name}
- Python version: {sys.version}
- Operating system & version: [PLEASE FILL THIS]
- Desktop Environment & version (if not default): [FILL OR REMOVE THIS LINE]
{textwrap.indent(get_platform_debug_info().strip(), ' '*4).strip()}
- Additional details: [FILL OR REMOVE THIS LINE]
Thank you!
Expand Down
3 changes: 1 addition & 2 deletions src/wakepy/core/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ def get_current_platform() -> IdentifiedPlatformType:
elif system == "FreeBSD":
return IdentifiedPlatformType.FREEBSD

# LATER: This should be improved in https://github.com/fohrloop/wakepy/issues/378
warnings.warn(
f"Could not detect current platform! platform.system() returned {system}"
f"Could not detect current platform! Debug info:\n{get_platform_debug_info()}"
)
return IdentifiedPlatformType.UNKNOWN

Expand Down

0 comments on commit 9f1caa4

Please sign in to comment.