summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@eecs.umich.edu>2007-07-22 10:40:45 -0400
committerSteve Reinhardt <stever@eecs.umich.edu>2007-07-22 10:40:45 -0400
commit03730edc45e2e00bdec58dabc84e94c632634a1a (patch)
treeaffdbffcb174a9cfc0de933f3c240ae5f2813292 /SConstruct
parent658eeee50715d9fd334ae3fd3e0e21b6db6de0c4 (diff)
parent2cd454d102b5da828b0fbf4b66ef1a24875e69f6 (diff)
downloadgem5-03730edc45e2e00bdec58dabc84e94c632634a1a.tar.xz
Merge Gabe's changes with mine.
--HG-- extra : convert_revision : f50ed42e7acb3f11e610fd6976eaa8df0c6ba2ab
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct30
1 files changed, 29 insertions, 1 deletions
diff --git a/SConstruct b/SConstruct
index ffcd84706..ec60964e4 100644
--- a/SConstruct
+++ b/SConstruct
@@ -67,7 +67,7 @@ import sys
import os
import subprocess
-from os.path import join as joinpath
+from os.path import isdir, join as joinpath
# Check for recent-enough Python and SCons versions. If your system's
# default installation of Python is not recent enough, you can use a
@@ -97,6 +97,34 @@ SRCDIR = joinpath(ROOT, 'src')
# tell python where to find m5 python code
sys.path.append(joinpath(ROOT, 'src/python'))
+def check_style_hook(ui):
+ ui.readconfig(joinpath(ROOT, '.hg', 'hgrc'))
+ style_hook = ui.config('hooks', 'pretxncommit.style', None)
+
+ if not style_hook:
+ print """\
+You're missing the M5 style hook.
+Please install the hook so we can ensure that all code fits a common style.
+
+All you'd need to do is add the following lines to your repository .hg/hgrc
+or your personal .hgrc
+----------------
+
+[extensions]
+style = %s/util/style.py
+
+[hooks]
+pretxncommit.style = python:style.check_whitespace
+""" % (ROOT)
+ sys.exit(1)
+
+if isdir(joinpath(ROOT, '.hg')):
+ try:
+ from mercurial import ui
+ check_style_hook(ui.ui())
+ except ImportError:
+ pass
+
###################################################
#
# Figure out which configurations to set up based on the path(s) of