/usr/lib/python3/dist-packages/glue/managers/project.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 | import os
from glue.exceptions import NoSpritesFoldersFoundError
from .base import BaseManager
from glue.core import ConfigurableFromFile
class ProjectManager(BaseManager, ConfigurableFromFile):
"""Process a path searching for folders that contain images.
Every folder will be a new sprite with all the images inside.
This is not the default manager. It is only used if you use
the ``--project`` argument."""
def __init__(self, *args, **kwargs):
super(ProjectManager, self).__init__(*args, **kwargs)
self.config_path = self.config['source']
self.config.update(self._get_config_from_file('sprite.conf', 'sprite'))
def find_sprites(self):
for filename in sorted(os.listdir(self.config['source'])):
# Only process folders
path = os.path.join(self.config['source'], filename)
# Ignore filenames starting with '.'
if filename.startswith('.'):
continue
# Ignore symlinks if necessary.
if not os.path.isdir(path) and not (os.path.islink(path) and self.config['follow_links']):
continue
self.add_sprite(path=path)
if not self.sprites:
raise NoSpritesFoldersFoundError(self.config['source'])
|