示例#1
0
 def __read_remote_module(self, module):
     """
     Read a module file from a remote, and return the source.
     """
     
     for url in Remote.all():
         source = Remote.get(url).download(module)
         
         # if we found the source, we return straight away - this allows us to
         # install the module from the first source that we come across
         if source != None:
             return source
     
     return None
示例#2
0
    def __read_remote_module(self, module):
        """
        Read a module file from a remote, and return the source.
        """

        for url in Remote.all():
            source = Remote.get(url).download(module)

            # if we found the source, we return straight away - this allows us to
            # install the module from the first source that we come across
            if source != None:
                return source

        return None
示例#3
0
 def __get_combined_index(self):
     """
     Fetches INDEX files from all known remotes, and builds a combined INDEX
     listing of all available modules.
     """
     
     index = set([])
     
     for url in Remote.all():
         source = Remote.get(url).download("INDEX.xml")
         
         if source != None:
             modules = xml.fromstring(source)
             
             index = index.union(map(lambda m: ModuleInfo(url, m.attrib['name'], m.find("./description").text), modules.findall("./module")))
     
     return filter(lambda m: m != None and m != "", index)
示例#4
0
 def __get_combined_index(self):
     """
     Fetches INDEX files from all known remotes, and builds a combined INDEX
     listing of all available modules.
     """
     
     index = set([])
     
     for url in Remote.all():
         source = Remote.get(url).download("INDEX.xml")
         
         if source != None:
             modules = xml.fromstring(source)
             
             index = index.union(map(lambda m: ModuleInfo(url, m.attrib['name'], m.find("./description").text), modules.findall("./module")))
     
     return filter(lambda m: m != None and m != "", index)
示例#5
0
    def testItShouldGetNoneIfARemoteDoesNotExist(self):
        Configuration._Configuration__config = self.mockConfigWithRemotes([])

        assert Remote.get("http://myremote.com/") == None
示例#6
0
    def testItShouldGetARemote(self):
        Configuration._Configuration__config = self.mockConfigWithRemotes(
            ["http://myremote.com/"])

        assert isinstance(Remote.get("http://myremote.com/"), Remote)