libx52/daemon/x52ctl.in

32 lines
940 B
Plaintext

#!@PYTHON@
# SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0
"""Uninstalled launcher: prepend build dir for generated config_defs."""
import os
import sys
_BUILD_PKG = r'@X52D_PY_PKG@'
if _BUILD_PKG and _BUILD_PKG not in sys.path:
sys.path.insert(0, _BUILD_PKG)
_here = os.path.dirname(os.path.abspath(__file__))
if 'X52DCOMM_LIB' not in os.environ:
for _name in (
'libx52dcomm.so',
'libx52dcomm.so.1',
'libx52dcomm.so.1.0.0',
'libx52dcomm.dylib',
):
_cand = os.path.join(_here, _name)
if os.path.isfile(_cand):
os.environ['X52DCOMM_LIB'] = _cand
break
_src_dir = os.path.normpath(os.path.join(_here, '..', '..', 'daemon'))
if os.path.isfile(os.path.join(_src_dir, 'x52ctl_main.py')) and _src_dir not in sys.path:
sys.path.insert(0, _src_dir)
from x52ctl_main import main
if __name__ == '__main__':
raise SystemExit(main())