Browse Source

some minor reorganization

David Rose 16 years ago
parent
commit
c867b125c1

+ 1 - 1
direct/src/p3d/Packager.py

@@ -1721,7 +1721,7 @@ class Packager:
             # Update an existing host entry
             if descriptiveName:
                 he.descriptiveName = descriptiveName
-            if mirrors:
+            if mirrors is not None:
                 he.mirrors = mirrors
 
         return he

+ 74 - 0
direct/src/p3d/Sources.pp

@@ -0,0 +1,74 @@
+// This directory contains the Python code necessary to interface with
+// the browser plugin system at runtime.  It also contains the Python
+// scripts to create and manage p3d files, which are the actual
+// runtime applications, and packages, which are additional code and
+// assets that can be downloaded at runtime by p3d files.
+
+#if $[BUILD_P3D_SCRIPTS]
+
+  // If the developer has asked to build the shell script to invoke
+  // ppackage.py (or some other Python script in this directory), then
+  // do so now.  These convenient scripts aren't built by default,
+  // because usually ppackage.p3d etc. is a more reliable way to
+  // invoke these applications.  However, there might be development
+  // environments that don't have a ppackage.p3d available, in which
+  // case it is convenient to have one or more of these scripts.
+
+  #define INSTALL_SCRIPTS $[BUILD_P3D_SCRIPTS:%=%.py]
+
+  // On Windows, we generate a batch file; on other platforms
+  // (including Cygwin), we generate a sh script.
+
+  #define install_dir $[$[upcase $[PACKAGE]]_INSTALL]
+  #define install_bin_dir $[or $[INSTALL_BIN_DIR],$[install_dir]/bin]
+
+  #define python $[PYTHON_COMMAND]
+  #if $[USE_DEBUG_PYTHON]
+    #define python $[PYTHON_DEBUG_COMMAND]
+  #endif
+
+  #foreach scriptname $[BUILD_P3D_SCRIPTS]
+    #if $[eq $[PLATFORM],Win32]
+      #set INSTALL_SCRIPTS $[INSTALL_SCRIPTS] $[scriptname].bat
+    #else
+      #set INSTALL_SCRIPTS $[INSTALL_SCRIPTS] $[scriptname]
+    #endif
+
+    #if $[eq $[PLATFORM],Win32]
+  #output $[scriptname].bat notouch
+@echo off
+rem #### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[notdir $[THISFILENAME]].
+rem ################################# DO NOT EDIT ###########################
+
+$[python] -u $[osfilename $[install_bin_dir]/$[scriptname].py] %1 %2 %3 %4 %5 %6 %7 %8 %9
+  #end $[scriptname].bat
+
+  #else  // Win32
+
+  #output $[scriptname] binary notouch
+#! /bin/sh
+#### Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[notdir $[THISFILENAME]].
+################################# DO NOT EDIT ###########################
+
+  #if $[CTPROJS]
+# This script was generated while the user was using the ctattach
+# tools.  That had better still be the case.
+  #if $[WINDOWS_PLATFORM]
+$[python] -u `cygpath -w $DIRECT/built/bin/$[scriptname].py` "$@"
+  #else
+$[python] -u $DIRECT/built/bin/$[scriptname].py "$@"
+  #endif
+  #else
+$[python] -u '$[osfilename $[install_bin_dir]/$[scriptname].py]' "$@"
+  #endif
+  #end $[scriptname]
+
+  #endif  // Win32
+
+  #end scriptname
+
+#endif  // WANT_PACKAGE_SCRIPT
+
+
+
+

+ 80 - 0
direct/src/p3d/coreapi.pdef

@@ -0,0 +1,80 @@
+from pandac.PandaModules import getModelPath, Filename, ConfigVariableFilename
+
+# This file defines a number of standard "packages" that correspond to
+# a Panda3D distribution.  These packages are built by passing this
+# file to the ppackage utility, either as a packaged application, or
+# as the module direct.p3d.ppackage.
+
+# The packages in this file define the "Core API".  This is the second
+# installed piece of the three-part plugin system (the plugin, the
+# core API, Panda3D).
+
+# These packages are downloaded directly by the plugin, from the host
+# specified by the value of PANDA_PACKAGE_HOST_URL compiled into the
+# plugin.  Thus, these packages are inextricably tied to the
+# particular plugin they have been built with.  They do not have to be
+# present on a server that hosts a version of Panda3D for download,
+# just on the server that hosts the plugin itself.  These packages do
+# not need to be updated with each new version of Panda3D.
+
+# Also see panda3d.pdef.
+
+class coreapi(solo):
+    # The special "coreapi" package.  As a "solo", this is just a
+    # single .dll (or dylib, or whatever).
+    file('p3d_plugin.dll')
+
+class images(package):
+    # The default startup images are stored as their own package.
+    names = ['download', 'play_click', 'play_ready', 'play_rollover',
+             'auth_click', 'auth_ready', 'auth_rollover']
+    configDict = {}
+    for name in names:
+        # Look for a png image first.
+        basename = '%s.png' % (name)
+        filename = Filename('plugin_images/%s' % (basename))
+        found = filename.resolveFilename(getModelPath().getValue())
+        if not found:
+            found = filename.resolveFilename("models")
+        if not found:
+            # Then try a jpeg image.
+            basename = '%s.jpg' % (name)
+            filename = Filename('plugin_images/%s' % (basename))
+            found = filename.resolveFilename(getModelPath().getValue())
+            if not found:
+                found = filename.resolveFilename("models")
+            
+        if found:
+            # Add the image file to the package
+            file(filename, newName = basename, extract = True)
+
+            # And set the config variable to reference it.
+            token = '%s_img' % (name)
+            configDict[token] = basename
+        else:
+            print "Could not locate %s" % (filename)
+
+    # Also make a few special cases.  We use the same default image
+    # for download, ready, unauth, launch, and failed.
+    download = configDict.get('download_img', None)
+    if download:
+        configDict['ready_img'] = download
+        configDict['unauth_img'] = download
+        configDict['launch_img'] = download
+        configDict['failed_img'] = download
+
+    config(**configDict)
+
+class p3dcert(package):
+    # This special application, used to pop up a dialog to prompt the
+    # user to accept or deny unknown applications, is its own package.
+    config(display_name = "Authorization Dialog")
+
+    file('p3dcert.exe')
+
+    # Also add the certificate authority file.
+    cvar = ConfigVariableFilename('ca-bundle-filename')
+    filename = Filename(cvar.getValue())
+    if not filename.empty():
+        file(filename, newName = 'ca-bundle.crt', extract = True)
+        

+ 9 - 17
direct/src/p3d/packp3d.py

@@ -177,20 +177,12 @@ def makePackedApp(args):
         print inst.args[0]
         sys.exit(1)
 
-def main(appRunner):
-    """ This function is called when this module is invoked as
-    packp3d.p3d. """
-
-    try:
-        makePackedApp(appRunner.argv[1:])
-    except ArgumentError, e:
-        print e.args[0]
-        sys.exit(1)
-    sys.exit(0)
-
-if __name__ == '__main__':
-    try:
-        makePackedApp(sys.argv[1:])
-    except ArgumentError, e:
-        print e.args[0]
-        sys.exit(1)
+try:
+    makePackedApp(sys.argv[1:])
+except ArgumentError, e:
+    print e.args[0]
+    sys.exit(1)
+
+# An explicit call to exit() is required to exit the program, when
+# this module is packaged in a p3d file.
+sys.exit(0)

+ 30 - 71
direct/src/p3d/panda3d.pdef

@@ -1,81 +1,23 @@
-from pandac.PandaModules import getModelPath, Filename, ConfigVariableFilename
+from pandac.PandaModules import Filename
 
 # This file defines a number of standard "packages" that correspond to
 # a Panda3D distribution.  These packages are built by passing this
 # file to the ppackage utility, either as a packaged application, or
 # as the module direct.p3d.ppackage.
 
-# These packages are then downloaded by the Panda3D plugin and
-# standalone runtime executable, and they contain the actual Panda3D
-# runtime libraries.
-
-# We divide the runtime into several smaller packages.  There is the
-# core Panda3D package, which is needed by all Panda3D applications,
-# and then a number of smaller, optional packages, which may or may
-# not be needed by any one particular application.
-
-class coreapi(solo):
-    # The special "coreapi" package.  As a "solo", this is just a
-    # single .dll (or dylib, or whatever).
-    file('p3d_plugin.dll')
-
-class images(package):
-    # The default startup images are stored as their own package.
-    names = ['download', 'play_click', 'play_ready', 'play_rollover',
-             'auth_click', 'auth_ready', 'auth_rollover']
-    configDict = {}
-    for name in names:
-        # Look for a png image first.
-        basename = '%s.png' % (name)
-        filename = Filename('plugin_images/%s' % (basename))
-        found = filename.resolveFilename(getModelPath().getValue())
-        if not found:
-            found = filename.resolveFilename("models")
-        if not found:
-            # Then try a jpeg image.
-            basename = '%s.jpg' % (name)
-            filename = Filename('plugin_images/%s' % (basename))
-            found = filename.resolveFilename(getModelPath().getValue())
-            if not found:
-                found = filename.resolveFilename("models")
-            
-        if found:
-            # Add the image file to the package
-            file(filename, newName = basename, extract = True)
-
-            # And set the config variable to reference it.
-            token = '%s_img' % (name)
-            configDict[token] = basename
-        else:
-            print "Could not locate %s" % (filename)
-
-    # Also make a few special cases.  We use the same default image
-    # for download, ready, unauth, launch, and failed.
-    download = configDict.get('download_img', None)
-    if download:
-        configDict['ready_img'] = download
-        configDict['unauth_img'] = download
-        configDict['launch_img'] = download
-        configDict['failed_img'] = download
-
-    config(**configDict)
-
-class p3dcert(package):
-    # This special application, used to pop up a dialog to prompt the
-    # user to accept or deny unknown applications, is its own package.
-    config(display_name = "Authorization Dialog")
-
-    file('p3dcert.exe')
-
-    # Also add the certificate authority file.
-    cvar = ConfigVariableFilename('ca-bundle-filename')
-    filename = Filename(cvar.getValue())
-    if not filename.empty():
-        file(filename, newName = 'ca-bundle.crt', extract = True)
-        
+# The packages in this file define Panda3D itself.  This is the third
+# installed piece of the three-part plugin system (the plugin, the
+# core API, Panda3D).
+
+# When needed, these packages are downloaded by the core API, from the
+# host URL specified in a given p3d file, and not from any hardcoded
+# URL.  Thus, any custom version of Panda3D may be hosted on any
+# server in the world, and any version of the plugin can download it.
+
+# Also see coreapi.pdef.
 
 class panda3d(package):
-    # The core Panda3D package.  Contains Python and most of the graphics
+    # The main Panda3D package.  Contains Python and most of the graphics
     # code in Panda3D.
 
     config(display_name = "Panda3D")
@@ -91,6 +33,11 @@ class panda3d(package):
     # automatically be included as well, and we end up with a pretty
     # complete list that way.
     module('direct.directbase.DirectStart',
+           # Don't want to include all files in direct.p3d, because
+           # that picks up the runtime scripts too, which are their
+           # own p3d files below.
+           'direct.p3d.AppRunner',
+           'direct.p3d.DWBPackageInstaller',
            'direct.actor.*',
            'direct.controls.*',
            'direct.directdevices.*',
@@ -101,7 +48,6 @@ class panda3d(package):
            'direct.fsm.*',
            'direct.gui.*',
            'direct.interval.*',
-           'direct.p3d.*',
            'direct.particles.*',
            'direct.showbase.*',
            'direct.showutil.*',
@@ -221,3 +167,16 @@ class ppackage(p3d):
     require('panda3d', 'egg')
 
     mainModule('direct.p3d.ppackage')
+
+
+class ppatcher(p3d):
+    # A handy utility to go along with ppackage.  This builds
+    # patchfiles as needed in the directory structure created by
+    # ppackage.
+
+    config(display_name = "Panda3D Patch Maker",
+           hidden = True, platform_specific = False,
+           keep_user_env = True)
+    require('panda3d')
+
+    mainModule('direct.p3d.ppatcher')

+ 4 - 0
direct/src/p3d/ppackage.py

@@ -161,3 +161,7 @@ except Packager.PackagerError:
     print inst.args[0]
     #raise
     sys.exit(1)
+
+# An explicit call to exit() is required to exit the program, when
+# this module is packaged in a p3d file.
+sys.exit(0)

+ 4 - 0
direct/src/p3d/ppatcher.py

@@ -94,3 +94,7 @@ if not packageNames:
 
 pm = PatchMaker(installDir)
 pm.buildPatches(packageNames = packageNames)
+
+# An explicit call to exit() is required to exit the program, when
+# this module is packaged in a p3d file.
+sys.exit(0)

+ 6 - 2
direct/src/plugin/Sources.pp

@@ -1,5 +1,9 @@
-// This directory is still experimental.  Define HAVE_P3D_PLUGIN in
-// your Config.pp to build it.
+// This directory builds the code for the "Core API" part of the
+// Panda3D browser plugin system.  Most Panda3D developers will have
+// no need to build this, unless you are developing the plugin system
+// itself.  Define HAVE_P3D_PLUGIN in your Config.pp to build this
+// directory.
+
 #define BUILD_DIRECTORY $[HAVE_P3D_PLUGIN]
 
 #begin lib_target

+ 6 - 2
direct/src/plugin_activex/Sources.pp

@@ -1,5 +1,9 @@
-// This directory is still experimental.  Define HAVE_P3D_PLUGIN in
-// your Config.pp to build it.
+// This directory builds the code for the ActiveX (Internet Explorer)
+// plugin, part of the Panda3D browser plugin system.  Most Panda3D
+// developers will have no need to build this, unless you are
+// developing the plugin system itself.  Define HAVE_P3D_PLUGIN in
+// your Config.pp to build this directory.
+
 #define BUILD_DIRECTORY $[and $[HAVE_P3D_PLUGIN],$[HAVE_TINYXML],$[WINDOWS_PLATFORM]]
 
 #define USE_PACKAGES tinyxml

+ 11 - 5
direct/src/plugin_npapi/Sources.pp

@@ -1,12 +1,18 @@
-// This directory is still experimental.  Define HAVE_P3D_PLUGIN in
-// your Config.pp to build it.
-#define BUILD_DIRECTORY $[and $[HAVE_P3D_PLUGIN],$[HAVE_NPAPI]]
+// This directory builds the code for the NPAPI (Mozilla) plugin, part
+// of the Panda3D browser plugin system.  Most Panda3D developers will
+// have no need to build this, unless you are developing the plugin
+// system itself.  Define HAVE_P3D_PLUGIN in your Config.pp to build
+// this directory.
 
-#define USE_PACKAGES npapi
+#define BUILD_DIRECTORY $[and $[HAVE_P3D_PLUGIN],$[HAVE_TINYXML],$[HAVE_NPAPI]]
+
+#define USE_PACKAGES tinyxml npapi
 
 #begin lib_target
   // By Mozilla convention, on Windows at least, the generated DLL
-  // filename must begin with "np", not "libnp".
+  // filename must begin with "np", not "libnp".  (Actually, this is
+  // probably no longer true on recent versions of Mozilla.  But why
+  // take chances?)
   #define TARGET nppanda3d
   #define LIB_PREFIX