blob: 55214c2850dd0f9eb2a96523b674795db48ca037 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-only
#
# llamachat - a small native chat client for a local llama.cpp router
# Copyright (C) 2026 Danilo M. <danix@danix.xyz>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
"""Launcher. Symlink this into a directory on your PATH.
PySide6 usually lives in a virtualenv rather than the system Python, so this
re-executes itself with the venv interpreter when it finds one. Set
LLAMACHAT_PYTHON to point at a specific interpreter, otherwise the venv
beside the checkout and the default location are tried in turn.
"""
import sys
from pathlib import Path
# Resolve through the symlink so the package is found next to the real file.
HERE = Path(__file__).resolve().parent
sys.path.insert(0, str(HERE))
import llamachat_venv # noqa: E402
# The control commands do not need Qt, so only pay for the handover when a
# command that builds a window is about to run.
_NO_QT = {"--toggle", "--show", "--hide", "--ping", "--quit", "--version",
"--help", "-h"}
if not _NO_QT & set(sys.argv[1:]):
llamachat_venv.reexec(__file__)
from llamachat.__main__ import main # noqa: E402
if __name__ == "__main__":
sys.exit(main())
|