PackageFile.py revision 4fd606d1f5abe38e1f42c38de1d2e895166bd0f4
## @file
#
# PackageFile class represents the zip file of a distribution package.
#
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this
# distribution. The full text of the license may be found at
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
'''
PackageFile
'''
##
# Import Modules
#
import zipfile
import tempfile
import platform
class PackageFile:
Mode = "r"
try:
except BaseException, Xstr:
if BadFile != None:
def GetZipFile(self):
## Get file name
#
## Extract the file
#
# @param To: the destination file
#
## Extract the file
#
# @param File: the extracted file
# @param ToFile: the destination file
#
return ToFile
return ''
## Extract the file
#
# @param Which: the source path
# @param To: the destination path
#
try:
except BaseException, Xstr:
try:
return
except BaseException, Xstr:
try:
except BaseException, Xstr:
## Remove the file
#
# @param Files: the removed files
#
ExtraData="%s is not in %s!" % \
## Pack the files under Top directory, the directory shown in the zipFile start from BaseDir,
# BaseDir should be the parent directory of the Top directory, for example,
# Pack(Workspace\Dir1, Workspace) will pack files under Dir1, and the path in the zipfile will
# start from Workspace
#
# @param Top: the top directory
# @param BaseDir: the base directory
#
"%s is not a directory!" %Top)
FilesToPack = []
if 'CVS' in Dirs:
if '.svn' in Dirs:
continue
#
# skip '.dec', '.inf', '.dsc', '.fdf' files
#
continue
## Pack the file
#
# @param Files: the files to pack
#
## Pack the file
#
# @param File: the files to pack
# @param ArcName: the Arc Name
#
try:
#
# avoid packing same file multiple times
#
for ZipedFile in ZipedFilesNameList:
return
except BaseException, Xstr:
## Write data to the packed file
#
# @param Data: data to write
# @param ArcName: the Arc Name
#
try:
except BaseException, Xstr:
## Close file
#
#