Trees | Indices | Help |
---|
|
1 #============================================================================ 2 #Name : tools.py 3 #Part of : Helium 4 5 #Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 6 #All rights reserved. 7 #This component and the accompanying materials are made available 8 #under the terms of the License "Eclipse Public License v1.0" 9 #which accompanies this distribution, and is available 10 #at the URL "http://www.eclipse.org/legal/epl-v10.html". 11 # 12 #Initial Contributors: 13 #Nokia Corporation - initial contribution. 14 # 15 #Contributors: 16 # 17 #Description: 18 #=============================================================================== 19 20 """ Archiving operations. """ 21 import os 22 import logging 23 import buildtools 24 import codecs 25 26 _logger = logging.getLogger('archive') 27 #_logger.addHandler(logging.FileHandler('archive.log')) 28 #logging.basicConfig(level=logging.DEBUG) 29 logging.basicConfig() 3032 """ Tool abstract class. """43 4434 """ This method should return the extension of the generated file. """ 35 raise NotImplementedError()3646 """ Creates task definitions for executing 7zip archive operations.""" 47 50 5466 6756 """ Returns a list of one command that will use 7za to archive the content.""" 57 cmd = buildtools.Command('7za', path) 58 cmd.addArg('a') 59 cmd.addArg('-tzip') 60 # Include all in the current directory by default, assuming that 61 # an include file or specific includes will be given 62 cmd.addArg(name + self.extension()) 63 for manifest in manifests: 64 cmd.addArg('@' + os.path.normpath(manifest)) 65 return [cmd]69 """ Creates task definitions for executing zip archive operations.""" 70 73 7789 9079 """ Returns a list of one command that will use zip to archive the content.""" 80 cmd = buildtools.Command('zip', path) 81 cmd.addArg('-R') 82 cmd.addArg(name + self.extension()) 83 # Include all in the current directory by default, assuming that 84 # an include file or specific includes will be given 85 cmd.addArg('.') 86 for manifest in manifests: 87 cmd.addArg('-i@' + os.path.normpath(manifest)) 88 return [cmd]92 """ Creates task definitions for executing zip archive operations.""" 95 99110 111101 """ Returns a list of one command that will use zip to archive the content.""" 102 cmds = [] 103 for manifest in manifests: 104 file_input = codecs.open(manifest, 'r', "utf-8" ) 105 for line in file_input.readlines(): 106 if line.strip() != "": 107 cmds.append(buildtools.Delete(filename=line.strip())) 108 file_input.close() 109 return cmds113 """ Return a tool using its id name. """ 114 constructor = TOOL_CONSTRUCTORS[name] 115 return constructor()116 117 118 TOOL_CONSTRUCTORS = {'zip': ZipArchiver, 119 '7za': SevenZipArchiver, 120 'remover': Remover} 121
Trees | Indices | Help |
---|
Generated by Epydoc 3.0beta1 on Wed Sep 09 13:44:21 2009 | http://epydoc.sourceforge.net |