SConscript (4123:9c80390ea1bb) SConscript (4202:f7a05daec670)
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

--- 15 unchanged lines hidden (view full) ---

24# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28#
29# Authors: Steve Reinhardt
30# Nathan Binkert
31
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

--- 15 unchanged lines hidden (view full) ---

24# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28#
29# Authors: Steve Reinhardt
30# Nathan Binkert
31
32import os, os.path, re, sys
33from zipfile import PyZipFile
32import os
33import zipfile
34
35# handy function for path joins
36def join(*args):
37 return os.path.normpath(os.path.join(*args))
38
34
35# handy function for path joins
36def join(*args):
37 return os.path.normpath(os.path.join(*args))
38
39Import('env')
39Import('*')
40
41# This SConscript is in charge of collecting .py files and generating
42# a zip archive that is appended to the m5 binary.
43
44# List of files & directories to include in the zip file. To include
45# a package, list only the root directory of the package, not any
46# internal .py files (else they will get the path stripped off when
47# they are imported into the zip file).

--- 53 unchanged lines hidden (view full) ---

101
102swig_modules = []
103def swig_it(module):
104 env.Command(['swig/%s_wrap.cc' % module, 'm5/internal/%s.py' % module],
105 'swig/%s.i' % module,
106 '$SWIG $SWIGFLAGS -outdir ${TARGETS[1].dir} '
107 '-o ${TARGETS[0]} $SOURCES')
108 swig_modules.append(module)
40
41# This SConscript is in charge of collecting .py files and generating
42# a zip archive that is appended to the m5 binary.
43
44# List of files & directories to include in the zip file. To include
45# a package, list only the root directory of the package, not any
46# internal .py files (else they will get the path stripped off when
47# they are imported into the zip file).

--- 53 unchanged lines hidden (view full) ---

101
102swig_modules = []
103def swig_it(module):
104 env.Command(['swig/%s_wrap.cc' % module, 'm5/internal/%s.py' % module],
105 'swig/%s.i' % module,
106 '$SWIG $SWIGFLAGS -outdir ${TARGETS[1].dir} '
107 '-o ${TARGETS[0]} $SOURCES')
108 swig_modules.append(module)
109 Source('swig/%s_wrap.cc' % module)
109
110
111Source('swig/init.cc')
112Source('swig/pyevent.cc')
113Source('swig/pyobject.cc')
114
110swig_it('core')
111swig_it('debug')
112swig_it('event')
113swig_it('random')
114swig_it('sim_object')
115swig_it('stats')
116swig_it('trace')
117

--- 21 unchanged lines hidden (view full) ---

139 f.close()
140
141swig_cc_files = [ 'swig/%s_wrap.cc' % m for m in swig_modules ]
142env.Command('swig/init.cc', swig_cc_files, MakeSwigInit)
143
144# Action function to build the zip archive. Uses the PyZipFile module
145# included in the standard Python library.
146def buildPyZip(target, source, env):
115swig_it('core')
116swig_it('debug')
117swig_it('event')
118swig_it('random')
119swig_it('sim_object')
120swig_it('stats')
121swig_it('trace')
122

--- 21 unchanged lines hidden (view full) ---

144 f.close()
145
146swig_cc_files = [ 'swig/%s_wrap.cc' % m for m in swig_modules ]
147env.Command('swig/init.cc', swig_cc_files, MakeSwigInit)
148
149# Action function to build the zip archive. Uses the PyZipFile module
150# included in the standard Python library.
151def buildPyZip(target, source, env):
147 pzf = PyZipFile(str(target[0]), 'w')
152 pzf = zipfile.PyZipFile(str(target[0]), 'w')
148 for s in source:
149 pzf.writepy(str(s))
150
151# Add the zip file target to the environment.
152env.Command('m5py.zip', pyzip_files, buildPyZip)
153env.Depends('m5py.zip', pyzip_dep_files)
153 for s in source:
154 pzf.writepy(str(s))
155
156# Add the zip file target to the environment.
157env.Command('m5py.zip', pyzip_files, buildPyZip)
158env.Depends('m5py.zip', pyzip_dep_files)