Exemplo n.º 1
0
    def _init_prefixes(cls):
        from library.python.resource import resfs_read, resfs_files

        for resource in resfs_files():
            if not resource.endswith('top_level.txt'):
                continue
            data = resfs_read(resource).decode('utf-8')
            for top_level in data.split('\n'):
                if top_level:
                    cls.prefixes[top_level] = resource[:-len('top_level.txt')]
Exemplo n.º 2
0
    def _init_prefixes(cls):
        from library.python.resource import resfs_read, resfs_files
        cls.prefixes.clear()

        METADATA_NAME = re.compile('^Name: (.*)$', re.MULTILINE)

        for resource in resfs_files():
            if not resource.endswith('METADATA'):
                continue
            data = resfs_read(resource).decode('utf-8')
            metadata_name = METADATA_NAME.search(data)
            if metadata_name:
                metadata_name = Prepared(metadata_name.group(1))
                cls.prefixes[metadata_name.normalized] = resource[:-len('METADATA')]