예제 #1
0
 def find(self, tags, extension=None):
     if not self.extended_data:
         self.init_download()
     log.debug("Looking for tags: {}".format(tags))
     artifacts = self.artifacts
     if extension:
         artifacts = [a for a in self.artifacts if a.extension == extension]
     for tag in tags or []:
         tag = canonify(tag)
         artifacts = [a for a in artifacts if tag in a.tags]
         # Have to force evaluation using list comprehension,
         # since we are overwriting artifacts
     return artifacts
예제 #2
0
파일: packages.py 프로젝트: cfengine/core
 def find(self, tags, extension=None):
     if not self.extended_data:
         self.init_download()
     log.debug("Looking for tags: {}".format(tags))
     artifacts = self.artifacts
     if extension:
         artifacts = [a for a in self.artifacts if a.extension == extension]
     for tag in tags or []:
         tag = canonify(tag)
         artifacts = [a for a in artifacts if tag in a.tags]
         # Have to force evaluation using list comprehension,
         # since we are overwriting artifacts
     return artifacts
예제 #3
0
def filter_artifacts(artifacts, tags, extension):
    if extension:
        artifacts = [a for a in artifacts if a.extension == extension]
    log.debug("Looking for tags: {}".format(tags))
    log.debug("In artifacts: {}".format(artifacts))
    for tag in tags or []:
        tag = canonify(tag)
        new_artifacts = [a for a in artifacts if tag in a.tags]
        # Have to force evaluation using list comprehension,
        # since we are overwriting artifacts
        if len(new_artifacts) > 0:
            artifacts = new_artifacts

    log.debug("Found artifacts: {}".format(artifacts))
    return artifacts
예제 #4
0
파일: packages.py 프로젝트: oleorhagen/core
    def __init__(self, data, filename=None):
        if filename and not data:
            data = {}
            data["URL"] = "./" + filename
            data["Title"] = ""
            data["Arch"] = None
            if "sparc" in filename.lower():
                data["Arch"] = "spar"
        self.data = data
        self.url = data["URL"]
        self.title = data["Title"]
        self.arch = canonify(data["Arch"])

        self.filename = basename(self.url)
        self.extension = splitext(self.filename)[1]

        self.tags = ["any"]
        self.create_tags()
예제 #5
0
파일: packages.py 프로젝트: cfengine/core
    def __init__(self, data, filename=None):
        if filename and not data:
            data = {}
            data["URL"] = "./" + filename
            data["Title"] = ""
            data["Arch"] = None
            if "sparc" in filename.lower():
                data["Arch"] = "spar"
        self.data = data
        self.url = data["URL"]
        self.title = data["Title"]
        self.arch = canonify(data["Arch"])

        self.filename = basename(self.url)
        self.extension = splitext(self.filename)[1]

        self.tags = ["any"]
        self.create_tags()
예제 #6
0
파일: packages.py 프로젝트: oleorhagen/core
 def add_tag(self, string):
     assert type(string) is str
     canonified = canonify(string)
     if canonified not in self.tags:
         self.tags.append(canonified)
예제 #7
0
파일: packages.py 프로젝트: cfengine/core
 def add_tag(self, string):
     assert type(string) is str
     canonified = canonify(string)
     if canonified not in self.tags:
         self.tags.append(canonified)