2 import sys, os, string, time, commands, re, pickle, StringIO, popen2, commands, pdb, zipfile, tempfile
10 stderr = StringIO.StringIO()
11 stdout = StringIO.StringIO()
14 if ( len( command_string ) ):
18 retval = self.env[
'PSPAWN']( sh, escape, cmd, args, env, stdout, stderr )
22 print 'OSError ignored on command: %s' % command_string
25 if ( retval != 0
or not self.
silent ):
26 sys.stdout.write( stdout.getvalue() )
27 sys.stderr.write( stderr.getvalue() )
34 ret = commands.getstatusoutput( cmd )
35 if ( len( ret[ 1 ] ) ):
36 sys.stdout.write( ret[ 1 ] )
37 sys.stdout.write(
'\n' )
39 raise 'command failed'
44 ret = commands.getstatusoutput( cmd )
45 sys.stdout.write( ret[ 1 ] )
50 for ( key, val )
in d.items():
51 cmd +=
'--define=%s="%s" ' % ( key, val )
52 cmd +=
'%s > %s' % ( file, file_out )
56 f = open(
'framework/Licensee.h' )
61 p = re.compile(
'^#define ASYNC_PROTOCOL_MAJOR\t*(.*)' )
64 major = p.match( i ).group(1)
67 f = open(
'framework/async/AsyncNetwork.h' )
72 p = re.compile(
'^const int ASYNC_PROTOCOL_MINOR\t*= (.*);' )
75 minor = p.match( i ).group(1)
78 return '%s.%s' % ( major, minor )
81 f = open(
'framework/Licensee.h' )
86 p = re.compile(
'^#define.*ENGINE_VERSION\t*"DOOM (.*)"' )
89 version = p.match( i ).group(1)
95 f = open(
'framework/BuildVersion.h' )
96 l = f.readlines()[ 4 ]
98 pat = re.compile(
'.* = (.*);\n' )
99 return pat.split( l )[ 1 ]
103 if (
not os.path.isfile(file.abspath)):
104 print(
'ERROR: CheckLDD: target %s not found\n' % target[0])
106 ( status, output ) = commands.getstatusoutput(
'ldd -r %s' % file )
108 print 'ERROR: ldd command returned with exit code %d' % ldd_ret
109 os.system(
'rm %s' % target[ 0 ] )
111 lines = string.split( output,
'\n' )
115 regex = re.compile(
'undefined symbol: (.*)\t\\((.*)\\)')
116 if ( regex.match(i_line) ):
117 symbol = regex.sub(
'\\1', i_line)
119 env[
'ALLOWED_SYMBOLS'].index(symbol)
124 print "ERROR: undefined symbols"
125 os.system(
'rm %s' % target[0])
129 ret = env.SharedLibrary( target, source )
130 env.AddPostAction( ret, checkLDD )
134 print 'Not Implemented'
143 temp_dir = tempfile.mkdtemp( prefix =
'gamepak' )
144 self.
SimpleCommand(
'cp %s %s' % ( source[0].abspath, os.path.join( temp_dir,
'gamex86.so' ) ) )
145 self.
SimpleCommand(
'strip %s' % os.path.join( temp_dir,
'gamex86.so' ) )
146 self.
SimpleCommand(
'echo 2 > %s' % ( os.path.join( temp_dir,
'binary.conf' ) ) )
147 self.
SimpleCommand(
'cd %s ; zip %s gamex86.so binary.conf' % ( temp_dir, os.path.join( temp_dir, target[0].abspath ) ) )
158 env[
'SPAWN'] = buf.buffered_spawn
163 env.BuildGamePak = gamepaks.BuildGamePak
164 env.SharedLibrarySafe = SharedLibrarySafe
168 env.PreBuildSDK = sdk.PreBuildSDK
169 env.BuildSDK = sdk.BuildSDK
171 print 'SDK.py hookup failed'
172 env.PreBuildSDK = NotImplementedStub
173 env.BuildSDK = NotImplementedStub
177 env.BuildSetup = setup.BuildSetup
179 print 'Setup.py hookup failed'
180 env.BuildSetup = NotImplementedStub
183 s_list = string.split( s_string )
184 for i
in range( len( s_list ) ):
185 s_list[ i ] = s_prefix +
'/' + s_list[ i ]
def ExtractProtocolVersion