Allow multiple ini files to be specified on the command line
This commit is contained in:
parent
6468d23e73
commit
6481eaf5a8
@ -17,7 +17,7 @@ __license__ = "Python"
|
|||||||
import os, sys
|
import os, sys
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
config_file = "config.ini"
|
config_file = []
|
||||||
offline = 0
|
offline = 0
|
||||||
verbose = 0
|
verbose = 0
|
||||||
only_if_new = 0
|
only_if_new = 0
|
||||||
@ -54,10 +54,10 @@ if __name__ == "__main__":
|
|||||||
print >>sys.stderr, "Unknown option:", arg
|
print >>sys.stderr, "Unknown option:", arg
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
config_file = arg
|
config_file.append(arg)
|
||||||
|
|
||||||
from planet import config
|
from planet import config
|
||||||
config.load(config_file)
|
config.load(config_file or 'config.ini')
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
import planet
|
import planet
|
||||||
|
@ -134,11 +134,11 @@ def __init__():
|
|||||||
define_tmpl('filter', None)
|
define_tmpl('filter', None)
|
||||||
define_tmpl('exclude', None)
|
define_tmpl('exclude', None)
|
||||||
|
|
||||||
def load(config_file):
|
def load(config_files):
|
||||||
""" initialize and load a configuration"""
|
""" initialize and load a configuration"""
|
||||||
global parser
|
global parser
|
||||||
parser = ConfigParser()
|
parser = ConfigParser()
|
||||||
parser.read(config_file)
|
parser.read(config_files)
|
||||||
|
|
||||||
import config, planet
|
import config, planet
|
||||||
from planet import opml, foaf, csv_config
|
from planet import opml, foaf, csv_config
|
||||||
@ -157,8 +157,11 @@ def load(config_file):
|
|||||||
dirs = config.template_directories()
|
dirs = config.template_directories()
|
||||||
if theme_dir not in dirs:
|
if theme_dir not in dirs:
|
||||||
dirs.append(theme_dir)
|
dirs.append(theme_dir)
|
||||||
if os.path.dirname(config_file) not in dirs:
|
if not hasattr(config_files, 'append'):
|
||||||
dirs.append(os.path.dirname(config_file))
|
config_files = [config_files]
|
||||||
|
for config_file in config_files:
|
||||||
|
if os.path.dirname(config_file) not in dirs:
|
||||||
|
dirs.append(os.path.dirname(config_file))
|
||||||
|
|
||||||
# read in the theme
|
# read in the theme
|
||||||
parser = ConfigParser()
|
parser = ConfigParser()
|
||||||
@ -172,7 +175,7 @@ def load(config_file):
|
|||||||
# merge configurations, allowing current one to override theme
|
# merge configurations, allowing current one to override theme
|
||||||
template_files = config.template_files()
|
template_files = config.template_files()
|
||||||
parser.set('Planet','template_files','')
|
parser.set('Planet','template_files','')
|
||||||
parser.read(config_file)
|
parser.read(config_files)
|
||||||
for file in config.bill_of_materials():
|
for file in config.bill_of_materials():
|
||||||
if not file in bom: bom.append(file)
|
if not file in bom: bom.append(file)
|
||||||
parser.set('Planet', 'bill_of_materials', ' '.join(bom))
|
parser.set('Planet', 'bill_of_materials', ' '.join(bom))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user