Files
frappy/bin/frappy-edit
Markus Zolliker 71ab0bebd5 frappy-edit: add missing bin/frappy-edit
Change-Id: I43b4d645186342c08d296ef5482e63f1ec667b93
2026-02-12 09:34:16 +01:00

46 lines
1.7 KiB
Python
Executable File

#!/usr/bin/env python3
# *****************************************************************************
# Copyright (c) 2015-2024 by the authors, see LICENSE
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# 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.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Module authors:
# Markus Zolliker <markus.zolliker@psi.ch>
#
# *****************************************************************************
import sys
import os
from pathlib import Path
# Add import path for inplace usage
repo = Path(__file__).absolute().parents[1]
sys.path.insert(0, str(repo))
from frappy.lib import generalConfig
from frappy.tools.cfgedit import EditorMain
# merge cfg dirs from env variable and the ones typically used at psi
# use dicts instead of sets, as we want to keep order
cfgdirs = os.environ.get('FRAPPY_CONFDIR', None)
cfgdirs = cfgdirs.split(':') if cfgdirs else []
for cfgdir in 'cfg', 'cfg/main', 'cfg/stick', 'cfg/addons':
cfgpath = repo / cfgdir
if cfgpath.exists():
cfgdirs.append(str(cfgpath))
os.environ['FRAPPY_CONFDIR'] = ':'.join(cfgdirs)
generalConfig.init()
EditorMain(sys.argv[1]).run()