mozpack.chrome package¶
Submodules¶
mozpack.chrome.flags module¶
- class mozpack.chrome.flags.Flag(name)¶
Bases:
object
- Class for flags in manifest entries in the form:
“flag” (same as “flag=true”) “flag=yes|true|1” “flag=no|false|0”
- add_definition(definition)¶
Add a flag value definition. Replaces any previously set value.
- matches(value)¶
Return whether the flag value matches the given value. The values are canonicalized for comparison.
- class mozpack.chrome.flags.Flags(*flags)¶
Bases:
collections.OrderedDict
Class to handle a set of flags definitions given on a single manifest entry.
- FLAGS = {'abi': <class 'mozpack.chrome.flags.StringFlag'>, 'application': <class 'mozpack.chrome.flags.StringFlag'>, 'appversion': <class 'mozpack.chrome.flags.VersionFlag'>, 'backgroundtask': <class 'mozpack.chrome.flags.StringFlag'>, 'contentaccessible': <class 'mozpack.chrome.flags.Flag'>, 'os': <class 'mozpack.chrome.flags.StringFlag'>, 'osversion': <class 'mozpack.chrome.flags.VersionFlag'>, 'platform': <class 'mozpack.chrome.flags.Flag'>, 'platformversion': <class 'mozpack.chrome.flags.VersionFlag'>, 'process': <class 'mozpack.chrome.flags.StringFlag'>, 'tablet': <class 'mozpack.chrome.flags.Flag'>, 'xpcnativewrappers': <class 'mozpack.chrome.flags.Flag'>}¶
- RE = re.compile('([!<>=]+)')¶
- match(**filter)¶
- Return whether the set of flags match the set of given filters.
- flags = Flags(‘contentaccessible=yes’, ‘appversion>=3.5’,
‘application=foo’)
flags.match(application=’foo’) returns True flags.match(application=’foo’, appversion=’3.5’) returns True flags.match(application=’foo’, appversion=’3.0’) returns False
- class mozpack.chrome.flags.StringFlag(name)¶
Bases:
object
- Class for string flags in manifest entries in the form:
“flag=string” “flag!=string”
- add_definition(definition)¶
Add a string flag definition.
- matches(value)¶
Return whether one of the string flag definitions matches the given value. For example,
flag = StringFlag(‘foo’) flag.add_definition(‘foo!=bar’) flag.matches(‘bar’) returns False flag.matches(‘qux’) returns True flag = StringFlag(‘foo’) flag.add_definition(‘foo=bar’) flag.add_definition(‘foo=baz’) flag.matches(‘bar’) returns True flag.matches(‘baz’) returns True flag.matches(‘qux’) returns False
- class mozpack.chrome.flags.VersionFlag(name)¶
Bases:
object
- Class for version flags in manifest entries in the form:
“flag=version” “flag<=version” “flag<version” “flag>=version” “flag>version”
- add_definition(definition)¶
Add a version flag definition.
- matches(value)¶
Return whether one of the version flag definitions matches the given value. For example,
flag = VersionFlag(‘foo’) flag.add_definition(‘foo>=1.0’) flag.matches(‘1.0’) returns True flag.matches(‘1.1’) returns True flag.matches(‘0.9’) returns False flag = VersionFlag(‘foo’) flag.add_definition(‘foo>=1.0’) flag.add_definition(‘foo<0.5’) flag.matches(‘0.4’) returns True flag.matches(‘1.0’) returns True flag.matches(‘0.6’) returns False
mozpack.chrome.manifest module¶
- class mozpack.chrome.manifest.Manifest(base, relpath, *flags)¶
Bases:
mozpack.chrome.manifest.ManifestEntryWithRelPath
- Class for ‘manifest’ entries.
manifest some/path/to/another.manifest
- type = 'manifest'¶
- class mozpack.chrome.manifest.ManifestBinaryComponent(base, relpath, *flags)¶
Bases:
mozpack.chrome.manifest.ManifestEntryWithRelPath
- Class for ‘binary-component’ entries.
binary-component some/path/to/a/component.dll
- type = 'binary-component'¶
- class mozpack.chrome.manifest.ManifestCategory(base, category, name, value, *flags)¶
Bases:
mozpack.chrome.manifest.ManifestEntry
- Class for ‘category’ entries.
category command-line-handler m-browser @mozilla.org/browser/clh;
- type = 'category'¶
- class mozpack.chrome.manifest.ManifestChrome(base, name, relpath, *flags)¶
Bases:
mozpack.chrome.manifest.ManifestEntryWithRelPath
Abstract class for chrome entries.
- property location¶
- class mozpack.chrome.manifest.ManifestComponent(base, cid, file, *flags)¶
Bases:
mozpack.chrome.manifest.ManifestEntryWithRelPath
- Class for ‘component’ entries.
component {b2bba4df-057d-41ea-b6b1-94a10a8ede68} foo.js
- type = 'component'¶
- class mozpack.chrome.manifest.ManifestContent(base, name, relpath, *flags)¶
Bases:
mozpack.chrome.manifest.ManifestChrome
- Class for ‘content’ entries.
content global content/global/
- allowed_flags = ['application', 'platformversion', 'os', 'osversion', 'abi', 'xpcnativewrappers', 'tablet', 'process', 'contentaccessible', 'backgroundtask', 'contentaccessible', 'platform']¶
- type = 'content'¶
- class mozpack.chrome.manifest.ManifestContract(base, contractID, cid, *flags)¶
Bases:
mozpack.chrome.manifest.ManifestEntry
- Class for ‘contract’ entries.
contract @mozilla.org/foo;1 {b2bba4df-057d-41ea-b6b1-94a10a8ede68}
- type = 'contract'¶
- class mozpack.chrome.manifest.ManifestEntry(base, *flags)¶
Bases:
object
Base class for all manifest entry types. Subclasses may define the following class or member variables:
localized: indicates whether the manifest entry is used for localized data.
type: the manifest entry type (e.g. ‘content’ in ‘content global content/global/’)
allowed_flags: a set of flags allowed to be defined for the given manifest entry type.
A manifest entry is attached to a base path, defining where the manifest entry is bound to, and that is used to find relative paths defined in entries.
- allowed_flags = ['application', 'platformversion', 'os', 'osversion', 'abi', 'xpcnativewrappers', 'tablet', 'process', 'contentaccessible', 'backgroundtask']¶
- localized = False¶
- move(base)¶
Return a new manifest entry with a different base path.
- rebase(base)¶
Return a new manifest entry with all relative paths defined in the entry relative to a new base directory. The base class doesn’t define relative paths, so it is equivalent to move().
- serialize(*args)¶
Serialize the manifest entry.
- type = None¶
- class mozpack.chrome.manifest.ManifestEntryWithRelPath(base, relpath, *flags)¶
Bases:
mozpack.chrome.manifest.ManifestEntry
Abstract manifest entry type with a relative path definition.
- property path¶
- rebase(base)¶
Return a new manifest entry with all relative paths defined in the entry relative to a new base directory.
- class mozpack.chrome.manifest.ManifestInterfaces(base, relpath, *flags)¶
Bases:
mozpack.chrome.manifest.ManifestEntryWithRelPath
- Class for ‘interfaces’ entries.
interfaces foo.xpt
- type = 'interfaces'¶
- class mozpack.chrome.manifest.ManifestLocale(base, name, id, relpath, *flags)¶
Bases:
mozpack.chrome.manifest.ManifestMultiContent
- Class for ‘locale’ entries.
locale global en-US content/en-US/ locale global fr content/fr/
- localized = True¶
- type = 'locale'¶
- class mozpack.chrome.manifest.ManifestMultiContent(base, name, id, relpath, *flags)¶
Bases:
mozpack.chrome.manifest.ManifestChrome
Abstract class for chrome entries with multiple definitions. Used for locale and skin entries.
- type = None¶
- class mozpack.chrome.manifest.ManifestOverlay(base, overloaded, overload, *flags)¶
Bases:
mozpack.chrome.manifest.ManifestOverload
- Class for ‘overlay’ entries.
overlay chrome://global/content/viewSource.xul chrome://browser/content/viewSourceOverlay.xul
- type = 'overlay'¶
- class mozpack.chrome.manifest.ManifestOverload(base, overloaded, overload, *flags)¶
Bases:
mozpack.chrome.manifest.ManifestEntry
Abstract class for chrome entries defining some kind of overloading. Used for overlay, override or style entries.
- type = None¶
- class mozpack.chrome.manifest.ManifestOverride(base, overloaded, overload, *flags)¶
Bases:
mozpack.chrome.manifest.ManifestOverload
- Class for ‘override’ entries.
override chrome://global/locale/netError.dtd chrome://browser/locale/netError.dtd
- type = 'override'¶
- class mozpack.chrome.manifest.ManifestResource(base, name, target, *flags)¶
Bases:
mozpack.chrome.manifest.ManifestEntry
- Class for ‘resource’ entries.
resource gre-resources toolkit/res/ resource services-sync resource://gre/modules/services-sync/
The target may be a relative path or a resource or chrome url.
- rebase(base)¶
Return a new manifest entry with all relative paths defined in the entry relative to a new base directory. The base class doesn’t define relative paths, so it is equivalent to move().
- type = 'resource'¶
- class mozpack.chrome.manifest.ManifestSkin(base, name, id, relpath, *flags)¶
Bases:
mozpack.chrome.manifest.ManifestMultiContent
- Class for ‘skin’ entries.
skin global classic/1.0 content/skin/classic/
- type = 'skin'¶
- class mozpack.chrome.manifest.ManifestStyle(base, overloaded, overload, *flags)¶
Bases:
mozpack.chrome.manifest.ManifestOverload
- Class for ‘style’ entries.
style chrome://global/content/viewSource.xul chrome://browser/skin/
- type = 'style'¶
- mozpack.chrome.manifest.is_manifest(path)¶
Return whether the given path is that of a manifest file.
- mozpack.chrome.manifest.parse_manifest(root, path, fileobj=None)¶
Parse a manifest file.
- mozpack.chrome.manifest.parse_manifest_line(base, line)¶
Parse a line from a manifest file with the given base directory and return the corresponding ManifestEntry instance.