Skip to content

Commit

Permalink
Fix build: rumps is a macos only dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Sep 18, 2024
1 parent 662af2b commit 23c3748
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
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

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

0 comments on commit 23c3748

Please sign in to comment.