From c6fb3e236ff6e2391b3b9bd81a3cf694fb5b578f Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Mon, 21 Oct 2024 20:09:31 +0100 Subject: [PATCH] systemd/launchd: work around when promnesia binary isn't available in PATH, use sys.executable should resolve https://github.com/karlicoss/promnesia/issues/433 --- src/promnesia/misc/install_server.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/promnesia/misc/install_server.py b/src/promnesia/misc/install_server.py index 46268ff9..70364654 100644 --- a/src/promnesia/misc/install_server.py +++ b/src/promnesia/misc/install_server.py @@ -3,7 +3,6 @@ import argparse import os import platform -import shutil import sys import time from pathlib import Path @@ -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,