HAVE_P3D_RTDIST, allow development without PANDA_PACKAGE_HOST_URL

This commit is contained in:
David Rose 2010-06-11 19:04:47 +00:00
parent 54dd2108d5
commit 44df8cc6a6
4 changed files with 22 additions and 13 deletions

View File

@ -158,6 +158,9 @@ class AppRunner(DirectObject):
self.altHost = None self.altHost = None
self.altHostMap = {} 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, # Application code can assign a callable object here; if so,
# it will be invoked when an uncaught exception propagates to # it will be invoked when an uncaught exception propagates to
# the top of the TaskMgr.run() loop. # the top of the TaskMgr.run() loop.
@ -320,7 +323,7 @@ class AppRunner(DirectObject):
testing. """ testing. """
if hostUrl is None: if hostUrl is None:
hostUrl = PandaSystem.getPackageHostUrl() hostUrl = self.pandaHostUrl
altUrl = self.altHostMap.get(hostUrl, None) altUrl = self.altHostMap.get(hostUrl, None)
if altUrl: if altUrl:
@ -355,7 +358,7 @@ class AppRunner(DirectObject):
from, see getHostWithAlt(). """ from, see getHostWithAlt(). """
if not hostUrl: if not hostUrl:
hostUrl = PandaSystem.getPackageHostUrl() hostUrl = self.pandaHostUrl
host = self.hosts.get(hostUrl, None) host = self.hosts.get(hostUrl, None)
if not host: if not host:
@ -811,6 +814,12 @@ class AppRunner(DirectObject):
message = "Host %s cannot be downloaded, cannot preload %s." % (hostUrl, name) message = "Host %s cannot be downloaded, cannot preload %s." % (hostUrl, name)
raise OSError, message 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: if not platform:
platform = None platform = None
package = host.getPackage(name, version, platform = platform) package = host.getPackage(name, version, platform = platform)

View File

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

View File

@ -2226,7 +2226,7 @@ class Packager:
self.allowPackages = False self.allowPackages = False
if not PandaSystem.getPackageVersionString() or not PandaSystem.getPackageHostUrl(): 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() self.readContentsFile()

View File

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