Browse Source

HAVE_P3D_RTDIST, allow development without PANDA_PACKAGE_HOST_URL

David Rose 15 years ago
parent
commit
44df8cc6a6
4 changed files with 22 additions and 13 deletions
  1. 11 2
      direct/src/p3d/AppRunner.py
  2. 1 0
      direct/src/p3d/HostInfo.py
  3. 1 1
      direct/src/p3d/Packager.py
  4. 9 10
      direct/src/plugin/Sources.pp

+ 11 - 2
direct/src/p3d/AppRunner.py

@@ -158,6 +158,9 @@ class AppRunner(DirectObject):
         self.altHost = None
         self.altHostMap = {}
 
+        # The URL from which Panda itself should be downloaded.
+        self.pandaHostUrl = PandaSystem.getPackageHostUrl()
+
         # Application code can assign a callable object here; if so,
         # it will be invoked when an uncaught exception propagates to
         # the top of the TaskMgr.run() loop.
@@ -320,7 +323,7 @@ class AppRunner(DirectObject):
         testing. """
 
         if hostUrl is None:
-            hostUrl = PandaSystem.getPackageHostUrl()
+            hostUrl = self.pandaHostUrl
 
         altUrl = self.altHostMap.get(hostUrl, None)
         if altUrl:
@@ -355,7 +358,7 @@ class AppRunner(DirectObject):
         from, see getHostWithAlt().  """
 
         if not hostUrl:
-            hostUrl = PandaSystem.getPackageHostUrl()
+            hostUrl = self.pandaHostUrl
 
         host = self.hosts.get(hostUrl, None)
         if not host:
@@ -811,6 +814,12 @@ class AppRunner(DirectObject):
             message = "Host %s cannot be downloaded, cannot preload %s." % (hostUrl, name)
             raise OSError, message
 
+        if name == 'panda3d' and not self.pandaHostUrl:
+            # A special case: in case we don't have the PackageHostUrl
+            # compiled in, infer it from the first package we
+            # installed named "panda3d".
+            self.pandaHostUrl = hostUrl
+
         if not platform:
             platform = None
         package = host.getPackage(name, version, platform = platform)

+ 1 - 0
direct/src/p3d/HostInfo.py

@@ -599,6 +599,7 @@ class HostInfo:
         # it more likely that our hash code will exactly match the
         # similar logic in P3DHost.
         p = hostUrl.find('://')
+        hostname = ''
         if p != -1:
             start = p + 3
             end = hostUrl.find('/', start)

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

@@ -2226,7 +2226,7 @@ class Packager:
             self.allowPackages = False
 
         if not PandaSystem.getPackageVersionString() or not PandaSystem.getPackageHostUrl():
-            raise PackagerError, 'This script must be run using a version of Panda3D that has been built\nfor distribution.  Try using ppackage.p3d or packp3d.p3d instead.'
+            raise PackagerError, 'This script must be run using a version of Panda3D that has been built\nfor distribution.  Try using ppackage.p3d or packp3d.p3d instead.\nIf you are running this script for development purposes, you may also\nset the Config variable panda-package-host-url to the URL you expect\nto download these contents from (for instance, a file:// URL).'
 
         self.readContentsFile()
 

+ 9 - 10
direct/src/plugin/Sources.pp

@@ -5,13 +5,13 @@
 // plugin system itself.
 
 // This directory also contains the code for p3dpython.exe, which is
-// part of the Panda3D plugin runtime.  It's not strictly part of the
+// part of the Panda3D rtdist build.  It's not strictly part of the
 // "Core API"; it is packaged as part of each downloadable version of
-// Panda3D.  It is only built if you have defined
-// PANDA_PACKAGE_HOST_URL in your Config.pp, which indicates an
-// intention to build a downloadable version of Panda3D.  Developers
-// who are preparing a custom Panda3D package for download by the
-// plugin will need to build this.
+// Panda3D.  It is only built if you have defined either
+// PANDA_PACKAGE_HOST_URL or HAVE_P3D_RTDIST in your Config.pp, which
+// indicates an intention to build a downloadable version of Panda3D.
+// Developers who are preparing a custom Panda3D package for download
+// by the plugin will need to build this.
 
 // If P3D_PLUGIN_MT is defined, then (on Windows) /MT is used to
 // compile the core API and the NPAPI and ActiveX plugins, instead of
@@ -220,7 +220,7 @@
 // to invoke a particular instance of Panda.
 //
 
-  #define BUILD_TARGET $[and $[HAVE_P3D_PLUGIN],$[HAVE_PYTHON],$[HAVE_OPENSSL]]
+  #define BUILD_TARGET $[and $[HAVE_P3D_RTDIST],$[HAVE_PYTHON],$[HAVE_OPENSSL]]
   #define USE_PACKAGES python openssl cg
   #define TARGET p3dpython
 
@@ -269,7 +269,7 @@
 // the desktop.)
 //
 
-  #define BUILD_TARGET $[and $[HAVE_P3D_PLUGIN],$[HAVE_PYTHON],$[HAVE_OPENSSL],$[WINDOWS_PLATFORM]]
+  #define BUILD_TARGET $[and $[HAVE_P3D_RTDIST],$[HAVE_PYTHON],$[HAVE_OPENSSL],$[WINDOWS_PLATFORM]]
   #define USE_PACKAGES python openssl
   #define TARGET p3dpythonw
   #define EXTRA_CDEFS NON_CONSOLE
@@ -315,8 +315,7 @@
 // the parent (browser) process, instead of forking a child, as a
 // desparation fallback in case forking fails for some reason.
 //
-
-  #define BUILD_TARGET $[and $[HAVE_P3D_PLUGIN],$[HAVE_PYTHON],$[HAVE_OPENSSL]]
+  #define BUILD_TARGET $[and $[HAVE_P3D_RTDIST],$[HAVE_PYTHON],$[HAVE_OPENSSL]]
   #define USE_PACKAGES python openssl cg
   #define TARGET libp3dpython
   #define LIB_PREFIX