summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Vignatti <tiago.vignatti@nokia.com>2010-06-30 20:13:21 +0300
committerTiago Vignatti <tiago.vignatti@nokia.com>2010-06-30 20:13:21 +0300
commita91d5f59e586ca700d8ae665617dfd1dbd41dda3 (patch)
tree1598799fbc053154a70bcdb41d040fc6c988a56b
parent03238ecf179f95e8cad02082bb7199f29a26c07c (diff)
Add option to get the configuration files from a given base directory
Instead boringly be replicating the directory base name where gitdm is installed and write it on each option inside the configuration file, just send it through the command line. Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
-rw-r--r--ConfigFile.py9
-rw-r--r--README2
-rwxr-xr-xgitdm11
3 files changed, 15 insertions, 7 deletions
diff --git a/ConfigFile.py b/ConfigFile.py
index 1ac2508..1fc8823 100644
--- a/ConfigFile.py
+++ b/ConfigFile.py
@@ -95,7 +95,8 @@ def ReadGroupMap (fname, employer):
#
# Read an overall config file.
#
-def ConfigFile (name):
+
+def ConfigFile (name, confdir):
try:
file = open (name, 'r')
except IOError:
@@ -106,13 +107,13 @@ def ConfigFile (name):
if len (sline) < 2:
croak ('Funky config line: "%s"' % (line))
if sline[0] == 'EmailAliases':
- ReadEmailAliases (sline[1])
+ ReadEmailAliases (confdir + sline[1])
elif sline[0] == 'EmailMap':
- ReadEmailEmployers (sline[1])
+ ReadEmailEmployers (confdir + sline[1])
elif sline[0] == 'GroupMap':
if len (sline) != 3:
croak ('Funky group map line "%s"' % (line))
- ReadGroupMap (sline[1], sline[2])
+ ReadGroupMap (confdir + sline[1], sline[2])
else:
croak ('Unrecognized config line: "%s"' % (line))
line = ReadConfigLine (file)
diff --git a/README b/README
index 7f5d0b2..9a3b03f 100644
--- a/README
+++ b/README
@@ -26,6 +26,8 @@ be:
-a If a patch contains signoff lines from both Andrew Morton
and Linus Torvalds, omit Linus's.
+ -b dir Specify the base directory to fetch the configuration files.
+
-c file Specify the name of the gitdm configuration file.
By default, "./gitdm.config" is used.
diff --git a/gitdm b/gitdm
index 6ecf984..93ac0fc 100755
--- a/gitdm
+++ b/gitdm
@@ -35,10 +35,13 @@ CSVFile = None
AkpmOverLt = 0
DumpDB = 0
CFName = 'gitdm.config'
+DirName = ''
+
#
# Options:
#
# -a Andrew Morton's signoffs shadow Linus's
+# -b dir Specify the base directory to fetch the configuration files
# -c cfile Specify a configuration file
# -d Output individual developer stats
# -D Output date statistics
@@ -54,12 +57,14 @@ CFName = 'gitdm.config'
def ParseOpts ():
global MapUnknown, DevReports
global DateStats, AuthorSOBs, FileFilter, AkpmOverLt, DumpDB
- global CFName, CSVFile
+ global CFName, CSVFile, DirName
- opts, rest = getopt.getopt (sys.argv[1:], 'adc:Dh:l:o:r:sux:z')
+ opts, rest = getopt.getopt (sys.argv[1:], 'ab:dc:Dh:l:o:r:sux:z')
for opt in opts:
if opt[0] == '-a':
AkpmOverLt = 1
+ elif opt[0] == '-b':
+ DirName = opt[1]
elif opt[0] == '-c':
CFName = opt[1]
elif opt[0] == '-d':
@@ -302,7 +307,7 @@ ParseOpts ()
#
# Read the config files.
#
-ConfigFile.ConfigFile (CFName)
+ConfigFile.ConfigFile (CFName, DirName)
#
# Let's pre-seed the database with a couple of hackers