From fe5a48ac96bb3adadeba1a27d1736d276ef8c20c Mon Sep 17 00:00:00 2001 From: stevenknight Date: Tue, 23 Sep 2008 05:41:05 +0000 Subject: [PATCH] 1.5 compatibility: string methods in Tool/msvs.py. git-svn-id: http://scons.tigris.org/svn/scons/trunk@3461 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/engine/SCons/Tool/msvs.py | 53 ++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/src/engine/SCons/Tool/msvs.py b/src/engine/SCons/Tool/msvs.py index e9d73dab..33efad95 100644 --- a/src/engine/SCons/Tool/msvs.py +++ b/src/engine/SCons/Tool/msvs.py @@ -79,7 +79,9 @@ def _generateGUID(slnfile, name): based on the MD5 signatures of the sln filename plus the name of the project. It basically just needs to be unique, and not change with each invocation.""" - solution = _hexdigest(md5.new(str(slnfile)+str(name)).digest()).upper() + # TODO(1.5) + #solution = _hexdigest(md5.new(str(slnfile)+str(name)).digest()).upper() + solution = string.upper(_hexdigest(md5.new(str(slnfile)+str(name)).digest())) # convert most of the signature to GUID form (discard the rest) solution = "{" + solution[:8] + "-" + solution[8:12] + "-" + solution[12:16] + "-" + solution[16:20] + "-" + solution[20:32] + "}" return solution @@ -295,7 +297,9 @@ class _DSPGenerator: self.sources[t[0]].append(self.env[t[1]]) for n in sourcenames: - self.sources[n].sort(lambda a, b: cmp(a.lower(), b.lower())) + # TODO(1.5): + #self.sources[n].sort(lambda a, b: cmp(a.lower(), b.lower())) + self.sources[n].sort(lambda a, b: cmp(string.lower(a), string.lower(b))) def AddConfig(self, variant, buildtarget, outdir, runfile, cmdargs, dspfile=dspfile): config = Config() @@ -394,7 +398,9 @@ class _GenerateV6DSP(_DSPGenerator): for base in ("BASE ",""): self.file.write('# PROP %sUse_MFC 0\n' '# PROP %sUse_Debug_Libraries ' % (base, base)) - if kind.lower().find('debug') < 0: + # TODO(1.5): + #if kind.lower().find('debug') < 0: + if string.find(string.lower(kind), 'debug') < 0: self.file.write('0\n') else: self.file.write('1\n') @@ -445,13 +451,17 @@ class _GenerateV6DSP(_DSPGenerator): 'Other Files': ''} cats = categories.keys() - cats.sort(lambda a, b: cmp(a.lower(), b.lower())) + # TODO(1.5): + #cats.sort(lambda a, b: cmp(a.lower(), b.lower())) + cats.sort(lambda a, b: cmp(string.lower(a), string.lower(b))) for kind in cats: if not self.sources[kind]: continue # skip empty groups self.file.write('# Begin Group "' + kind + '"\n\n') - typelist = categories[kind].replace('|',';') + # TODO(1.5) + #typelist = categories[kind].replace('|', ';') + typelist = string.replace(categories[kind], '|', ';') self.file.write('# PROP Default_Filter "' + typelist + '"\n') for file in self.sources[kind]: @@ -474,7 +484,9 @@ class _GenerateV6DSP(_DSPGenerator): line = dspfile.readline() while line: - if line.find("# End Project") > -1: + # TODO(1.5): + #if line.find("# End Project") > -1: + if string.find(line, "# End Project") > -1: break line = dspfile.readline() @@ -692,7 +704,9 @@ class _GenerateV7DSP(_DSPGenerator): def printSources(self, hierarchy, commonprefix): sorteditems = hierarchy.items() - sorteditems.sort(lambda a, b: cmp(a[0].lower(), b[0].lower())) + # TODO(1.5): + #sorteditems.sort(lambda a, b: cmp(a[0].lower(), b[0].lower())) + sorteditems.sort(lambda a, b: cmp(string.lower(a[0]), string.lower(b[0]))) # First folders, then files for key, value in sorteditems: @@ -723,7 +737,9 @@ class _GenerateV7DSP(_DSPGenerator): self.file.write('\t\n') cats = categories.keys() - cats.sort(lambda a, b: cmp(a.lower(), b.lower())) + # TODO(1.5) + #cats.sort(lambda a, b: cmp(a.lower(), b.lower())) + cats.sort(lambda a, b: cmp(string.lower(a), string.lower(b))) cats = filter(lambda k, s=self: s.sources[k], cats) for kind in cats: if len(cats) > 1: @@ -772,7 +788,9 @@ class _GenerateV7DSP(_DSPGenerator): line = dspfile.readline() while line: - if line.find('