2008-09-24 17:39:15 +00:00
|
|
|
import os
|
|
|
|
|
2008-09-21 19:56:24 +00:00
|
|
|
# methods that should be added to env
|
|
|
|
def filterWarnings(self, flags):
|
2008-10-05 18:49:55 +00:00
|
|
|
return ' '.join(
|
|
|
|
flag
|
|
|
|
for flag in flags
|
|
|
|
if not flag.startswith('-W')
|
|
|
|
)
|
2008-09-24 17:39:15 +00:00
|
|
|
|
|
|
|
# taken from scons wiki
|
|
|
|
def CheckPKGConfig(context, version):
|
2008-10-05 18:49:55 +00:00
|
|
|
context.Message( 'Checking for pkg-config version > %s... ' % version)
|
|
|
|
ret = context.TryAction('pkg-config --atleast-pkgconfig-version=%s' % version)[0]
|
|
|
|
context.Result( ret )
|
|
|
|
return ret
|
|
|
|
|
2008-09-24 17:39:15 +00:00
|
|
|
def CheckPKG(context, name):
|
2008-10-05 18:49:55 +00:00
|
|
|
context.Message( 'Checking for %s... ' % name )
|
|
|
|
ret = context.TryAction('pkg-config --exists \'%s\'' % name)[0]
|
|
|
|
context.Result( ret )
|
|
|
|
return ret
|
2008-09-24 17:39:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
def CheckSDL(context, version):
|
2008-10-05 18:49:55 +00:00
|
|
|
context.Message( 'Checking for sdl lib version > %s... ' % version)
|
|
|
|
sdl_config = context.env.WhereIs('sdl-config')
|
|
|
|
if sdl_config == None:
|
|
|
|
ret = 0
|
|
|
|
else:
|
|
|
|
found_ver = os.popen('sdl-config --version').read().strip()
|
|
|
|
required = [int(n) for n in version.split(".")]
|
|
|
|
found = [int(n) for n in found_ver.split(".")]
|
|
|
|
ret = (found >= required)
|
|
|
|
|
2008-09-24 17:39:15 +00:00
|
|
|
context.Result( ret )
|
|
|
|
return ret
|
2008-10-05 18:49:55 +00:00
|
|
|
|
|
|
|
def GenerateRevFile(flavour, template, output):
|
|
|
|
|
|
|
|
try:
|
|
|
|
svnrev = os.popen('svnversion .').read().strip().split(':')[0]
|
|
|
|
except:
|
|
|
|
svnrev = ""
|
|
|
|
|
|
|
|
revstr = svnrev + "-" + flavour
|
|
|
|
tmpstr = open(template, "r").read().replace("$WCREV$",revstr)
|
|
|
|
|
|
|
|
outfile = open(output, 'w')
|
|
|
|
outfile.write(tmpstr +"\n")
|
|
|
|
outfile.close()
|
|
|
|
|
|
|
|
return
|