|
Methods defined here:
- __init__(self, packageName, directory, generators={'': SimpleGenerator (singleton), '.htm': CompressedGenerator (singleton), '.html': CompressedGenerator (singleton), '.pdf': CompressedGenerator (singleton), '.txt': CompressedGenerator (singleton)})
- Initialse the Repository
directory -- the package's directory, in which we will
do all of our work.
- __repr__(self)
- compareDates(self, first, second)
- Compare dates for two filenames
This is it's own function so that a better
comparison mechanism could be included easily.
Returns boolean saying whether the first date is
before-or-equal to the second
- extract(self, force=0)
- Extract encoded files to disk files
for each python source file other than __init__.py, we
attempt to write:
module.data to module.source
if module.source doesn't exist, or is older,
or force is true, then we write the file, otherwise
we skip the file.
- extractFile(self, module, force=0)
- Extract a single file from source (python module) to destination
- fileToName(self, filename)
- Get Python module name and extension from filename
This is a primary customisation point, as it allows you
to choose the module-names in the package as generated
by the system. The default implementation does the
following to the name:
replaces all '.' with '_'
replaces all ' ' with '_'
So, obviously, there are cases where two different
filenames will produce the same module name. Those
cases will be caught by the processing code and raise
ValueErrors.
Note that for case-in-sensitive file-systems, there
will potentially be silent overwrites as files which
differ only in case will not raise a ValueError.
returns (base, extension)
base -- processed filename
extension -- lowercase-only version of the file
extension, or "" if no extension was found.
- getGenerator(self, extension='')
- Get a file-type-specific generator, or the default
- importModule(self, baseName)
- Import the given module from our package and return the module object
- isEncodedResource(self, file, ext)
- Determine whether we consider this file an encoded resource module
- isResource(self, file, ext)
- Determine whether we consider this file a resource
- scan(self, force=0)
- Scan the directory, looking for updated/added resources
- scanFile(self, source, base=None, extension=None, force=0)
- Encode/update/scan a single file
source -- full path name of the source-file
base -- (optional) calculated base module name
extension -- (optional) calculated lower-cased extension
force -- whether to force update even if dates suggest
the module is already up-to-date.
Note: this does _not_ check to see if there is a filename
conflict between resources, so potentially it could
overwrite another source-file's destination module.
Data and non-method functions defined here:
- __doc__ = 'Represents an individual ResourcePackage at desi...anning (embedding) and extracting\n\tthe package.\n\t'
- __module__ = 'resourcepackage.package'
- directory = ''
- ignoreExtensions = ['.pyc', '.pyo']
- ignoreFiles = ['__init__.py']
|