Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow multiple ini files to be specified on the command line

  • Loading branch information...
commit 6481eaf5a816533489a775aa83974a0b65b506c8 1 parent 6468d23
@rubys authored
Showing with 11 additions and 8 deletions.
  1. +3 −3 planet.py
  2. +8 −5 planet/config.py
View
6 planet.py
@@ -17,7 +17,7 @@
import os, sys
if __name__ == "__main__":
- config_file = "config.ini"
+ config_file = []
offline = 0
verbose = 0
only_if_new = 0
@@ -54,10 +54,10 @@
print >>sys.stderr, "Unknown option:", arg
sys.exit(1)
else:
- config_file = arg
+ config_file.append(arg)
from planet import config
- config.load(config_file)
+ config.load(config_file or 'config.ini')
if verbose:
import planet
View
13 planet/config.py
@@ -134,11 +134,11 @@ def define_tmpl_int(name, default):
define_tmpl('filter', None)
define_tmpl('exclude', None)
-def load(config_file):
+def load(config_files):
""" initialize and load a configuration"""
global parser
parser = ConfigParser()
- parser.read(config_file)
+ parser.read(config_files)
import config, planet
from planet import opml, foaf, csv_config
@@ -157,8 +157,11 @@ def load(config_file):
dirs = config.template_directories()
if theme_dir not in dirs:
dirs.append(theme_dir)
- if os.path.dirname(config_file) not in dirs:
- dirs.append(os.path.dirname(config_file))
+ if not hasattr(config_files, 'append'):
+ 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
parser = ConfigParser()
@@ -172,7 +175,7 @@ def load(config_file):
# merge configurations, allowing current one to override theme
template_files = config.template_files()
parser.set('Planet','template_files','')
- parser.read(config_file)
+ parser.read(config_files)
for file in config.bill_of_materials():
if not file in bom: bom.append(file)
parser.set('Planet', 'bill_of_materials', ' '.join(bom))
Please sign in to comment.
Something went wrong with that request. Please try again.