mozpack.packager package

Submodules

mozpack.packager.formats module

class mozpack.packager.formats.FlatFormatter(copier)

Bases: PiecemealFormatter

Formatter for the flat package format.

class mozpack.packager.formats.FlatSubFormatter(copier)

Bases: object

Sub-formatter for the flat package format.

add(path, content)
add_interfaces(path, content)
add_manifest(entry)
contains(path)
class mozpack.packager.formats.JarFormatter(copier, compress=True)

Bases: PiecemealFormatter

Formatter for the jar package format. Assumes manifest entries related to chrome are registered before the chrome data files are added. Also assumes manifest entries for resources are registered after chrome manifest entries.

class mozpack.packager.formats.JarSubFormatter(copier, compress=True)

Bases: PiecemealFormatter

Sub-formatter for the jar package format. It is a PiecemealFormatter that dispatches between further sub-formatter for each of the jar files it dispatches the chrome data to, and a FlatSubFormatter for the non-chrome files.

add_manifest(entry)
class mozpack.packager.formats.OmniJarFormatter(copier, omnijar_name, compress=True, non_resources=())

Bases: JarFormatter

Formatter for the omnijar package format.

class mozpack.packager.formats.OmniJarSubFormatter(copier, omnijar_name, compress=True, non_resources=())

Bases: PiecemealFormatter

Sub-formatter for the omnijar package format. It is a PiecemealFormatter that dispatches between a FlatSubFormatter for the resources data and another FlatSubFormatter for the other files.

add_manifest(entry)
is_resource(path)

Return whether the given path corresponds to a resource to be put in an omnijar archive.

class mozpack.packager.formats.PiecemealFormatter(copier)

Bases: object

Generic formatter that dispatches across different sub-formatters according to paths.

add(path, content)
add_base(base, addon=False)
add_interfaces(path, content)
add_manifest(entry)
contains(path)

mozpack.packager.l10n module

Replace localized parts of a packaged directory with data from a langpack directory.

mozpack.packager.l10n.FlatFormatter

alias of L10NRepackFormatter

mozpack.packager.l10n.JarFormatter

alias of L10NRepackFormatter

mozpack.packager.l10n.L10NRepackFormatter(klass)
class mozpack.packager.l10n.L10NRepackFormatterMixin(*args, **kwargs)

Bases: object

add(path, file)
class mozpack.packager.l10n.LocaleManifestFinder(finder)

Bases: object

mozpack.packager.l10n.OmniJarFormatter

alias of L10NRepackFormatter

mozpack.packager.l10n.repack(source, l10n, extra_l10n={}, non_resources=[], non_chrome={}, minify=False)

Replace localized data from the source directory with localized data from l10n and extra_l10n.

The source argument points to a directory containing a packaged application (in omnijar, jar or flat form). The l10n argument points to a directory containing the main localized data (usually in the form of a language pack addon) to use to replace in the packaged application. The extra_l10n argument contains a dict associating relative paths in the source to separate directories containing localized data for them. This can be used to point at different language pack addons for different parts of the package application. The non_resources argument gives a list of relative paths in the source that should not be added in an omnijar in case the packaged application is in that format. The non_chrome argument gives a list of file/directory patterns for localized files that are not listed in a chrome.manifest. If minify, .properties files are minified.

mozpack.packager.unpack module

class mozpack.packager.unpack.UnpackFinder(source, omnijar_name=None, unpack_xpi=True, **kwargs)

Bases: BaseFinder

Special Finder object that treats the source package directory as if it were in the flat chrome format, whatever chrome format it actually is in.

This means that for example, paths like chrome/browser/content/… match files under jar:chrome/browser.jar!/content/… in case of jar chrome format.

The only argument to the constructor is a Finder instance or a path. The UnpackFinder is populated with files from this Finder instance, or with files from a FileFinder using the given path as its root.

find(path)

Yield path, BaseFile_instance pairs for all files under the base directory and its subdirectories that match the given pattern. See the mozpack.path.match documentation for a description of the handled patterns.

mozpack.packager.unpack.unpack(source, omnijar_name=None)

Transform a jar chrome or omnijar packaged directory into a flat package.

mozpack.packager.unpack.unpack_to_registry(source, registry, omnijar_name=None)

Transform a jar chrome or omnijar packaged directory into a flat package.

The given registry is filled with the flat package.