mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 09:23:03 -04:00
protect from builds without net or openssl
This commit is contained in:
parent
9b32060d7c
commit
f17536da77
@ -28,11 +28,13 @@ else:
|
|||||||
# Otherwise, we can import the VFSImporter normally. We have to
|
# Otherwise, we can import the VFSImporter normally. We have to
|
||||||
# import PandaModules first, to get the funny renaming with
|
# import PandaModules first, to get the funny renaming with
|
||||||
# pandaexpress.
|
# pandaexpress.
|
||||||
|
import direct
|
||||||
from pandac import PandaModules
|
from pandac import PandaModules
|
||||||
from direct.showbase import VFSImporter
|
from direct.showbase import VFSImporter
|
||||||
|
|
||||||
from direct.showbase.DirectObject import DirectObject
|
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.stdpy import file
|
||||||
from direct.task.TaskManagerGlobal import taskMgr
|
from direct.task.TaskManagerGlobal import taskMgr
|
||||||
from direct.showbase.MessengerGlobal import messenger
|
from direct.showbase.MessengerGlobal import messenger
|
||||||
@ -88,7 +90,10 @@ class AppRunner(DirectObject):
|
|||||||
self.started = False
|
self.started = False
|
||||||
self.windowOpened = False
|
self.windowOpened = False
|
||||||
self.windowPrc = None
|
self.windowPrc = None
|
||||||
self.http = HTTPClient.getGlobalPtr()
|
|
||||||
|
self.http = None
|
||||||
|
if hasattr(PandaModules, 'HTTPClient'):
|
||||||
|
self.http = PandaModules.HTTPClient.getGlobalPtr()
|
||||||
|
|
||||||
self.Undefined = Undefined
|
self.Undefined = Undefined
|
||||||
self.ConcreteStruct = ConcreteStruct
|
self.ConcreteStruct = ConcreteStruct
|
||||||
@ -332,8 +337,10 @@ class AppRunner(DirectObject):
|
|||||||
# It's good, keep it.
|
# It's good, keep it.
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
assert self.http
|
||||||
|
|
||||||
# It's stale, get a new one.
|
# It's stale, get a new one.
|
||||||
url = URLSpec(host.hostUrlPrefix + fileSpec.filename)
|
url = PandaModules.URLSpec(host.hostUrlPrefix + fileSpec.filename)
|
||||||
print "Freshening %s" % (url)
|
print "Freshening %s" % (url)
|
||||||
doc = self.http.getDocument(url)
|
doc = self.http.getDocument(url)
|
||||||
if not doc.isValid():
|
if not doc.isValid():
|
||||||
@ -583,7 +590,7 @@ class AppRunner(DirectObject):
|
|||||||
self.allowPythonDev = False
|
self.allowPythonDev = False
|
||||||
|
|
||||||
i = mf.findSubfile('p3d_info.xml')
|
i = mf.findSubfile('p3d_info.xml')
|
||||||
if i >= 0:
|
if i >= 0 and hasattr(PandaModules, 'readXmlStream'):
|
||||||
stream = mf.openReadSubfile(i)
|
stream = mf.openReadSubfile(i)
|
||||||
self.p3dInfo = readXmlStream(stream)
|
self.p3dInfo = readXmlStream(stream)
|
||||||
mf.closeReadSubfile(stream)
|
mf.closeReadSubfile(stream)
|
||||||
|
@ -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.PackageInfo import PackageInfo
|
||||||
from direct.p3d.FileSpec import FileSpec
|
from direct.p3d.FileSpec import FileSpec
|
||||||
import time
|
import time
|
||||||
@ -78,6 +79,7 @@ class HostInfo:
|
|||||||
# We've already got one.
|
# We've already got one.
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
if http:
|
||||||
url = self.hostUrlPrefix + 'contents.xml'
|
url = self.hostUrlPrefix + 'contents.xml'
|
||||||
# Append a uniquifying query string to the URL to force the
|
# Append a uniquifying query string to the URL to force the
|
||||||
# download to go all the way through any caches. We use 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')
|
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():
|
if not doc.LoadFile():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -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.p3d.FileSpec import FileSpec
|
||||||
from direct.showbase import VFSImporter
|
from direct.showbase import VFSImporter
|
||||||
import os
|
import os
|
||||||
@ -221,7 +222,9 @@ class PackageInfo:
|
|||||||
|
|
||||||
filename = Filename(self.packageDir, self.descFileBasename)
|
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():
|
if not doc.LoadFile():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -683,7 +686,7 @@ class PackageInfo:
|
|||||||
result = Filename.temporary('', 'patch_')
|
result = Filename.temporary('', 'patch_')
|
||||||
print "Patching %s with %s" % (origPathname, patchPathname)
|
print "Patching %s with %s" % (origPathname, patchPathname)
|
||||||
|
|
||||||
p = Patchfile() # The C++ class
|
p = PandaModules.Patchfile() # The C++ class
|
||||||
|
|
||||||
ret = p.initiate(patchPathname, origPathname, result)
|
ret = p.initiate(patchPathname, origPathname, result)
|
||||||
if ret == EUSuccess:
|
if ret == EUSuccess:
|
||||||
|
@ -56,6 +56,16 @@ def parseSysArgs():
|
|||||||
|
|
||||||
return [arg0] + args[1:]
|
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__':
|
if __name__ == '__main__':
|
||||||
runner = AppRunner()
|
runner = AppRunner()
|
||||||
runner.gotWindow = True
|
runner.gotWindow = True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user