diff options
author | Ali Saidi <saidi@eecs.umich.edu> | 2009-01-30 20:04:57 -0500 |
---|---|---|
committer | Ali Saidi <saidi@eecs.umich.edu> | 2009-01-30 20:04:57 -0500 |
commit | be5d350afc829acf87aad5e8701f3f67476edc8b (patch) | |
tree | 7fefc8581a55a723704ffc9ccaf43ed2aaa36b9b /src/SConscript | |
parent | e7293dd24eb15ce568ffbb2f6aa8ae60f88472b1 (diff) | |
download | gem5-be5d350afc829acf87aad5e8701f3f67476edc8b.tar.xz |
SCons: Fix how we get Mercurial revision information since internals keep changing.
Diffstat (limited to 'src/SConscript')
-rw-r--r-- | src/SConscript | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/src/SConscript b/src/SConscript index 5ba89381d..27ad56397 100644 --- a/src/SConscript +++ b/src/SConscript @@ -355,25 +355,16 @@ depends = [ File(py_modules[dep]) for dep in module_depends ] scons_dir = str(SCons.Node.FS.default_fs.SConstruct_dir) -hg_info = ("Unknown", "Unknown", "Unknown") +hg_info = "Unknown" hg_demandimport = False try: if not exists(scons_dir) or not isdir(scons_dir) or \ not exists(joinpath(scons_dir, ".hg")): raise ValueError(".hg directory not found") - - import mercurial.demandimport, mercurial.hg, mercurial.ui - import mercurial.util, mercurial.node - hg_demandimport = True - - repo = mercurial.hg.repository(mercurial.ui.ui(), scons_dir) - rev = mercurial.node.nullrev + repo.changelog.count() - changenode = repo.changelog.node(rev) - changes = repo.changelog.read(changenode) - id = mercurial.node.hex(changenode) - date = mercurial.util.datestr(changes[2]) - - hg_info = (rev, id, date) + import subprocess + output = subprocess.Popen("hg id -n -i -t -b".split(), + stdout=subprocess.PIPE).communicate()[0] + hg_info = output.strip() except ImportError, e: print "Mercurial not found" except ValueError, e: @@ -381,16 +372,13 @@ except ValueError, e: except Exception, e: print "Other mercurial exception: %s" % e -if hg_demandimport: - mercurial.demandimport.disable() - # Generate Python file containing a dict specifying the current # build_env flags. def makeDefinesPyFile(target, source, env): f = file(str(target[0]), 'w') build_env, hg_info = [ x.get_contents() for x in source ] print >>f, "buildEnv = %s" % build_env - print >>f, "hgRev, hgId, hgDate = %s" % hg_info + print >>f, "hgRev = '%s'" % hg_info f.close() defines_info = [ Value(build_env), Value(hg_info) ] |