__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import SCons.compat
+
import base64
-import cPickle
import hashlib
import ntpath
import os
+# compat layer imports "cPickle" for us if it's available.
+import pickle
import re
import sys
self.dspabs = get_abspath()
if 'variant' not in env:
- raise SCons.Errors.InternalError, \
- "You must specify a 'variant' argument (i.e. 'Debug' or " +\
- "'Release') to create an MSVSProject."
+ raise SCons.Errors.InternalError("You must specify a 'variant' argument (i.e. 'Debug' or " +\
+ "'Release') to create an MSVSProject.")
elif SCons.Util.is_String(env['variant']):
variants = [env['variant']]
elif SCons.Util.is_List(env['variant']):
buildtarget = [env['buildtarget']]
elif SCons.Util.is_List(env['buildtarget']):
if len(env['buildtarget']) != len(variants):
- raise SCons.Errors.InternalError, \
- "Sizes of 'buildtarget' and 'variant' lists must be the same."
+ raise SCons.Errors.InternalError("Sizes of 'buildtarget' and 'variant' lists must be the same.")
buildtarget = []
for bt in env['buildtarget']:
if SCons.Util.is_String(bt):
outdir = [env['outdir']]
elif SCons.Util.is_List(env['outdir']):
if len(env['outdir']) != len(variants):
- raise SCons.Errors.InternalError, \
- "Sizes of 'outdir' and 'variant' lists must be the same."
+ raise SCons.Errors.InternalError("Sizes of 'outdir' and 'variant' lists must be the same.")
outdir = []
for s in env['outdir']:
if SCons.Util.is_String(s):
runfile = [env['runfile']]
elif SCons.Util.is_List(env['runfile']):
if len(env['runfile']) != len(variants):
- raise SCons.Errors.InternalError, \
- "Sizes of 'runfile' and 'variant' lists must be the same."
+ raise SCons.Errors.InternalError("Sizes of 'runfile' and 'variant' lists must be the same.")
runfile = []
for s in env['runfile']:
if SCons.Util.is_String(s):
if self.nokeep == 0:
# now we pickle some data and add it to the file -- MSDEV will ignore it.
- pdata = cPickle.dumps(self.configs,1)
+ pdata = pickle.dumps(self.configs,1)
pdata = base64.encodestring(pdata)
self.file.write(pdata + '\n')
- pdata = cPickle.dumps(self.sources,1)
+ pdata = pickle.dumps(self.sources,1)
pdata = base64.encodestring(pdata)
self.file.write(pdata + '\n')
# OK, we've found our little pickled cache of data.
try:
datas = base64.decodestring(datas)
- data = cPickle.loads(datas)
+ data = pickle.loads(datas)
except KeyboardInterrupt:
raise
except:
# it has a "# " in front of it, so we strip that.
try:
datas = base64.decodestring(datas)
- data = cPickle.loads(datas)
+ data = pickle.loads(datas)
except KeyboardInterrupt:
raise
except:
try:
self.file = open(self.dspabs,'w')
except IOError, detail:
- raise SCons.Errors.InternalError, 'Unable to open "' + self.dspabs + '" for writing:' + str(detail)
+ raise SCons.Errors.InternalError('Unable to open "' + self.dspabs + '" for writing:' + str(detail))
else:
self.PrintHeader()
self.PrintProject()
if self.nokeep == 0:
# now we pickle some data and add it to the file -- MSDEV will ignore it.
- pdata = cPickle.dumps(self.configs,1)
+ pdata = pickle.dumps(self.configs,1)
pdata = base64.encodestring(pdata)
self.file.write('<!-- SCons Data:\n' + pdata + '\n')
- pdata = cPickle.dumps(self.sources,1)
+ pdata = pickle.dumps(self.sources,1)
pdata = base64.encodestring(pdata)
self.file.write(pdata + '-->\n')
# OK, we've found our little pickled cache of data.
try:
datas = base64.decodestring(datas)
- data = cPickle.loads(datas)
+ data = pickle.loads(datas)
except KeyboardInterrupt:
raise
except:
# OK, we've found our little pickled cache of data.
try:
datas = base64.decodestring(datas)
- data = cPickle.loads(datas)
+ data = pickle.loads(datas)
except KeyboardInterrupt:
raise
except:
try:
self.file = open(self.dspabs,'w')
except IOError, detail:
- raise SCons.Errors.InternalError, 'Unable to open "' + self.dspabs + '" for writing:' + str(detail)
+ raise SCons.Errors.InternalError('Unable to open "' + self.dspabs + '" for writing:' + str(detail))
else:
self.PrintHeader()
self.PrintProject()
self.env = env
if 'projects' not in env:
- raise SCons.Errors.UserError, \
- "You must specify a 'projects' argument to create an MSVSSolution."
+ raise SCons.Errors.UserError("You must specify a 'projects' argument to create an MSVSSolution.")
projects = env['projects']
if not SCons.Util.is_List(projects):
- raise SCons.Errors.InternalError, \
- "The 'projects' argument must be a list of nodes."
+ raise SCons.Errors.InternalError("The 'projects' argument must be a list of nodes.")
projects = SCons.Util.flatten(projects)
if len(projects) < 1:
- raise SCons.Errors.UserError, \
- "You must specify at least one project to create an MSVSSolution."
+ raise SCons.Errors.UserError("You must specify at least one project to create an MSVSSolution.")
self.dspfiles = list(map(str, projects))
if 'name' in self.env:
print "Adding '" + self.name + ' - ' + config.variant + '|' + config.platform + "' to '" + str(dswfile) + "'"
if 'variant' not in env:
- raise SCons.Errors.InternalError, \
- "You must specify a 'variant' argument (i.e. 'Debug' or " +\
- "'Release') to create an MSVS Solution File."
+ raise SCons.Errors.InternalError("You must specify a 'variant' argument (i.e. 'Debug' or " +\
+ "'Release') to create an MSVS Solution File.")
elif SCons.Util.is_String(env['variant']):
AddConfig(self, env['variant'])
elif SCons.Util.is_List(env['variant']):
# OK, we've found our little pickled cache of data.
try:
datas = base64.decodestring(datas)
- data = cPickle.loads(datas)
+ data = pickle.loads(datas)
except KeyboardInterrupt:
raise
except:
'\tEndGlobalSection\n')
self.file.write('EndGlobal\n')
if self.nokeep == 0:
- pdata = cPickle.dumps(self.configs,1)
+ pdata = pickle.dumps(self.configs,1)
pdata = base64.encodestring(pdata)
self.file.write(pdata + '\n')
try:
self.file = open(self.dswfile,'w')
except IOError, detail:
- raise SCons.Errors.InternalError, 'Unable to open "' + self.dswfile + '" for writing:' + str(detail)
+ raise SCons.Errors.InternalError('Unable to open "' + self.dswfile + '" for writing:' + str(detail))
else:
self.PrintSolution()
self.file.close()
try:
self.file = open(self.dswfile,'w')
except IOError, detail:
- raise SCons.Errors.InternalError, 'Unable to open "' + self.dswfile + '" for writing:' + str(detail)
+ raise SCons.Errors.InternalError('Unable to open "' + self.dswfile + '" for writing:' + str(detail))
else:
self.PrintWorkspace()
self.file.close()
source = source + ' "%s"' % bt
else:
try: source = source + ' "%s"' % bt.get_abspath()
- except AttributeError: raise SCons.Errors.InternalError, \
- "buildtarget can be a string, a node, a list of strings or nodes, or None"
+ except AttributeError: raise SCons.Errors.InternalError("buildtarget can be a string, a node, a list of strings or nodes, or None")
else:
try: source = source + ' "%s"' % env['buildtarget'].get_abspath()
- except AttributeError: raise SCons.Errors.InternalError, \
- "buildtarget can be a string, a node, a list of strings or nodes, or None"
+ except AttributeError: raise SCons.Errors.InternalError("buildtarget can be a string, a node, a list of strings or nodes, or None")
if 'outdir' in env and env['outdir'] != None:
if SCons.Util.is_String(env['outdir']):
source = source + ' "%s"' % s
else:
try: source = source + ' "%s"' % s.get_abspath()
- except AttributeError: raise SCons.Errors.InternalError, \
- "outdir can be a string, a node, a list of strings or nodes, or None"
+ except AttributeError: raise SCons.Errors.InternalError("outdir can be a string, a node, a list of strings or nodes, or None")
else:
try: source = source + ' "%s"' % env['outdir'].get_abspath()
- except AttributeError: raise SCons.Errors.InternalError, \
- "outdir can be a string, a node, a list of strings or nodes, or None"
+ except AttributeError: raise SCons.Errors.InternalError("outdir can be a string, a node, a list of strings or nodes, or None")
if 'name' in env:
if SCons.Util.is_String(env['name']):
source = source + ' "%s"' % env['name']
else:
- raise SCons.Errors.InternalError, "name must be a string"
+ raise SCons.Errors.InternalError("name must be a string")
if 'variant' in env:
if SCons.Util.is_String(env['variant']):
if SCons.Util.is_String(variant):
source = source + ' "%s"' % variant
else:
- raise SCons.Errors.InternalError, "name must be a string or a list of strings"
+ raise SCons.Errors.InternalError("name must be a string or a list of strings")
else:
- raise SCons.Errors.InternalError, "variant must be a string or a list of strings"
+ raise SCons.Errors.InternalError("variant must be a string or a list of strings")
else:
- raise SCons.Errors.InternalError, "variant must be specified"
+ raise SCons.Errors.InternalError("variant must be specified")
for s in _DSPGenerator.srcargs:
if s in env:
if SCons.Util.is_String(t):
source = source + ' "%s"' % t
else:
- raise SCons.Errors.InternalError, s + " must be a string or a list of strings"
+ raise SCons.Errors.InternalError(s + " must be a string or a list of strings")
else:
- raise SCons.Errors.InternalError, s + " must be a string or a list of strings"
+ raise SCons.Errors.InternalError(s + " must be a string or a list of strings")
source = source + ' "%s"' % str(target[0])
source = [SCons.Node.Python.Value(source)]
if SCons.Util.is_String(env['name']):
source = source + ' "%s"' % env['name']
else:
- raise SCons.Errors.InternalError, "name must be a string"
+ raise SCons.Errors.InternalError("name must be a string")
if 'variant' in env:
if SCons.Util.is_String(env['variant']):
if SCons.Util.is_String(variant):
source = source + ' "%s"' % variant
else:
- raise SCons.Errors.InternalError, "name must be a string or a list of strings"
+ raise SCons.Errors.InternalError("name must be a string or a list of strings")
else:
- raise SCons.Errors.InternalError, "variant must be a string or a list of strings"
+ raise SCons.Errors.InternalError("variant must be a string or a list of strings")
else:
- raise SCons.Errors.InternalError, "variant must be specified"
+ raise SCons.Errors.InternalError("variant must be specified")
if 'slnguid' in env:
if SCons.Util.is_String(env['slnguid']):
source = source + ' "%s"' % env['slnguid']
else:
- raise SCons.Errors.InternalError, "slnguid must be a string"
+ raise SCons.Errors.InternalError("slnguid must be a string")
if 'projects' in env:
if SCons.Util.is_String(env['projects']):