From 908607c85674887bb91ba2ce85a168add79e834c Mon Sep 17 00:00:00 2001 From: equinox Date: Fri, 14 Sep 2012 16:01:44 +0000 Subject: initial checkin git-svn-id: https://svn.spreadspace.org/flufigut/trunk@2 88d0365b-309c-4eec-8061-d8e0c04ad69e --- src/flufig.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 src/flufig.py (limited to 'src/flufig.py') diff --git a/src/flufig.py b/src/flufig.py new file mode 100755 index 0000000..c2c58c7 --- /dev/null +++ b/src/flufig.py @@ -0,0 +1,41 @@ +#!/usr/bin/python +# +# flufig +# +# flufig is a simple flumotion configuration generator using +# pyhton jinja2 template engine and simplejson. flufig generates +# planet.xml and worker.xml files from configuration templates and +# a easy representation of the flow structure written in json. +# +# +# Copyright (C) 2012 Christian Pointner +# +# This file is part of flufig. +# +# flufig is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# any later version. +# +# flufig is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with flufig. If not, see . +# + +import sys +from exceptions import * +from jinja2 import Environment, FileSystemLoader + +if len(sys.argv) <= 2: + raise SystemExit("No template and or data file given") + +data = []; +env = Environment(loader=FileSystemLoader('../templates/%s/' % (sys.argv[1]))) +template = env.get_template('planet.xml') +planet = template.render(data) + +sys.stdout.write(planet.encode("utf8")) -- cgit v1.2.3