git-interface: Factor out configuration file parsing

Add a new module that automatically locates the configuration file and
provides methods to obtain the values of configuration options.

Use the new module instead of ConfigParser everywhere.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
Lukas Fleischer 2016-08-03 20:21:40 +02:00
parent 2915abb9d3
commit 2f5f5583be
5 changed files with 32 additions and 18 deletions

View file

@ -1,6 +1,5 @@
#!/usr/bin/python3
import configparser
import os
import pygit2
import re
@ -10,11 +9,9 @@ import sys
import srcinfo.parse
import srcinfo.utils
import config
import db
config = configparser.RawConfigParser()
config.read(os.path.dirname(os.path.realpath(__file__)) + "/../conf/config")
notify_cmd = config.get('notifications', 'notify-cmd')
repo_path = config.get('serve', 'repo-path')