From 340d57481935334465037d97c0db1555b70c0eb1 Mon Sep 17 00:00:00 2001 From: Luca Falavigna Date: Tue, 15 Jun 2010 09:21:32 +0000 Subject: Imported Upstream version 2.0.0 --- engine/SCons/Tool/packaging/msi.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'engine/SCons/Tool/packaging/msi.py') diff --git a/engine/SCons/Tool/packaging/msi.py b/engine/SCons/Tool/packaging/msi.py index cea3483..76dca18 100644 --- a/engine/SCons/Tool/packaging/msi.py +++ b/engine/SCons/Tool/packaging/msi.py @@ -24,9 +24,8 @@ The msi packager. # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -__revision__ = "src/engine/SCons/Tool/packaging/msi.py 4720 2010/03/24 03:14:11 jars" +__revision__ = "src/engine/SCons/Tool/packaging/msi.py 5023 2010/06/14 22:05:46 scons" import os import SCons @@ -65,14 +64,14 @@ def convert_to_id(s, id_set): charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYabcdefghijklmnopqrstuvwxyz0123456789_.' if s[0] in '0123456789.': s += '_'+s - id = filter( lambda c : c in charset, s ) + id = [c for c in s if c in charset] # did we already generate an id for this file? try: return id_set[id][s] except KeyError: # no we did not so initialize with the id - if not id_set.has_key(id): id_set[id] = { s : id } + if id not in id_set: id_set[id] = { s : id } # there is a collision, generate an id which is unique by appending # the collision number else: id_set[id][s] = id + str(len(id_set[id])) @@ -109,7 +108,7 @@ def gen_dos_short_file_name(file, filename_set): # strip forbidden characters. forbidden = '."/[]:;=, ' - fname = filter( lambda c : c not in forbidden, fname ) + fname = [c for c in fname if c not in forbidden] # check if we already generated a filename with the same number: # thisis1.txt, thisis2.txt etc. @@ -137,7 +136,7 @@ def create_feature_dict(files): feature = [ feature ] for f in feature: - if not dict.has_key( f ): + if f not in dict: dict[ f ] = [ file ] else: dict[ f ].append( file ) @@ -214,7 +213,7 @@ def build_wxsfile(target, source, env): file.write( doc.toprettyxml() ) # call a user specified function - if env.has_key('CHANGE_SPECFILE'): + if 'CHANGE_SPECFILE' in env: env['CHANGE_SPECFILE'](target, source) except KeyError, e: @@ -296,9 +295,11 @@ def build_wxsfile_file_section(root, files, NAME, VERSION, VENDOR, filename_set, upper_dir = '' # walk down the xml tree finding parts of the directory - dir_parts = filter( lambda d: d != '', dir_parts ) + dir_parts = [d for d in dir_parts if d != ''] for d in dir_parts[:]: - already_created = filter( lambda c: c.nodeName == 'Directory' and c.attributes['LongName'].value == escape(d), Directory.childNodes ) + already_created = [c for c in Directory.childNodes + if c.nodeName == 'Directory' + and c.attributes['LongName'].value == escape(d)] if already_created != []: Directory = already_created[0] @@ -464,7 +465,7 @@ def build_wxsfile_header_section(root, spec): Product.childNodes.append( Package ) # set "mandatory" default values - if not spec.has_key('X_MSI_LANGUAGE'): + if 'X_MSI_LANGUAGE' not in spec: spec['X_MSI_LANGUAGE'] = '1033' # select english # mandatory sections, will throw a KeyError if the tag is not available @@ -475,10 +476,10 @@ def build_wxsfile_header_section(root, spec): Package.attributes['Description'] = escape( spec['SUMMARY'] ) # now the optional tags, for which we avoid the KeyErrror exception - if spec.has_key( 'DESCRIPTION' ): + if 'DESCRIPTION' in spec: Package.attributes['Comments'] = escape( spec['DESCRIPTION'] ) - if spec.has_key( 'X_MSI_UPGRADE_CODE' ): + if 'X_MSI_UPGRADE_CODE' in spec: Package.attributes['X_MSI_UPGRADE_CODE'] = escape( spec['X_MSI_UPGRADE_CODE'] ) # We hardcode the media tag as our current model cannot handle it. @@ -511,7 +512,7 @@ def package(env, target, source, PACKAGEROOT, NAME, VERSION, # put the arguments into the env and call the specfile builder. env['msi_spec'] = kw - specfile = apply( wxs_builder, [env, target, source], kw ) + specfile = wxs_builder(* [env, target, source], **kw) # now call the WiX Tool with the built specfile added as a source. msifile = env.WiX(target, specfile) -- cgit v1.2.3