Updated the Java bindings and docs to support the version status.
authorRoman Donchenko <roman.donchenko@itseez.com>
Thu, 12 Sep 2013 12:39:14 +0000 (16:39 +0400)
committerRoman Donchenko <roman.donchenko@itseez.com>
Thu, 12 Sep 2013 12:39:14 +0000 (16:39 +0400)
doc/conf.py
modules/java/generator/gen_java.py

index 312a1c2..92be1af 100755 (executable)
@@ -55,6 +55,7 @@ version_epoch = re.search("^W*#\W*define\W+CV_VERSION_EPOCH\W+(\d+)\W*$", versio
 version_major = re.search("^W*#\W*define\W+CV_VERSION_MAJOR\W+(\d+)\W*$", version_file, re.MULTILINE).group(1)
 version_minor = re.search("^W*#\W*define\W+CV_VERSION_MINOR\W+(\d+)\W*$", version_file, re.MULTILINE).group(1)
 version_patch = re.search("^W*#\W*define\W+CV_VERSION_REVISION\W+(\d+)\W*$", version_file, re.MULTILINE).group(1)
+version_status = re.search("^W*#\W*define\W+CV_VERSION_STATUS\W+\"(.*?)\"\W*$", version_file, re.MULTILINE).group(1)
 
 # The short X.Y version.
 version = version_epoch + '.' + version_major
@@ -62,6 +63,7 @@ version = version_epoch + '.' + version_major
 release = version_epoch + '.' + version_major + '.' + version_minor
 if version_patch:
     release = release + '.' + version_patch
+release += version_status
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
index ef056a7..d023845 100755 (executable)
@@ -632,7 +632,8 @@ def getLibVersion(version_hpp_path):
     major = re.search("^W*#\W*define\W+CV_VERSION_MAJOR\W+(\d+)\W*$", version_file, re.MULTILINE).group(1)
     minor = re.search("^W*#\W*define\W+CV_VERSION_MINOR\W+(\d+)\W*$", version_file, re.MULTILINE).group(1)
     revision = re.search("^W*#\W*define\W+CV_VERSION_REVISION\W+(\d+)\W*$", version_file, re.MULTILINE).group(1)
-    return (epoch, major, minor, revision)
+    status = re.search("^W*#\W*define\W+CV_VERSION_STATUS\W+\"(.*?)\"\W*$", version_file, re.MULTILINE).group(1)
+    return (epoch, major, minor, revision, status)
 
 class ConstInfo(object):
     def __init__(self, cname, name, val, addedManually=False):
@@ -799,15 +800,19 @@ public class %(jc)s {
 """ % { 'm' : self.module, 'jc' : jname } )
 
         if class_name == 'Core':
-            (epoch, major, minor, revision) = getLibVersion(
+            (epoch, major, minor, revision, status) = getLibVersion(
                 (os.path.dirname(__file__) or '.') + '/../../core/include/opencv2/core/version.hpp')
-            version_str    = '.'.join( (epoch, major, minor, revision) )
+            version_str    = '.'.join( (epoch, major, minor, revision) ) + status
             version_suffix =  ''.join( (epoch, major, minor) )
             self.classes[class_name].imports.add("java.lang.String")
             self.java_code[class_name]["j_code"].write("""
     public static final String VERSION = "%(v)s", NATIVE_LIBRARY_NAME = "opencv_java%(vs)s";
-    public static final int VERSION_EPOCH = %(ep)s, VERSION_MAJOR = %(ma)s, VERSION_MINOR = %(mi)s, VERSION_REVISION = %(re)s;
-""" % { 'v' : version_str, 'vs' : version_suffix, 'ep' : epoch, 'ma' : major, 'mi' : minor, 're' : revision } )
+    public static final int VERSION_EPOCH = %(ep)s;
+    public static final int VERSION_MAJOR = %(ma)s;
+    public static final int VERSION_MINOR = %(mi)s;
+    public static final int VERSION_REVISION = %(re)s;
+    public static final String VERSION_STATUS = "%(st)s";
+""" % { 'v' : version_str, 'vs' : version_suffix, 'ep' : epoch, 'ma' : major, 'mi' : minor, 're' : revision, 'st': status } )
 
 
     def add_class(self, decl):