예제 #1
0
    def getAssets(self, assetMacros={}):

        # Memoizing needs assetMacros in the key, otherwise you get wrong
        # results with multiple builds in one generator run.
        macroskey = util.toString(assetMacros)
        macroskey = sha_construct(macroskey).hexdigest()
        if macroskey not in self._assetRegex:
            # prepare a regex encompassing all asset hints, asset macros resolved
            classAssets = self.getHints()['assetDeps'][:]
            iresult  = []  # [AssetHint]
            for res in classAssets:
                # expand file glob into regexp
                res = re.sub(r'\*', ".*", res)
                # expand macros
                if res.find('${')>-1:
                    expres = self._expandMacrosInMeta(assetMacros, res)
                else:
                    expres = [res]
                # collect resulting asset objects
                for e in expres:
                    assethint = AssetHint(res)
                    assethint.clazz = self
                    assethint.expanded = e
                    assethint.regex = re.compile(e)
                    if assethint not in iresult:
                        iresult.append(assethint)
            self._assetRegex[macroskey] = iresult

        return self._assetRegex[macroskey]
예제 #2
0
    def getAssets(self, assetMacros={}):

        # Memoizing needs assetMacros in the key, otherwise you get wrong
        # results with multiple builds in one generator run.
        macroskey = util.toString(assetMacros)
        macroskey = sha_construct(macroskey).hexdigest()
        if macroskey not in self._assetRegex:
            # prepare a regex encompassing all asset hints, asset macros resolved
            classAssets = self.getHints()['assetDeps'][:]
            iresult = []  # [AssetHint]
            for res in classAssets:
                # expand file glob into regexp
                res = re.sub(r'\*', ".*", res)
                # expand macros
                if res.find('${') > -1:
                    expres = self._expandMacrosInMeta(assetMacros, res)
                else:
                    expres = [res]
                # collect resulting asset objects
                for e in expres:
                    assethint = AssetHint(res)
                    assethint.clazz = self
                    assethint.expanded = e
                    assethint.regex = re.compile(e)
                    if assethint not in iresult:
                        iresult.append(assethint)
            self._assetRegex[macroskey] = iresult

        return self._assetRegex[macroskey]
예제 #3
0
    def filename(self, cacheId):
        splittedId = cacheId.split("-")
        
        if len(splittedId) == 1:
            return cacheId
                
        baseId = splittedId.pop(0)
        digestId = sha_construct("-".join(splittedId)).hexdigest()

        return "%s-%s" % (baseId, digestId)
예제 #4
0
    def filename(self, cacheId):
        cacheId = cacheId.encode('utf-8')
        splittedId = cacheId.split("-")

        if len(splittedId) == 1:
            return cacheId

        baseId = splittedId.pop(0)
        digestId = sha_construct("-".join(splittedId)).hexdigest()

        return "%s-%s" % (baseId, digestId)