diff options
Diffstat (limited to 'BuildTools/GetBuildVersion.py')
-rwxr-xr-x | BuildTools/GetBuildVersion.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/BuildTools/GetBuildVersion.py b/BuildTools/GetBuildVersion.py index a362574..007fec8 100755 --- a/BuildTools/GetBuildVersion.py +++ b/BuildTools/GetBuildVersion.py @@ -1,9 +1,21 @@ #!/usr/bin/env python -import sys +import sys, re sys.path.append("SCons") import Version, os.path -assert(len(sys.argv) == 2) +assert(len(sys.argv) >= 2) -print Version.getBuildVersion(os.path.dirname(sys.argv[0] + "/.."), sys.argv[1]) +only_major = False +if "--major" in sys.argv : + only_major = True + +if only_major : + v = Version.getBuildVersion(os.path.dirname(sys.argv[0] + "/.."), sys.argv[1]) + version_match = re.match("(\d+)\.(\d+).*", v) + if version_match : + print version_match.group(1) + else : + print "0" +else : + print Version.getBuildVersion(os.path.dirname(sys.argv[0] + "/.."), sys.argv[1]) |