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

systemd/launchd: work around when promnesia binary isn't available in PATH, use sys.executable #458

Merged
merged 1 commit into from
Oct 21, 2024
Merged
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
7 changes: 4 additions & 3 deletions src/promnesia/misc/install_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import argparse
import os
import platform
import shutil
import sys
import time
from pathlib import Path
Expand Down Expand Up @@ -114,14 +113,16 @@ def install(args: argparse.Namespace) -> None:
print(f"Writing launch script to {out}", file=sys.stderr)

# ugh. we want to know whether we're invoked 'properly' as an executable or ad-hoc via scripts/promnesia
extra_exe: list[str] = []
if os.environ.get('DIRTY_RUN') is not None:
launcher = str(root() / 'scripts/promnesia')
else:
exe = shutil.which('promnesia'); assert exe is not None
launcher = exe # older systemd wants absolute paths..
launcher = sys.executable
extra_exe = ['-m', 'promnesia']

db = args.db
largs = [
*extra_exe,
'serve',
*([] if db is None else ['--db', str(db)]),
'--timezone', args.timezone,
Expand Down