From 0e53b900c07f44066aeeaf0a26b93b3993b3e2a5 Mon Sep 17 00:00:00 2001 From: Thomas Lindner Date: Thu, 9 Jul 2020 18:14:09 +0200 Subject: [PATCH] [core] Unbreak pdoc3/pytest command line arguments --- .github/workflows/documentation.yml | 2 +- kibicara/config.py | 32 +++++++++++++++-------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 8c31a85..404ec3b 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -28,7 +28,7 @@ jobs: run: | python -m pip install --upgrade pip pip install pdoc3 - - name: Build documentation with pydoc3 + - name: Build documentation with pdoc3 run: | pdoc -f -o build --html ${{ env.packageName }} - name: Deploy documentation onto gh-pages diff --git a/kibicara/config.py b/kibicara/config.py index 9459940..d7f216d 100644 --- a/kibicara/config.py +++ b/kibicara/config.py @@ -6,6 +6,7 @@ from argparse import ArgumentParser from pytoml import load +from sys import argv config = { @@ -14,19 +15,20 @@ config = { 'root_url': 'http://localhost:8000/', } -parser = ArgumentParser() -parser.add_argument( - '-f', - '--config', - dest='configfile', - default='/etc/kibicara.conf', - help='path to config file', -) -args = parser.parse_args() +if argv[0] == 'kibicara': + parser = ArgumentParser() + parser.add_argument( + '-f', + '--config', + dest='configfile', + default='/etc/kibicara.conf', + help='path to config file', + ) + args = parser.parse_args() -try: - with open(args.configfile) as configfile: - config.update(load(configfile)) -except FileNotFoundError: - # run with default config - pass + try: + with open(args.configfile) as configfile: + config.update(load(configfile)) + except FileNotFoundError: + # run with default config + pass