SConscript (4078:3f73f808bbd4) | SConscript (4086:80530ac5adef) |
---|---|
1# -*- mode:python -*- 2 3# Copyright (c) 2004-2005 The Regents of The University of Michigan 4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions are 8# met: redistributions of source code must retain the above copyright --- 85 unchanged lines hidden (view full) --- 94 95# Now specify the packages & files for the zip archive. 96addPkg('m5') 97pyzip_files.append('m5/defines.py') 98pyzip_files.append('m5/info.py') 99pyzip_files.append(join(env['ROOT'], 'util/pbs/jobfile.py')) 100pyzip_files.append(join(env['ROOT'], 'src/base/traceflags.py')) 101 | 1# -*- mode:python -*- 2 3# Copyright (c) 2004-2005 The Regents of The University of Michigan 4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions are 8# met: redistributions of source code must retain the above copyright --- 85 unchanged lines hidden (view full) --- 94 95# Now specify the packages & files for the zip archive. 96addPkg('m5') 97pyzip_files.append('m5/defines.py') 98pyzip_files.append('m5/info.py') 99pyzip_files.append(join(env['ROOT'], 'util/pbs/jobfile.py')) 100pyzip_files.append(join(env['ROOT'], 'src/base/traceflags.py')) 101 |
102def swig_it(basename): 103 env.Command(['swig/%s_wrap.cc' % basename, 'm5/internal/%s.py' % basename], 104 'swig/%s.i' % basename, | 102swig_modules = [] 103def swig_it(module): 104 env.Command(['swig/%s_wrap.cc' % module, 'm5/internal/%s.py' % module], 105 'swig/%s.i' % module, |
105 '$SWIG $SWIGFLAGS -outdir ${TARGETS[1].dir} ' 106 '-o ${TARGETS[0]} $SOURCES') | 106 '$SWIG $SWIGFLAGS -outdir ${TARGETS[1].dir} ' 107 '-o ${TARGETS[0]} $SOURCES') |
107 pyzip_dep_files.append('m5/internal/%s.py' % basename) | 108 swig_modules.append(module) |
108 109swig_it('main') 110swig_it('debug') 111swig_it('event') 112swig_it('random') 113swig_it('stats') 114swig_it('trace') 115 | 109 110swig_it('main') 111swig_it('debug') 112swig_it('event') 113swig_it('random') 114swig_it('stats') 115swig_it('trace') 116 |
117# Automatically generate m5/internals/__init__.py 118def MakeInternalsInit(target, source, env): 119 f = file(str(target[0]), 'w') 120 for m in swig_modules: 121 print >>f, 'import %s' % m 122 f.close() 123 124swig_py_files = [ 'm5/internal/%s.py' % m for m in swig_modules ] 125env.Command('m5/internal/__init__.py', swig_py_files, MakeInternalsInit) 126pyzip_dep_files.append('m5/internal/__init__.py') 127 128def MakeSwigInit(target, source, env): 129 f = file(str(target[0]), 'w') 130 print >>f, 'extern "C" {' 131 for m in swig_modules: 132 print >>f, ' void init_%s();' % m 133 print >>f, '}' 134 print >>f, 'void init_swig() {' 135 for m in swig_modules: 136 print >>f, ' init_%s();' % m 137 print >>f, '}' 138 f.close() 139 140swig_cc_files = [ 'swig/%s_wrap.cc' % m for m in swig_modules ] 141env.Command('swig/init.cc', swig_cc_files, MakeSwigInit) 142 |
|
116# Action function to build the zip archive. Uses the PyZipFile module 117# included in the standard Python library. 118def buildPyZip(target, source, env): 119 pzf = PyZipFile(str(target[0]), 'w') 120 for s in source: 121 pzf.writepy(str(s)) 122 123# Add the zip file target to the environment. 124env.Command('m5py.zip', pyzip_files, buildPyZip) 125env.Depends('m5py.zip', pyzip_dep_files) | 143# Action function to build the zip archive. Uses the PyZipFile module 144# included in the standard Python library. 145def buildPyZip(target, source, env): 146 pzf = PyZipFile(str(target[0]), 'w') 147 for s in source: 148 pzf.writepy(str(s)) 149 150# Add the zip file target to the environment. 151env.Command('m5py.zip', pyzip_files, buildPyZip) 152env.Depends('m5py.zip', pyzip_dep_files) |