Package translate :: Package storage :: Module xpi :: Class XpiFile

[hide private]
[frames] | no frames]

# Class XpiFile

source code

           zipfile.ZipFile --+
                             |
                    object --+
                             |
    misc.zipfileext.ZipFileExt --+
                                 |
                        object --+
                                 |
                    ZipFileCatcher --+
                                     |
                                    XpiFile

Instance Methods | [hide private]

__init__(self, *args, **kwargs) sets up the xpi file | source code

iterjars(self) iterate through the jar files in the xpi as ZipFile objects | source code

islocfile(self, filename) returns whether the given file is needed for localization (basically .dtd and .properties) | source code

findlangreg(self) finds the common prefix of all the files stored in the jar files | source code

setlangreg(self, locale, region) set the locale and region of this xpi | source code

findjarprefixes(self) checks the uniqueness of the jar files contents | source code

ziptoospath(self, zippath) converts a zipfile filepath to an os-style filepath | source code

ostozippath(self, ospath) converts an os-style filepath to a zipfile filepath | source code

mapfilename(self, filename) uses a map to simplify the directory structure | source code

mapxpifilename(self, filename) uses a map to rename files that occur straight in the xpi | source code

reversemapfile(self, filename) unmaps the filename... | source code

reversemapxpifilename(self, filename) uses a map to rename files that occur straight in the xpi | source code

jartoospath(self, jarfilename, filename) converts a filename from within a jarfile to an os-style filepath | source code

ostojarpath(self, ospath) converts an extracted os-style filepath to a jarfilename and filename | source code

jarfileexists(self, jarfilename, filename) checks whether the given file exists inside the xpi | source code

ospathexists(self, ospath) checks whether the given file exists inside the xpi | source code

openinputstream(self, jarfilename, filename) opens a file (possibly inside a jarfile as a StringIO | source code

openoutputstream(self, jarfilename, filename) opens a file for writing (possibly inside a jarfile as a StringIO | source code

close(self) Close the file, and for mode "w" and "a" write the ending records. | source code

testzip(self) test the xpi zipfile and all enclosed jar files... | source code

restructurejar(self, origjarfilename, newjarfilename, otherxpi, newlang, newregion) Create a new .jar file with the same contents as the given name, but rename directories, write to outputstream | source code

clone(self, newfilename, newmode=None, newlang=None, newregion=None) Create a new .xpi file with the same contents as this one... | source code

iterextractnames(self, includenonjars=False, includedirs=False) iterates through all the localization files with the common prefix stripped and a jarfile name added if neccessary | source code

__iter__(self) iterates through all the files. | source code

__contains__(self, fullpath) returns whether the given pathname exists in the archive | source code

openinputfile(self, fullpath) opens an input file given the full pathname | source code

openoutputfile(self, fullpath) opens an output file given the full pathname | source code

Inherited from `ZipFileCatcher`: `addcatcher`, `overwritestr`

Inherited from `misc.zipfileext.ZipFileExt`: `delete`, `writeendrec`

Inherited from `zipfile.ZipFile`: `__del__`, `getinfo`, `infolist`, `namelist`, `printdir`, `read`, `write`, `writestr`

Inherited from `zipfile.ZipFile` (private): `_GetContents`, `_RealGetContents`, `_writecheck`

Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__str__`

Class Variables | [hide private]

Inherited from `zipfile.ZipFile`: `fp`

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, *args, **kwargs)
(Constructor)

source code

sets up the xpi file

Overrides: object.__init__

### close(self)

source code

Close the file, and for mode "w" and "a" write the ending records.

Overrides: zipfile.ZipFile.close

### testzip(self)

source code

test the xpi zipfile and all enclosed jar files...

Overrides: zipfile.ZipFile.testzip

### __iter__(self)

source code

iterates through all the files. this is the method use by the converters