Example #1
0
    def get_needed_blok(cls, blok):
        """Get and import/load the blok given with dependencies

        :param blok:
        :return:
        """
        if cls.has(blok):
            return True

        if blok not in cls.bloks:
            return False

        cls.get_needed_blok_dependencies(blok)
        cls.ordered_bloks.append(blok)
        EnvironmentManager.set('current_blok', blok)

        if not ImportManager.has(blok):
            # Import only if the blok doesn't exists, do not reload here
            mod = ImportManager.add(blok)
            mod.imports()
        else:
            mod = ImportManager.get(blok)
            mod.reload()

        if cls.bloks[blok].autoinstall:
            cls.auto_install.append(blok)

        return True
Example #2
0
    def blok_importers(cls, blok):
        EnvironmentManager.set('current_blok', blok)

        if not ImportManager.has(blok):
            # Import only if the blok doesn't exists, do not reload here
            mod = ImportManager.add(blok)
            mod.imports()
        else:
            mod = ImportManager.get(blok)
            mod.reload()
Example #3
0
    def get_need_blok(cls, blok):
        if cls.has(blok):
            return True

        if blok not in cls.bloks:
            return False

        cls.get_need_blok_linked_bloks(blok)
        cls.ordered_bloks.append(blok)
        EnvironmentManager.set('current_blok', blok)

        if not ImportManager.has(blok):
            # Import only if not exist don't reload here
            mod = ImportManager.add(blok)
            mod.imports()
        else:
            mod = ImportManager.get(blok)
            mod.reload()

        if cls.bloks[blok].autoinstall:
            cls.auto_install.append(blok)

        return True
Example #4
0
    def get_need_blok(cls, blok):
        if cls.has(blok):
            return True

        if blok not in cls.bloks:
            return False

        cls.get_need_blok_linked_bloks(blok)
        cls.ordered_bloks.append(blok)
        EnvironmentManager.set('current_blok', blok)

        if not ImportManager.has(blok):
            # Import only if not exist don't reload here
            mod = ImportManager.add(blok)
            mod.imports()
        else:
            mod = ImportManager.get(blok)
            mod.reload()

        if cls.bloks[blok].autoinstall:
            cls.auto_install.append(blok)

        return True
Example #5
0
 def test_get_unexisting_blok(self):
     try:
         ImportManager.get('mockblok2')
         self.fail('No watchdog for inexisting blok module')
     except ImportManagerException:
         pass
Example #6
0
 def test_get_blok(self):
     ImportManager.add('mockblok')
     ImportManager.get('mockblok')
Example #7
0
 def test_get_unexisting_blok(self):
     try:
         ImportManager.get('mockblok2')
         self.fail('No watchdog for inexisting blok module')
     except ImportManagerException:
         pass
Example #8
0
 def test_get_blok(self):
     ImportManager.add('mockblok')
     ImportManager.get('mockblok')