Пример #1
0
class Installer(RPCServer):
    def __init__(self, addr, port):
        RPCServer.__init__(self, addr, port)
        self._app = App()
        self._driver = Driver()
    
    def install(self, uid, package, version, typ):
        if typ == APP:
            return self._app.install(uid, package, version)
        elif typ == DRIVER:
            return self._driver.install(uid, package, version)
        else:
            show_error(self, 'failed to install, invalid type, typ=%s' % str(typ))
    
    def uninstall(self, uid, package, typ):
        if typ == APP:
            return self._app.uninstall(uid, package)
        else:
            show_error(self, 'failed to uninstall, invalid type, typ=%s' % str(typ))
    
    def get_packages(self, uid, typ):
        if typ == APP:
            return self._app.get_packages(uid)
    
    def has_package(self, uid, package, typ):
        if typ == APP:
            return self._app.has_package(uid, package)
    
    def start(self):
        t = Thread(target=self.run)
        t.start()
        t.join()
Пример #2
0
 def __init__(self, addr, port):
     RPCServer.__init__(self, addr, port)
     self._app = App()
     self._driver = Driver()