aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorPriit Laes <plaes@plaes.org>2010-07-09 14:08:39 +0300
committerPriit Laes <plaes@plaes.org>2010-07-09 14:08:39 +0300
commitaff2d813947e5b87acde461ec009b3a20dcfac90 (patch)
treef73ed75fcf580d7befcdbbf4654ae3fb2afaf8dd /utils
parentMove grumpy.cfg to separate dir (diff)
downloadgsoc2010-grumpy-aff2d813947e5b87acde461ec009b3a20dcfac90.tar.gz
gsoc2010-grumpy-aff2d813947e5b87acde461ec009b3a20dcfac90.tar.bz2
gsoc2010-grumpy-aff2d813947e5b87acde461ec009b3a20dcfac90.zip
Added configuration file handling
Diffstat (limited to 'utils')
-rwxr-xr-xutils/grumpy_sync.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/utils/grumpy_sync.py b/utils/grumpy_sync.py
index 58f0083..b6c6bde 100755
--- a/utils/grumpy_sync.py
+++ b/utils/grumpy_sync.py
@@ -250,11 +250,14 @@ def main(path):
package_sync(cat, pkg, files, int(os.stat(dir).st_mtime))
if __name__ == '__main__':
- parser = OptionParser(usage="usage: %prog [options] portagedir")
+ parser = OptionParser(usage="usage: %prog [options] CONFFILE")
(opts, args) = parser.parse_args()
if len(args) != 1:
- parser.error("please provide path to portagedir as first argument")
+ parser.error("provide path to configuration file as first argument")
sys.exit(1)
- # Setup database for application
with app.test_request_context():
- main(args[0])
+ app.config.from_pyfile(args[0])
+ if 'GRUMPY_PORTAGE_DIR' in app.config.keys():
+ portagedir = app.config['GRUMPY_PORTAGE_DIR']
+ if os.path.isdir(portagedir):
+ main(portagedir)