From 0a2fa1575afbd7a37b2d4bf74a326f86adbc0207 Mon Sep 17 00:00:00 2001 From: Sergey Popov Date: Sun, 17 Mar 2013 00:38:13 +0000 Subject: [PATCH] Added support for autorevision to scons --- SConstruct | 8 +++++--- src/SConscript | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/SConstruct b/SConstruct index 1e2525ee825..36d0fbbd48f 100755 --- a/SConstruct +++ b/SConstruct @@ -443,7 +443,7 @@ for env in [test_env, client_env, env]: if not env['static_test']: test_env.Append(CPPDEFINES = "BOOST_TEST_DYN_LINK") -if os.path.exists('.git'): +if os.path.exists('.git') and (file(".git/config").read().find("svn-remote") != -1): try: env["svnrev"] = Popen(Split("git svn find-rev refs/remotes/trunk"), stdout=PIPE, stderr=PIPE).communicate()[0].rstrip("\n") if not env["svnrev"]: @@ -457,10 +457,12 @@ if os.path.exists('.git'): except: env["svnrev"] = "" else: + env["svnrev"] = "" try: - env["svnrev"] = Popen(Split("svnversion -n ."), stdout=PIPE).communicate()[0] + if call("utils/autorevision -t h > revision.h", shell=True) == 0: + env["have_autorevision"] = True except: - env["svnrev"] = "" + pass Export(Split("env client_env test_env have_client_prereqs have_server_prereqs have_test_prereqs")) SConscript(dirs = Split("po doc packaging/windows packaging/systemd")) diff --git a/src/SConscript b/src/SConscript index 980a7d52cdb..1b7f8063afc 100644 --- a/src/SConscript +++ b/src/SConscript @@ -647,6 +647,8 @@ if env["svnrev"] != "" and env["svnrev"] != "exported": "Generating revision.hpp..." )) game_config_env.Append(CPPDEFINES = 'HAVE_REVISION') +if env.get("have_autorevision"): + game_config_env.Append(CPPDEFINES = 'LOAD_REVISION') sources = [] if "TAGS" in COMMAND_LINE_TARGETS: