Browse Source

Better packaging in makepanda

rdb 16 years ago
parent
commit
6529e5c0a8
3 changed files with 31 additions and 21 deletions
  1. 4 0
      direct/src/p3d/panda3d.pdef
  2. 26 21
      makepanda/makepanda.py
  3. 1 0
      makepanda/makepandacore.py

+ 4 - 0
direct/src/p3d/panda3d.pdef

@@ -29,11 +29,15 @@ class images(package):
         basename = '%s.png' % (name)
         basename = '%s.png' % (name)
         filename = Filename('plugin_images/%s' % (basename))
         filename = Filename('plugin_images/%s' % (basename))
         found = filename.resolveFilename(getModelPath().getValue())
         found = filename.resolveFilename(getModelPath().getValue())
+        if not found:
+            found = filename.resolveFilename("models")
         if not found:
         if not found:
             # Then try a jpeg image.
             # Then try a jpeg image.
             basename = '%s.jpg' % (name)
             basename = '%s.jpg' % (name)
             filename = Filename('plugin_images/%s' % (basename))
             filename = Filename('plugin_images/%s' % (basename))
             found = filename.resolveFilename(getModelPath().getValue())
             found = filename.resolveFilename(getModelPath().getValue())
+            if not found:
+                found = filename.resolveFilename("models")
             
             
         if found:
         if found:
             # Add the image file to the package
             # Add the image file to the package

+ 26 - 21
makepanda/makepanda.py

@@ -75,6 +75,7 @@ def usage(problem):
     print "compiled copy of Panda3D.  Command-line arguments are:"
     print "compiled copy of Panda3D.  Command-line arguments are:"
     print ""
     print ""
     print "  --help            (print the help message you're reading now)"
     print "  --help            (print the help message you're reading now)"
+    print "  --verbose         (print out more information)"
     print "  --installer       (build an installer)"
     print "  --installer       (build an installer)"
     print "  --optimize X      (optimization level can be 1,2,3,4)"
     print "  --optimize X      (optimization level can be 1,2,3,4)"
     print "  --version         (set the panda version number)"
     print "  --version         (set the panda version number)"
@@ -264,6 +265,7 @@ else:
 
 
 builtdir = os.path.join(os.path.abspath(GetOutputDir()))
 builtdir = os.path.join(os.path.abspath(GetOutputDir()))
 AddToPathEnv("PYTHONPATH", builtdir)
 AddToPathEnv("PYTHONPATH", builtdir)
+AddToPathEnv("PANDA_PRC_DIR", os.path.join(builtdir, "etc"))
 if (sys.platform.startswith("win")):
 if (sys.platform.startswith("win")):
     AddToPathEnv("PYTHONPATH", os.path.join(builtdir, "bin"))
     AddToPathEnv("PYTHONPATH", os.path.join(builtdir, "bin"))
 else:
 else:
@@ -936,6 +938,19 @@ def FreezePy(target, inputs, opts):
     if (not os.path.exists(target)):
     if (not os.path.exists(target)):
         exit("")
         exit("")
 
 
+##########################################################################################
+#
+# Package
+#
+##########################################################################################
+
+def Package(target, inputs, opts):
+    # Invoke the ppackage script.
+    command = SDK["PYTHONEXEC"] + " direct/src/p3d/ppackage.py"
+    command += " -i \"" + GetOutputDir() + "/stage\""
+    command += " direct/src/p3d/panda3d.pdef"
+    oscmd(command)
+
 ##########################################################################################
 ##########################################################################################
 #
 #
 # CompileBundle
 # CompileBundle
@@ -993,6 +1008,9 @@ def CompileAnything(target, inputs, opts, progress = None):
         else:
         else:
             ProgressOutput(progress, "Building frozen library", target)
             ProgressOutput(progress, "Building frozen library", target)
         return FreezePy(target, inputs, opts)
         return FreezePy(target, inputs, opts)
+    elif (infile.endswith(".pdef")):
+        ProgressOutput(progress, "Building package from pdef file", infile)
+        return Package(target, inputs, opts)
     elif SUFFIX_LIB.count(origsuffix):
     elif SUFFIX_LIB.count(origsuffix):
         ProgressOutput(progress, "Linking static library", target)
         ProgressOutput(progress, "Linking static library", target)
         return CompileLib(target, inputs, opts)
         return CompileLib(target, inputs, opts)
@@ -4007,6 +4025,14 @@ if (PkgSkip("PYTHON")==0):
   TargetAdd('packpanda.exe', input='direct/src/directscripts/packpanda.py')
   TargetAdd('packpanda.exe', input='direct/src/directscripts/packpanda.py')
   TargetAdd('eggcacher.exe', input='direct/src/directscripts/eggcacher.py')
   TargetAdd('eggcacher.exe', input='direct/src/directscripts/eggcacher.py')
 
 
+#
+# Build the runtime.
+#
+
+if (RUNTIME):
+  OPTS=['DIR:direct/src/p3d']
+  TargetAdd('panda3d', opts=OPTS, input='panda3d.pdef')
+
 #
 #
 # Generate the models directory and samples directory
 # Generate the models directory and samples directory
 #
 #
@@ -4143,27 +4169,6 @@ except:
     SaveDependencyCache()
     SaveDependencyCache()
     raise
     raise
 
 
-##########################################################################################
-#
-# The Runtime
-#
-# This is a package that can be uploaded to a web server, to host panda3d versions
-# for the plugin.
-#
-##########################################################################################
-
-def MakeRuntime():
-    # Invoke the ppackage script.
-    command = SDK["PYTHONEXEC"] + " direct/src/p3d/ppackage.py"
-    command += " -i \"" + GetOutputDir() + "/stage\""
-    command += " direct/src/p3d/panda3d.pdef"
-    oscmd(command)
-    
-    print "Runtime output stored in \"" + GetOutputDir() + "/stage\"."
-
-if (RUNTIME != 0):
-    MakeRuntime()
-
 ##########################################################################################
 ##########################################################################################
 #
 #
 # The Installers
 # The Installers

+ 1 - 0
makepanda/makepandacore.py

@@ -1280,6 +1280,7 @@ def CalcLocation(fn, ipath):
     if (fn.endswith(".c")):   return CxxFindSource(fn, ipath)
     if (fn.endswith(".c")):   return CxxFindSource(fn, ipath)
     if (fn.endswith(".yxx")): return CxxFindSource(fn, ipath)
     if (fn.endswith(".yxx")): return CxxFindSource(fn, ipath)
     if (fn.endswith(".lxx")): return CxxFindSource(fn, ipath)
     if (fn.endswith(".lxx")): return CxxFindSource(fn, ipath)
+    if (fn.endswith(".pdef")):return CxxFindSource(fn, ipath)
     if (sys.platform.startswith("win")):
     if (sys.platform.startswith("win")):
         if (fn.endswith(".def")): return CxxFindSource(fn, ipath)
         if (fn.endswith(".def")): return CxxFindSource(fn, ipath)
         if (fn.endswith(".rc")):  return CxxFindSource(fn, ipath)
         if (fn.endswith(".rc")):  return CxxFindSource(fn, ipath)