version: Add a "+" to version string

I use this to show that there have been any changes since the last
release.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2015-01-25 10:17:29 -05:00
parent 93bac41ba6
commit 77fc2fff5c
2 changed files with 11 additions and 7 deletions

View File

@ -1,9 +1,19 @@
#!/usr/bin/python
import subprocess
Import("env", "test_env")
version = str(env.Version)
if env.Debug == True:
version += "-debug"
try:
devnull = open("/dev/null", "w")
diff = subprocess.check_output("git diff $(git describe --abbrev=0)",
stderr=devnull, shell=True)
if diff != "":
version += "+"
except:
pass
for e in (env, test_env):
e.Append( CCFLAGS = [ "-DCONFIG_VERSION='\"%s\"'" % version ] )

View File

@ -4,15 +4,9 @@
#include <core/version.h>
#include <tests/test.h>
#ifdef CONFIG_DEBUG
const std::string expected = "6.3-debug";
#else
const std::string expected = "6.3";
#endif /* CONFIG_DEBUG */
static void test_version()
{
test_equal((std::string)get_version(), expected);
test_equal((std::string)get_version(), CONFIG_VERSION);
}
int main(int argc, char **argv)