Browse Source

more tweaks and fixes

David Rose 16 years ago
parent
commit
aefb14e678
3 changed files with 19 additions and 16 deletions
  1. 4 1
      direct/src/p3d/AppRunner.py
  2. 13 13
      direct/src/p3d/Packager.py
  3. 2 2
      direct/src/showbase/ShowBase.py

+ 4 - 1
direct/src/p3d/AppRunner.py

@@ -340,7 +340,10 @@ class AppRunner(DirectObject):
         if not platform:
         if not platform:
             platform = None
             platform = None
         package = host.getPackage(name, version, platform = platform)
         package = host.getPackage(name, version, platform = platform)
-        assert package
+        if not package:
+            print "Couldn't find %s %s on %s" % (name, version, hostUrl)
+            return
+
         self.installedPackages.append(package)
         self.installedPackages.append(package)
 
 
         if package.checkStatus():
         if package.checkStatus():

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

@@ -2034,20 +2034,20 @@ class Packager:
         named package also.  Files already included in the named
         named package also.  Files already included in the named
         package will be omitted from this one when building it. """
         package will be omitted from this one when building it. """
 
 
-        if not self.currentPackage:
-            raise OutsideOfPackageError
+        self.requirePackagesNamed(args, **kw)
+
+    def requirePackagesNamed(self, names, version = None, host = None):
+        """ Indicates a dependency on the named package(s), supplied
+        as a name.
 
 
-        version = kw.get('version', None)
-        host = kw.get('host', None)
+        Attempts to install this package will implicitly install the
+        named package also.  Files already included in the named
+        package will be omitted from this one when building it. """
 
 
-        for key in ['version', 'host']:
-            if key in kw:
-                del kw['version']
-        if kw:
-            message = "do_require() got an unexpected keyword argument '%s'" % (kw.keys()[0])
-            raise TypeError, message
+        if not self.currentPackage:
+            raise OutsideOfPackageError
 
 
-        for packageName in args:
+        for packageName in names:
             # A special case when requiring the "panda3d" package.  We
             # A special case when requiring the "panda3d" package.  We
             # supply the version number what we've been compiled with as a
             # supply the version number what we've been compiled with as a
             # default.
             # default.
@@ -2083,9 +2083,9 @@ class Packager:
         # compiled with.
         # compiled with.
         if package.packageName == 'panda3d':
         if package.packageName == 'panda3d':
             if package.version != PandaSystem.getPackageVersionString():
             if package.version != PandaSystem.getPackageVersionString():
-                self.notify.warning("Requiring panda3d version %s, which does not match the current build of Panda, which is version %s." % (package, PandaSystem.getPackageVersionString()))
+                self.notify.warning("Requiring panda3d version %s, which does not match the current build of Panda, which is version %s." % (package.version, PandaSystem.getPackageVersionString()))
             elif package.host != PandaSystem.getPackageHostUrl():
             elif package.host != PandaSystem.getPackageHostUrl():
-                self.notify.warning("Requiring panda3d host %s, which does not match the current build of Panda, which is host %s." % (package, PandaSystem.getPackageHostUrl()))
+                self.notify.warning("Requiring panda3d host %s, which does not match the current build of Panda, which is host %s." % (package.host, PandaSystem.getPackageHostUrl()))
 
 
         self.currentPackage.requirePackage(package)
         self.currentPackage.requirePackage(package)
 
 

+ 2 - 2
direct/src/showbase/ShowBase.py

@@ -2438,14 +2438,14 @@ class ShowBase(DirectObject.DirectObject):
     def startWx(self, fWantWx = 1):
     def startWx(self, fWantWx = 1):
         self.wantWx = fWantWx
         self.wantWx = fWantWx
         if self.wantWx:
         if self.wantWx:
-            import WxGlobal
+            from direct.showbase import WxGlobal
             taskMgr.remove('wxLoop')
             taskMgr.remove('wxLoop')
             WxGlobal.spawnWxLoop()
             WxGlobal.spawnWxLoop()
 
 
     def startTk(self, fWantTk = 1):
     def startTk(self, fWantTk = 1):
         self.wantTk = fWantTk
         self.wantTk = fWantTk
         if self.wantTk:
         if self.wantTk:
-            import TkGlobal
+            from direct.showbase import TkGlobal
             taskMgr.remove('tkLoop')
             taskMgr.remove('tkLoop')
             TkGlobal.spawnTkLoop()
             TkGlobal.spawnTkLoop()