コード例 #1
0
    def _scanResourcePath(self, path):
        if not os.path.exists(path):
            raise ValueError("The given resource path does not exist: %s" % path)

        self._console.debug("Scanning resource folder...")

        path = os.path.abspath(path)
        lib_prefix_len = len(path)
        if not path.endswith(os.sep):
            lib_prefix_len += 1

        for root, dirs, files in filetool.walk(path):
            # filter ignored directories
            for dir in dirs:
                if self._ignoredDirectories.match(dir):
                    dirs.remove(dir)

            for file in files:
                fpath = os.path.join(root, file)
                fpath = os.path.normpath(fpath)
                if Image.isImage(fpath):
                    if CombinedImage.isCombinedImage(fpath):
                        res = CombinedImage(fpath)
                    else:
                        res = Image(fpath)
                    res.analyzeImage()
                else:
                    res = Resource(fpath)
                
                res.id = Path.posifyPath(fpath[lib_prefix_len:])
                res.library= self

                self.resources.add(res)

        return
コード例 #2
0
    def _scanResourcePath(self):
        resources = set()
        if self.resourcePath is None:
            return resources
        if not os.path.isdir(os.path.join(self.path, self.resourcePath)):
            self._console.info("Lib<%s>: Skipping non-existing resource path" %
                               self.namespace)
            return resources

        path = os.path.join(self.path, self.resourcePath)
        self._console.debug("Scanning resource folder...")

        path = os.path.abspath(path)
        lib_prefix_len = len(path)
        if not path.endswith(os.sep):
            lib_prefix_len += 1

        for root, dirs, files in filetool.walk(path):
            # filter ignored directories
            for dir in dirs:
                if self._ignoredDirEntries.match(dir):
                    dirs.remove(dir)

            for file in files:
                if self._ignoredDirEntries.match(file):
                    continue
                fpath = os.path.join(root, file)
                fpath = os.path.normpath(fpath)
                if Image.isImage(fpath):
                    if CombinedImage.isCombinedImage(fpath):
                        res = CombinedImage(fpath)
                    else:
                        res = Image(fpath)
                    res.analyzeImage()
                elif FontMap.isFontMap(fpath):
                    res = FontMap(fpath)
                else:
                    res = Resource(fpath)

                res.set_id(Path.posifyPath(fpath[lib_prefix_len:]))
                res.library = self

                resources.add(res)

        self._console.indent()
        self._console.debug("Found %s resources" % len(resources))
        self._console.outdent()
        return resources
コード例 #3
0
ファイル: Library.py プロジェクト: aspectit/qooxdoo
    def _scanResourcePath(self):
        resources = set()
        if self.resourcePath is None:
            return resources
        if not os.path.isdir(os.path.join(self.path,self.resourcePath)):
            self._console.info("Lib<%s>: Skipping non-existing resource path" % self.namespace)
            return resources

        path = os.path.join(self.path,self.resourcePath)
        self._console.debug("Scanning resource folder...")

        path = os.path.abspath(path)
        lib_prefix_len = len(path)
        if not path.endswith(os.sep):
            lib_prefix_len += 1

        for root, dirs, files in filetool.walk(path):
            # filter ignored directories
            for dir in dirs:
                if self._ignoredDirEntries.match(dir):
                    dirs.remove(dir)

            for file in files:
                if self._ignoredDirEntries.match(file):
                    continue
                fpath = os.path.join(root, file)
                fpath = os.path.normpath(fpath)
                if Image.isImage(fpath):
                    if CombinedImage.isCombinedImage(fpath):
                        res = CombinedImage(fpath)
                    else:
                        res = Image(fpath)
                    res.analyzeImage()
                elif FontMap.isFontMap(fpath):
                    res = FontMap(fpath)
                else:
                    res = Resource(fpath)

                res.set_id(Path.posifyPath(fpath[lib_prefix_len:]))
                res.library= self

                resources.add(res)

        self._console.indent()
        self._console.debug("Found %s resources" % len(resources))
        self._console.outdent()
        return resources
コード例 #4
0
    def _scanResourcePath(self, path):
        if not os.path.exists(path):
            raise ValueError("The given resource path does not exist: %s" %
                             path)

        self._console.debug("Scanning resource folder...")

        path = os.path.abspath(path)
        lib_prefix_len = len(path)
        if not path.endswith(os.sep):
            lib_prefix_len += 1

        self.resources = set()
        for root, dirs, files in filetool.walk(path):
            # filter ignored directories
            for dir in dirs:
                if self._ignoredDirEntries.match(dir):
                    dirs.remove(dir)

            for file in files:
                if self._ignoredDirEntries.match(file):
                    continue
                fpath = os.path.join(root, file)
                fpath = os.path.normpath(fpath)
                if Image.isImage(fpath):
                    if CombinedImage.isCombinedImage(fpath):
                        res = CombinedImage(fpath)
                    else:
                        res = Image(fpath)
                    res.analyzeImage()
                else:
                    res = Resource(fpath)

                res.set_id(Path.posifyPath(fpath[lib_prefix_len:]))
                res.library = self

                self.resources.add(res)

        self._console.indent()
        self._console.debug("Found %s resources" % len(self.resources))
        self._console.outdent()
        return