Browse Source

Fixes for plugin versioning

rdb 16 years ago
parent
commit
5d84be4214
2 changed files with 14 additions and 11 deletions
  1. 6 2
      makepanda/makepanda.py
  2. 8 9
      makepanda/makepandacore.py

+ 6 - 2
makepanda/makepanda.py

@@ -1323,6 +1323,7 @@ PANDAVERSION_H="""
 #define PANDA_MINOR_VERSION $VERSION2
 #define PANDA_SEQUENCE_VERSION $VERSION2
 #define PANDA_VERSION $NVERSION
+#define PANDA_NUMERIC_VERSION $NVERSION
 #define PANDA_VERSION_STR "$VERSION1.$VERSION2.$VERSION3"
 #define PANDA_DISTRIBUTOR "$DISTRIBUTOR"
 #define PANDA_PACKAGE_VERSION_STR "$RUNTIME_VERSION"
@@ -1354,6 +1355,9 @@ def CreatePandaVersionFiles():
         pversion2=int(PLUGIN_VERSION.split(".")[1])
         pversion3=int(PLUGIN_VERSION.split(".")[2])
     nversion=version1*1000000+version2*1000+version3
+    if (DISTRIBUTOR != "cmu"):
+        # Subtract 1 if we are not an official version.
+        nversion -= 1
     
     pandaversion_h = PANDAVERSION_H.replace("$VERSION1",str(version1))
     pandaversion_h = pandaversion_h.replace("$VERSION2",str(version2))
@@ -1367,8 +1371,8 @@ def CreatePandaVersionFiles():
         pandaversion_h += "\n#undef  PANDA_OFFICIAL_VERSION\n"
     if RUNTIME:
         pandaversion_h += "\n#define P3D_PLUGIN_MAJOR_VERSION %s\n" % pversion1
-        pandaversion_h += "\n#define P3D_PLUGIN_MINOR_VERSION %s\n" % pversion1
-        pandaversion_h += "\n#define P3D_PLUGIN_SEQUENCE_VERSION %s\n" % pversion1
+        pandaversion_h += "\n#define P3D_PLUGIN_MINOR_VERSION %s\n" % pversion2
+        pandaversion_h += "\n#define P3D_PLUGIN_SEQUENCE_VERSION %s\n" % pversion3
     
     checkpandaversion_cxx = CHECKPANDAVERSION_CXX.replace("$VERSION1",str(version1))
     checkpandaversion_cxx = checkpandaversion_cxx.replace("$VERSION2",str(version2))

+ 8 - 9
makepanda/makepandacore.py

@@ -717,7 +717,6 @@ def MakeBuildTree():
     MakeDirectory(OUTPUTDIR+"/models/maps")
     MakeDirectory(OUTPUTDIR+"/models/misc")
     MakeDirectory(OUTPUTDIR+"/models/gui")
-    MakeDirectory(OUTPUTDIR+"/direct")
     MakeDirectory(OUTPUTDIR+"/pandac")
     MakeDirectory(OUTPUTDIR+"/pandac/input")
 
@@ -1500,11 +1499,11 @@ def ParsePandaVersion(fn):
         for line in f:
             match = pattern.match(line,0)
             if (match):
-                version = match.group(1)+"."+match.group(2)+"."+match.group(3)
-                break
+                f.close()
+                return match.group(1)+"."+match.group(2)+"."+match.group(3)
         f.close()
-    except: version="0.0.0"
-    return version
+    except: pass
+    return "0.0.0"
 
 def ParsePluginVersion(fn):
     try:
@@ -1513,11 +1512,11 @@ def ParsePluginVersion(fn):
         for line in f:
             match = pattern.match(line,0)
             if (match):
-                version = match.group(1)+"."+match.group(2)+"."+match.group(3)
-                break
+                f.close()
+                return match.group(1)+"."+match.group(2)+"."+match.group(3)
         f.close()
-    except: version="0.0.0"
-    return version
+    except: pass
+    return "0.0.0"
 
 ########################################################################
 ##