From 44df8cc6a6c378132c7e3da2dc2874d2cef5718b Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 11 Jun 2010 19:04:47 +0000 Subject: [PATCH] HAVE_P3D_RTDIST, allow development without PANDA_PACKAGE_HOST_URL --- direct/src/p3d/AppRunner.py | 13 +++++++++++-- direct/src/p3d/HostInfo.py | 1 + direct/src/p3d/Packager.py | 2 +- direct/src/plugin/Sources.pp | 19 +++++++++---------- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/direct/src/p3d/AppRunner.py b/direct/src/p3d/AppRunner.py index 8a70cb2563..0b3a3b8812 100644 --- a/direct/src/p3d/AppRunner.py +++ b/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) diff --git a/direct/src/p3d/HostInfo.py b/direct/src/p3d/HostInfo.py index 0669f8c621..b377ca2bc6 100644 --- a/direct/src/p3d/HostInfo.py +++ b/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) diff --git a/direct/src/p3d/Packager.py b/direct/src/p3d/Packager.py index 8fd58744b6..e66346c603 100644 --- a/direct/src/p3d/Packager.py +++ b/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() diff --git a/direct/src/plugin/Sources.pp b/direct/src/plugin/Sources.pp index c03c821f7e..bdae4e5324 100644 --- a/direct/src/plugin/Sources.pp +++ b/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