2 # -*- coding: utf-8 -*-
6 This program is a command-line-driven module loader for Systematiki. It
7 provides for running any combination of one Systematiki front-end and one
11 # Copyright 2007 Felix Rabe
13 # This file is part of Systematiki.
15 # Systematiki is free software; you can redistribute it and/or modify it
16 # under the terms of the GNU Lesser General Public License as published by
17 # the Free Software Foundation; either version 3 of the License, or (at
18 # your option) any later version.
20 # Systematiki is distributed in the hope that it will be useful, but
21 # WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
23 # General Public License for more details.
25 # You should have received a copy of the GNU Lesser General Public License
26 # along with Systematiki. If not, see <http://www.gnu.org/licenses/>.
33 systematiki.py --back Back.End ... --front Front.End ..."""
36 def load_module(module_name
):
38 components
= module_name
.split(".")
40 for x
in components
[:-1]:
41 fn
= [".".join(fn
+ [x
])]
42 path
= imp
.load_module(fn
[0], *imp
.find_module(x
, path
)).__path
__
44 fn
= [".".join(fn
+ [x
])]
45 return imp
.load_module(fn
[0], *imp
.find_module(x
, path
))
50 assert argv
[1] == "--back"
51 backend_name
= argv
[2]
52 i
= argv
.index("--front", 3)
53 backend_options
= argv
[3:i
]
54 frontend_name
= argv
[i
+1]
55 frontend_options
= argv
[i
+2:]
60 backend_module
= load_module(backend_name
)
61 frontend_module
= load_module(frontend_name
)
63 backend_instance
= backend_module
.SystBack(*backend_options
)
64 frontend_instance
= frontend_module
.SystFront(*frontend_options
)
66 frontend_instance
.set_back(backend_instance
)
67 backend_instance
.set_front(frontend_instance
)
70 if __name__
== "__main__":
71 sys
.exit(main(sys
.argv
))