SConstruct (4678:fd95d7ddd1ee) SConstruct (4742:0936d7c23999)
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

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

62# options as well.
63#
64###################################################
65
66import sys
67import os
68import subprocess
69
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

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

62# options as well.
63#
64###################################################
65
66import sys
67import os
68import subprocess
69
70from os.path import isdir, join as joinpath
70from os.path import join as joinpath
71
72# Check for recent-enough Python and SCons versions. If your system's
73# default installation of Python is not recent enough, you can use a
74# non-default installation of the Python interpreter by either (1)
75# rearranging your PATH so that scons finds the non-default 'python'
76# first or (2) explicitly invoking an alternative interpreter on the
77# scons script, e.g., "/usr/local/bin/python2.4 `which scons` [args]".
78EnsurePythonVersion(2,4)

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

92ROOT = Dir('.').abspath
93
94# Path to the M5 source tree.
95SRCDIR = joinpath(ROOT, 'src')
96
97# tell python where to find m5 python code
98sys.path.append(joinpath(ROOT, 'src/python'))
99
71
72# Check for recent-enough Python and SCons versions. If your system's
73# default installation of Python is not recent enough, you can use a
74# non-default installation of the Python interpreter by either (1)
75# rearranging your PATH so that scons finds the non-default 'python'
76# first or (2) explicitly invoking an alternative interpreter on the
77# scons script, e.g., "/usr/local/bin/python2.4 `which scons` [args]".
78EnsurePythonVersion(2,4)

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

92ROOT = Dir('.').abspath
93
94# Path to the M5 source tree.
95SRCDIR = joinpath(ROOT, 'src')
96
97# tell python where to find m5 python code
98sys.path.append(joinpath(ROOT, 'src/python'))
99
100def check_style_hook(ui):
101 ui.readconfig(joinpath(ROOT, '.hg', 'hgrc'))
102 style_hook = ui.config('hooks', 'pretxncommit.style', None)
103
104 if not style_hook:
105 print """\
106You're missing the M5 style hook.
107Please install the hook so we can ensure that all code fits a common style.
108
109All you'd need to do is add the following lines to your repository .hg/hgrc
110or your personal .hgrc
111----------------
112
113[extensions]
114style = %s/util/style.py
115
116[hooks]
117pretxncommit.style = python:style.check_whitespace
118""" % (ROOT)
119 sys.exit(1)
120
121if isdir(joinpath(ROOT, '.hg')):
122 try:
123 from mercurial import ui
124 check_style_hook(ui.ui())
125 except ImportError:
126 pass
127
128###################################################
129#
130# Figure out which configurations to set up based on the path(s) of
131# the target(s).
132#
133###################################################
134
135# Find default configuration & binary.

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

282if not env.has_key('SWIG'):
283 print 'Error: SWIG utility not found.'
284 print ' Please install (see http://www.swig.org) and retry.'
285 Exit(1)
286
287# Check for appropriate SWIG version
288swig_version = os.popen('swig -version').read().split()
289# First 3 words should be "SWIG Version x.y.z"
100###################################################
101#
102# Figure out which configurations to set up based on the path(s) of
103# the target(s).
104#
105###################################################
106
107# Find default configuration & binary.

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

254if not env.has_key('SWIG'):
255 print 'Error: SWIG utility not found.'
256 print ' Please install (see http://www.swig.org) and retry.'
257 Exit(1)
258
259# Check for appropriate SWIG version
260swig_version = os.popen('swig -version').read().split()
261# First 3 words should be "SWIG Version x.y.z"
290if swig_version[0] != 'SWIG' or swig_version[1] != 'Version':
262if len(swig_version) < 3 or \
263 swig_version[0] != 'SWIG' or swig_version[1] != 'Version':
291 print 'Error determining SWIG version.'
292 Exit(1)
293
294min_swig_version = '1.3.28'
295if compare_versions(swig_version[2], min_swig_version) < 0:
296 print 'Error: SWIG version', min_swig_version, 'or newer required.'
297 print ' Installed version:', swig_version[2]
298 Exit(1)

--- 420 unchanged lines hidden ---
264 print 'Error determining SWIG version.'
265 Exit(1)
266
267min_swig_version = '1.3.28'
268if compare_versions(swig_version[2], min_swig_version) < 0:
269 print 'Error: SWIG version', min_swig_version, 'or newer required.'
270 print ' Installed version:', swig_version[2]
271 Exit(1)

--- 420 unchanged lines hidden ---