protect from builds without net or openssl

This commit is contained in:
David Rose 2009-10-13 18:56:17 +00:00
parent 9b32060d7c
commit f17536da77
4 changed files with 50 additions and 25 deletions

View File

@ -28,11 +28,13 @@ else:
# Otherwise, we can import the VFSImporter normally. We have to
# import PandaModules first, to get the funny renaming with
# pandaexpress.
import direct
from pandac import PandaModules
from direct.showbase import VFSImporter
from direct.showbase.DirectObject import DirectObject
from pandac.PandaModules import VirtualFileSystem, Filename, Multifile, loadPrcFileData, unloadPrcFile, getModelPath, HTTPClient, Thread, WindowProperties, readXmlStream, ExecutionEnvironment, PandaSystem, URLSpec, Notify, StreamWriter, ConfigVariableString
from pandac.PandaModules import VirtualFileSystem, Filename, Multifile, loadPrcFileData, unloadPrcFile, getModelPath, Thread, WindowProperties, ExecutionEnvironment, PandaSystem, Notify, StreamWriter, ConfigVariableString
from pandac import PandaModules
from direct.stdpy import file
from direct.task.TaskManagerGlobal import taskMgr
from direct.showbase.MessengerGlobal import messenger
@ -88,7 +90,10 @@ class AppRunner(DirectObject):
self.started = False
self.windowOpened = False
self.windowPrc = None
self.http = HTTPClient.getGlobalPtr()
self.http = None
if hasattr(PandaModules, 'HTTPClient'):
self.http = PandaModules.HTTPClient.getGlobalPtr()
self.Undefined = Undefined
self.ConcreteStruct = ConcreteStruct
@ -332,8 +337,10 @@ class AppRunner(DirectObject):
# It's good, keep it.
return True
assert self.http
# It's stale, get a new one.
url = URLSpec(host.hostUrlPrefix + fileSpec.filename)
url = PandaModules.URLSpec(host.hostUrlPrefix + fileSpec.filename)
print "Freshening %s" % (url)
doc = self.http.getDocument(url)
if not doc.isValid():
@ -583,7 +590,7 @@ class AppRunner(DirectObject):
self.allowPythonDev = False
i = mf.findSubfile('p3d_info.xml')
if i >= 0:
if i >= 0 and hasattr(PandaModules, 'readXmlStream'):
stream = mf.openReadSubfile(i)
self.p3dInfo = readXmlStream(stream)
mf.closeReadSubfile(stream)

View File

@ -1,4 +1,5 @@
from pandac.PandaModules import TiXmlDocument, HashVal, Filename, PandaSystem, DocumentSpec, Ramfile
from pandac.PandaModules import HashVal, Filename, PandaSystem, DocumentSpec, Ramfile
from pandac import PandaModules
from direct.p3d.PackageInfo import PackageInfo
from direct.p3d.FileSpec import FileSpec
import time
@ -78,6 +79,7 @@ class HostInfo:
# We've already got one.
return True
if http:
url = self.hostUrlPrefix + 'contents.xml'
# Append a uniquifying query string to the URL to force the
# download to go all the way through any caches. We use the
@ -150,7 +152,10 @@ class HostInfo:
filename = Filename(self.hostDir, 'contents.xml')
doc = TiXmlDocument(filename.toOsSpecific())
if not hasattr(PandaModules, 'TiXmlDocument'):
return False
doc = PandaModules.TiXmlDocument(filename.toOsSpecific())
if not doc.LoadFile():
return False

View File

@ -1,4 +1,5 @@
from pandac.PandaModules import Filename, URLSpec, DocumentSpec, Ramfile, TiXmlDocument, Multifile, Decompressor, EUOk, EUSuccess, VirtualFileSystem, Thread, getModelPath, Patchfile, ExecutionEnvironment
from pandac.PandaModules import Filename, URLSpec, DocumentSpec, Ramfile, Multifile, Decompressor, EUOk, EUSuccess, VirtualFileSystem, Thread, getModelPath, ExecutionEnvironment
from pandac import PandaModules
from direct.p3d.FileSpec import FileSpec
from direct.showbase import VFSImporter
import os
@ -221,7 +222,9 @@ class PackageInfo:
filename = Filename(self.packageDir, self.descFileBasename)
doc = TiXmlDocument(filename.toOsSpecific())
if not hasattr(PandaModules, 'TiXmlDocument'):
return False
doc = PandaModules.TiXmlDocument(filename.toOsSpecific())
if not doc.LoadFile():
return False
@ -683,7 +686,7 @@ class PackageInfo:
result = Filename.temporary('', 'patch_')
print "Patching %s with %s" % (origPathname, patchPathname)
p = Patchfile() # The C++ class
p = PandaModules.Patchfile() # The C++ class
ret = p.initiate(patchPathname, origPathname, result)
if ret == EUSuccess:

View File

@ -56,6 +56,16 @@ def parseSysArgs():
return [arg0] + args[1:]
def runPackedApp(pathname):
runner = AppRunner()
runner.gotWindow = True
try:
runner.setP3DFilename(pathname, tokens = [], argv = [],
instanceId = 0, interactiveConsole = False)
except ArgumentError, e:
print e.args[0]
sys.exit(1)
if __name__ == '__main__':
runner = AppRunner()
runner.gotWindow = True