Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve warnings and errors if platform is not supported #383

Merged
merged 6 commits into from
Sep 17, 2024

Conversation

fohrloop
Copy link
Owner

Closes: #378

Add platform information automatically to error/warning texts. When the wakepy CLI command fails, it would now print

❯ python -m wakepy
                  _
                 | |
 __      __ __ _ | | __ ___  _ __   _   _
 \ \ /\ / // _` || |/ // _ \| '_ \ | | | |
  \ V  V /| (_| ||   <|  __/| |_) || |_| |
   \_/\_/  \__,_||_|\_\\___|| .__/  \__, |
  v.0.9.2.dev13+g2aab0eb    | |      __/ |
                            |_|     |___/ 
 [x] System will continue running programs
 [ ] Display is kept on and automatic screenlock disabled.

Wakepy could not activate the "keep.running" mode. This might occur because of a
bug or because your current platform is not yet supported or your system is
missing required software.

Check if there is already a related issue in the issue tracker at
https://github.com/fohrloop/wakepy/issues/ and if not, please create a new one.

Include the following:
- wakepy version: 0.9.2.dev13+g2aab0eb
- Mode: keep.running
- Python version: 3.12.5 (main, Aug 23 2024, 00:00:00) [GCC 14.2.1 20240801 (Red
Hat 14.2.1-1)]
- os.name: posix
- sys.platform: linux
- platform.system(): Linux
- platform.release(): 6.10.9-200.fc40.x86_64
- platform.machine(): x86_64
- sysconfig.get_platform(): linux-x86_64
- DESKTOP_SESSION: gnome
- (/etc/os-release) NAME: "Fedora Linux"
- (/etc/os-release) VERSION: "40 (Workstation Edition)"
- (/etc/os-release) ID: fedora
- (/etc/os-release) VERSION_ID: 40
- (/etc/os-release) VERSION_CODENAME: ""
- (/etc/os-release) PLATFORM_ID: "platform:f40"
- (/etc/os-release) PRETTY_NAME: "Fedora Linux 40 (Workstation Edition)"
- (/etc/os-release) VARIANT: "Workstation Edition"
- (/etc/os-release) VARIANT_ID: workstation
- Additional details: [FILL OR REMOVE THIS LINE]

Thank you!

The parts from os.name until (/etc/os-release) VARIANT_ID are added in this PR. In addition, when determining the current platform with get_current_platform(), if platform (for example linux) could not be determined, would previously get:

/home/fohrloop/code/wakepy/src/wakepy/core/platform.py:28: UserWarning: Could not detect current platform! platform.system() returned Linux
  warnings.warn(

and now:

/home/fohrloop/code/wakepy/src/wakepy/core/platform.py:31: UserWarning: Could not detect current platform! Debug info:
- os.name: posix
- sys.platform: linux
- platform.system(): Linux
- platform.release(): 6.10.9-200.fc40.x86_64
- platform.machine(): x86_64
- sysconfig.get_platform(): linux-x86_64
- DESKTOP_SESSION: gnome
- (/etc/os-release) NAME: "Fedora Linux"
- (/etc/os-release) VERSION: "40 (Workstation Edition)"
- (/etc/os-release) ID: fedora
- (/etc/os-release) VERSION_ID: 40
- (/etc/os-release) VERSION_CODENAME: ""
- (/etc/os-release) PLATFORM_ID: "platform:f40"
- (/etc/os-release) PRETTY_NAME: "Fedora Linux 40 (Workstation Edition)"
- (/etc/os-release) VARIANT: "Workstation Edition"
- (/etc/os-release) VARIANT_ID: workstation

@fohrloop fohrloop changed the title Iimprove warnings and errors if platform is not supported Improve warnings and errors if platform is not supported Sep 17, 2024
@fohrloop fohrloop merged commit 1514b95 into main Sep 17, 2024
14 checks passed
@fohrloop fohrloop deleted the issue-378-improve-warnings-and-errors branch September 17, 2024 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve warning/error message if platform is not supported
1 participant