Comments (3)
I'm just about to install GhostBSD 24.04.1 and try to make wakepy work on it.
from wakepy.
This is what wakepy 0.9.1 gives on GhostBSD:
(venv) fohrloop@fohrloop-ghostbsd ~/c/wakepy (main)> wakepy
/home/fohrloop/code/wakepy/venv/lib/python3.9/site-packages/wakepy/core/platform.py:17: UserWarning: Could not detect current platform! platform.system() returned FreeBSD
warnings.warn(
_
| |
__ __ __ _ | | __ ___ _ __ _ _
\ \ /\ / // _` || |/ // _ \| '_ \ | | | |
\ V V /| (_| || <| __/| |_) || |_| |
\_/\_/ \__,_||_|\_\\___|| .__/ \__, |
v.0.9.1 | | __/ |
|_| |___/
[x] System will continue running programs
[ ] Presentation mode is on
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.1
- Mode: keep.running
- Python version: 3.9.18 (main, Apr 27 2024, 17:22:44)
[Clang 17.0.6 (https://github.com/llvm/llvm-project.git llvmorg-17.0.6-0-g60097
- Operating system & version: [PLEASE FILL THIS]
- Desktop Environment & version (if not default): [FILL OR REMOVE THIS LINE]
- Additional details: [FILL OR REMOVE THIS LINE]
Thank you!
from wakepy.
This is what you can see in GhostBSD 24.04.1, CPython 3.9.18:
>>> os.name
'posix'
>>> sys.platform
'freebsd14'
>>> platform.system()
'FreeBSD'
>>> sysconfig.get_platform()
'freebsd-14.0-STABLE-amd64'
How wakepy works currently
- The current "platform" is checked. The current platform is set to WINDOWS, MACOS, LINUX or OTHER
- Each wakepy.Method has a list of supported platforms:
class SomeMethod(Method):
supported_platforms = (PlatformName.LINUX,)
- When looping over the potential wakepy.Methods to be used to activate a mode, the current platform is compared to the tuple
Method.supported_platforms
. If current platform is not in that tuple, the method fails.
How wakepy could work in the future
- One problem with the current solution is that there's no pre-defined list of all platforms. The GhostBSD shows itself as "FreeBSD" in
platform.system()
because it's based on FreeBSD. But in the future it may show itself as "GhostBSD". It's also hard (or impossible) to have a perfect list of all platforms. - It would therefore be better if the "OTHER" would not fail the platform check, but give "I don't know" as an answer.
- Another problem with the current solution is the need to update every Method definition when a new platform is added. For example, now when
FREEBSD
is added, should add that to the.supported_platforms
of at least KDE and Gnome methods. When there'sOPENBSD
added, this has to be done again, and all methods will fail on OpenDSD if there's no such platform constant.
Proposed solution (option A)
- Each wakepy.Method would have two lists:
supported_platforms
andunsupported_platforms
- The platform support step would
- fail if the current platform is in
Method.unsupported_platforms
(return False) - succeed if the current plarform is in
Method.supported_platforms
(return True) - Say "I don't know" otherwise. (return None)
- fail if the current platform is in
- The method prioritization step could prioritize all methods with a supported platform the highest, the unknown cases next, and put the unsupported (known to fail) methods last.
With the proposed solution, every wakepy method is tried on each unknown ("OTHER") platform, which is better than failing without trying any methods.
Proposed solution (option B)
- Each wakepy.Method implements its own
is_platform_supported
method, which takes a platform (current platform) as an input and returnsNone
(unknown) by default, and could also return True (is supported) or False (is not supported). - There could then be utility functions, like
is_unix_like(platform)
oris_bsd(platform)
Proposed solution (option C)
- Some way to do
platform in PlatformSupport((UNIX,), unsupported=(WINDOWS, MACOS))
Here UNIX
would be a special platform, which currently would say:
>>> LINUX in PlatformSupport(UNIX)
True
>>> WINDOWS in PlatformSupport(UNIX)
None
>>> OTHER in PlatformSupport(UNIX) # freebsd for example
None
but when UNIX
is updated, it would be union of LINUX
and BSD
, and BSD
would be union of all known BSDs, like FREEBSD
, OPENBSD
.
This way the Methods definitions would hardly ever require update. For example the method for Gnome could be PlatformSupport(UNIX, unsupported=MACOS)
, and then just the definition of UNIX
would be updated in the future.
from wakepy.
Related Issues (20)
- Code coverage not shown on windows (inv test)
- Importing wakeypy nukes logging config HOT 3
- GitHub Releases are not shown (except to repo owner) HOT 3
- There's still one place calling the log methods of the logging module directly (logging.info())
- Publish also to conda-forge? HOT 1
- Rename the CLI flags: Have same naming convention everywhere. --keep-presenting and -r
- Android support
- Keep a remote server awake after closing SSH connection? HOT 2
- Improve Supported Platforms table
- Wakepy on browser (Pyodide, PyPy.js, Brython, Transcrypt, Skulpt)
- Add support for cygwin
- Add support for ChromeOS
- Add to docs: "Prior to Windows 11 power requests were held an additional 2 minutes after they were dropped by the application. "
- Update migration guide: Add on_fail action example
- Docs: Tell that (most of?) the wakepy Methods will keep the idle/sleep timer at zero for the duration of the context manager
- Conditionally using wakepy modes
- on_success / on_activation hook? (similar to on_fail)
- Include `on_fail="warn"` in the examples of the README / docs?
- Make `on_fail="warn"` the default?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wakepy.