summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorYaakov M. Nemoy <loupgaroublond@gmail.com>2009-01-18 22:21:05 -0500
committerYaakov M. Nemoy <loupgaroublond@gmail.com>2009-01-18 22:21:05 -0500
commitd3d01a3237b1767f61953e34879dffd16667b769 (patch)
tree360c9a4d5131580cbbd42973f5a98ef9e2d04a02 /base
parent2582dbfd415494a7fa5b378082b0aba19e6d88c1 (diff)
downloadfedora-devshell-d3d01a3237b1767f61953e34879dffd16667b769.tar.gz
fedora-devshell-d3d01a3237b1767f61953e34879dffd16667b769.tar.xz
fedora-devshell-d3d01a3237b1767f61953e34879dffd16667b769.zip
Modifies factories, adds a BuildSystemFactory
BSFactory, oh yeah!
Diffstat (limited to 'base')
-rw-r--r--base/factories.py (renamed from base/dirfactory.py)16
1 files changed, 15 insertions, 1 deletions
diff --git a/base/dirfactory.py b/base/factories.py
index 57d66db..98022fe 100644
--- a/base/dirfactory.py
+++ b/base/factories.py
@@ -27,10 +27,24 @@ from exceptions import ExecutionException
directory_type = dict()
-def register(cls, name):
+def register_dirfactory(cls, name):
global directory_type
directory_type[name] = cls
+buildsystem_type = dict()
+
+def register_buildsystem(cls, name):
+ global buildsystem_type
+ buildsystem_type[name] = cls
+
+class BuildSystemFactory(object):
+ def __new__(cls, type, *args):
+ new_cls = buildsystem_type[type]
+ foo = new_cls.__new__(new_cls, *args)
+ foo.__init__(*args)
+ return foo
+
+
class DirFactory(object):
'''creates a new object of type defined by a directory's .devshell file'''
def __new__(cls, name=None):