X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fdak.py;h=0eeb9d7b80255ef47281933719f5c5919de9456f;hb=cae814a1ffbbb2944931693f35f73062a5ea99e7;hp=f82d74ccaafd18eb79361a78d8f2678f91f5eec1;hpb=6d6100fcee8e50bef063d8b8cd395773d83077b4;p=dak.git diff --git a/dak/dak.py b/dak/dak.py index f82d74cc..0eeb9d7b 100755 --- a/dak/dak.py +++ b/dak/dak.py @@ -28,8 +28,28 @@ ################################################################################ -import sys -import daklib.utils +import sys, imp +import daklib.utils, daklib.extensions + +################################################################################ + +class UserExtension: + def __init__(self, user_extension = None): + if user_extension: + m = imp.load_source("dak_userext", user_extension) + d = m.__dict__ + else: + m, d = None, {} + self.__dict__["_module"] = m + self.__dict__["_d"] = d + + def __getattr__(self, a): + if a in self.__dict__: return self.__dict__[a] + if a[0] == "_": raise AttributeError, a + return self._d.get(a, None) + + def __setattr__(self, a, v): + self._d[a] = v ################################################################################ @@ -71,7 +91,9 @@ def init(): "Clean cruft from incoming"), ("clean-proposed-updates", "Remove obsolete .changes from proposed-updates"), - + + ("transitions", + "Manage the release transition file"), ("check-overrides", "Override cruft checks"), ("check-proposed-updates", @@ -143,6 +165,13 @@ Availble commands:""" def main(): """Launch dak functionality.""" + Cnf = daklib.utils.get_conf() + + if Cnf.has_key("Dinstall::UserExtensions"): + userext = UserExtension(Cnf["Dinstall::UserExtensions"]) + else: + userext = UserExtension() + functionality = init() modules = [ command for (command, _) in functionality ] @@ -179,6 +208,13 @@ def main(): # Invoke the module module = __import__(cmdname.replace("-","_")) + + module.dak_userext = userext + userext.dak_module = module + + daklib.extensions.init(cmdname, module, userext) + if userext.init is not None: userext.init(cmdname) + module.main() ################################################################################