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

Fix build: rumps is a macos only dependency #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions jaraco/home/trap-watcher.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import sys
from typing import TYPE_CHECKING

if sys.platform != "darwin" and TYPE_CHECKING:
assert False # https://github.com/python/mypy/issues/9025#issuecomment-1087270212
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


import asyncio
import pathlib
import subprocess
import sys

import keyring
import rumps
import typer
import victor_smart_kill as vsk

from . import contact
from .compat.py38 import resources


app = typer.Typer()


Expand Down Expand Up @@ -63,4 +66,12 @@ def main(ctx: typer.Context, update: bool = False):
TrapWatch()


__name__ == '__main__' and app()
if __name__ == '__main__':
# This check and import must be delayed as to not break pytest discovery
if sys.platform != "darwin":
print("This app is only available on MacOS.")
sys.exit(1)

import rumps

app()
1 change: 1 addition & 0 deletions newsfragments/3.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix build on non-Darwin machines -- by :user:`Avasam`
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies = [
'importlib_resources; python_version < "3.9"',
"jaraco.compat>=4.1",
"tempora>=5.7",
"rumps",
"rumps; sys_platform == 'darwin'",
"typer",
]
dynamic = ["version"]
Expand Down
Loading