pyuseocl.utils.zip

Classes

ZipArtefact(zipFileId[, targetDirectory, ...]) Extraction of a zip, either local or remote.

ZipArtefact

class pyuseocl.utils.zip.ZipArtefact(zipFileId, targetDirectory=None, filter=None, ignoreMacOsDirectory=True)[source]

Extraction of a zip, either local or remote. The _compute methods can be overriden if needed to change the behavior of this class.

Extract a file structure from a zip, either local or remote zip. :param zipFileId: A URL to a zip file (in this case it will be downloaded) or a path to a local zip file. :type zipFileId: str :param targetDirectory: The directory where to extract the zip file.

If none a directory will be created in a temporary place.
Parameters:filter (any) – This value is interpreted by the _doFilter method. This method can be overridden and this parameter is interpreted accordingly. In the default implementation the filter is a list of extensions with (e.g. ”.java”). Only files with these extensions will be extracted. If None, is given all files will be extracted.
zipFileId = None

URL or filename of the zip file

targetDirectory = None

Directory where to extract the zip. This will be in a temporary place if no targetDirectory is given as a parameter.

filter = None

Filter interpreted by the function _

isZipRemote = None

Indicate if the original zip was remote or not

zipFile = None

Path to the local or downloaded zipfile

directory = None

The directory where the zip is extracted. Same value as targetDirectory unless this parameter is not defined. In this case this will be a directory in a temporary place.

free(targetDirectoryToBeRemoved=None)[source]

Try to Free temporary resources if any. If a targetDirectory is specified as a parameter, check if this was the same directory given when the ZipTestSuite was created and if this is so, remove this whole directory. If a file or directory cannot be removed just add a warning in the log. This may be because another process is using the file.