aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2021-04-18 19:51:57 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2021-04-18 19:51:57 +0300
commit9477c828ed470f4f5514517cfa1ca9df1ec9588a (patch)
tree2be466b4cb2642785eb69bd29807c325454818a0
parentREADME: update (diff)
downloadcgitize-9477c828ed470f4f5514517cfa1ca9df1ec9588a.tar.gz
cgitize-9477c828ed470f4f5514517cfa1ca9df1ec9588a.zip
error out if my_repos.py cannot be found
-rw-r--r--cgitize/config.py4
-rw-r--r--cgitize/main.py2
2 files changed, 6 insertions, 0 deletions
diff --git a/cgitize/config.py b/cgitize/config.py
index 84c7149..a630d7a 100644
--- a/cgitize/config.py
+++ b/cgitize/config.py
@@ -5,6 +5,7 @@
import configparser
import importlib
+import logging
import os.path
import sys
@@ -72,6 +73,9 @@ class Config:
def import_my_repos(self):
sys.path.append(os.path.dirname(self.my_repos))
+ if not os.path.exists(self.my_repos):
+ logging.error("Couldn't find my_repos.py at: %s", self.my_repos)
+ return None
module_name = os.path.splitext(os.path.basename(self.my_repos))[0]
module = importlib.import_module(module_name)
return module.MY_REPOS
diff --git a/cgitize/main.py b/cgitize/main.py
index 7d2632d..0c8f029 100644
--- a/cgitize/main.py
+++ b/cgitize/main.py
@@ -34,6 +34,8 @@ def main(args=None):
with setup_logging(args.verbose):
config = Config.read(args.config)
my_repos = config.import_my_repos()
+ if my_repos is None:
+ return 1
cgit_server = CGitServer(config.clone_url)
output = CGitRepositories(config.output, cgit_server, force=args.force)
success = True