/usr/lib/python3/dist-packages/glue/managers/base.py is in glue-sprite 0.13-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | from glue.core import Sprite
from glue.formats import formats
class BaseManager(object):
def __init__(self, *args, **kwargs):
self.config = kwargs
self.sprites = []
def process(self):
self.find_sprites()
self.validate()
self.save()
def add_sprite(self, path):
"""Create a new Sprite using this path and name and append it to the
sprites list.
:param path: Sprite path.
:param name: Sprite name.
"""
sprite = Sprite(path=path, config=self.config)
self.sprites.append(sprite)
def find_sprites(self):
raise NotImplementedError
def validate(self):
"""Validate all sprites inside this manager."""
for sprite in self.sprites:
sprite.validate()
def save(self):
"""Save all sprites inside this manager."""
for format_name in self.config['enabled_formats']:
format_cls = formats[format_name]
for sprite in self.sprites:
format = format_cls(sprite=sprite)
format.validate()
if format.needs_rebuild() or sprite.config['force']:
print("Format '{0}' for sprite '{1}' needs rebuild...".format(format_name, sprite.name))
format.build()
else:
print("Format '{0}'' for sprite '{1}' already exists...".format(format_name, sprite.name))
|