Package obitools :: Module zipfile :: Class PyZipFile
[hide private]
[frames] | no frames]

Class PyZipFile

source code


Class to create ZIP archives with Python library files and packages.

Instance Methods [hide private]
 
writepy(self, pathname, basename='')
Add all files from "pathname" to the ZIP archive.
source code
 
_get_codename(self, pathname, basename)
Return (filename, archivename) for the path.
source code

Inherited from ZipFile: __del__, __init__, close, extract, extractall, getinfo, infolist, namelist, open, printdir, read, setpassword, testzip, write, writestr

Class Variables [hide private]

Inherited from ZipFile: fp

Method Details [hide private]

writepy(self, pathname, basename='')

source code 

Add all files from "pathname" to the ZIP archive.

If pathname is a package directory, search the directory and all package subdirectories recursively for all *.py and enter the modules into the archive. If pathname is a plain directory, listdir *.py and enter all modules. Else, pathname must be a Python *.py file and the module will be put into the archive. Added modules are always module.pyo or module.pyc. This method will compile the module.py into module.pyc if necessary.

_get_codename(self, pathname, basename)

source code 

Return (filename, archivename) for the path.

Given a module name path, return the correct file path and archive name, compiling if necessary. For example, given /python/lib/string, return (/python/lib/string.pyc, string).