From 81801654a2941303d2e7c07a0a3490d75b77b039 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 8 Aug 2015 12:43:58 +0200 Subject: [PATCH 01/10] Fix finding extension modules ending in "module.so" with the VFS importer --- direct/src/showbase/VFSImporter.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/direct/src/showbase/VFSImporter.py b/direct/src/showbase/VFSImporter.py index 6f8c76266f..31dd83523b 100644 --- a/direct/src/showbase/VFSImporter.py +++ b/direct/src/showbase/VFSImporter.py @@ -76,8 +76,7 @@ class VFSImporter: if desc[2] != imp.C_EXTENSION: continue - filename = Filename(path) - filename.setExtension(desc[0][1:]) + filename = Filename(path + desc[0]) vfile = vfs.getFile(filename, True) if vfile: return VFSLoader(dir_path, vfile, filename, FTExtensionModule, From 85e3d2ee3a2112eed8245e2ed58ff32899bade1a Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 9 Aug 2015 13:10:20 +0200 Subject: [PATCH 02/10] Don't override host URL when building CMU runtime distribution --- makepanda/makepanda.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index ca941bfdde..f72103f017 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -460,9 +460,8 @@ SdkAutoDisableMax() SdkAutoDisablePhysX() SdkAutoDisableSpeedTree() -if (RTDIST and DISTRIBUTOR == "cmu"): - HOST_URL = "https://runtime.panda3d.org/" - +if RTDIST and DISTRIBUTOR == "cmu": + # Some validation checks for the CMU builds. if (RTDIST_VERSION == "cmu_1.7" and SDK["PYTHONVERSION"] != "python2.6"): exit("The CMU 1.7 runtime distribution must be built against Python 2.6!") elif (RTDIST_VERSION == "cmu_1.8" and SDK["PYTHONVERSION"] != "python2.7"): @@ -470,7 +469,7 @@ if (RTDIST and DISTRIBUTOR == "cmu"): elif (RTDIST_VERSION == "cmu_1.9" and SDK["PYTHONVERSION"] != "python2.7"): exit("The CMU 1.9 runtime distribution must be built against Python 2.7!") -elif RTDIST and not HOST_URL: +if RTDIST and not HOST_URL: exit("You must specify a host URL when building the rtdist!") if RUNTIME and not HOST_URL: From 9dc1a0cbad748599950c7fc047dc004e99d0e7a4 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 9 Aug 2015 19:07:24 +0200 Subject: [PATCH 03/10] Backward compatibility hack so that older runtime versions will still be able to use 1.9 rtdist --- direct/src/plugin/p3dInstanceManager.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/direct/src/plugin/p3dInstanceManager.cxx b/direct/src/plugin/p3dInstanceManager.cxx index b5536b8836..793e6cf36e 100644 --- a/direct/src/plugin/p3dInstanceManager.cxx +++ b/direct/src/plugin/p3dInstanceManager.cxx @@ -258,14 +258,22 @@ initialize(int api_version, const string &contents_filename, // TODO: Linux multiplatform support. Just add the // appropriate platform strings to _supported_platforms. + } else { + nout << "Platform string was set by plugin to " << _platform << "\n"; } if (_supported_platforms.empty()) { + // Hack for older plug-ins, which should still remain compatible with + // newer versions of the runtime distribution. + if (_platform == "win32") { + _supported_platforms.push_back("win_i386"); + } + // We always support at least the specific platform on which we're // running. _supported_platforms.push_back(_platform); } - + #ifdef P3D_PLUGIN_LOG_DIRECTORY if (_log_directory.empty()) { _log_directory = P3D_PLUGIN_LOG_DIRECTORY; From 1e870b3c1c32893c11d00409e89575067906df0c Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 9 Aug 2015 22:16:59 +0200 Subject: [PATCH 04/10] Automatically create win32 alias for coreapi package for backward compatibility with older runtimes --- direct/src/p3d/Packager.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/direct/src/p3d/Packager.py b/direct/src/p3d/Packager.py index 36883ceb52..d0c009a206 100644 --- a/direct/src/p3d/Packager.py +++ b/direct/src/p3d/Packager.py @@ -16,6 +16,7 @@ import getpass import platform import struct import subprocess +import copy from direct.p3d.FileSpec import FileSpec from direct.p3d.SeqValue import SeqValue from direct.showbase import Loader @@ -839,6 +840,14 @@ class Packager: self.packager.contents[pe.getKey()] = pe self.packager.contentsChanged = True + # Hack for coreapi package, to preserve backward compatibility + # with old versions of the runtime, which still called the + # 32-bit Windows platform "win32". + if self.packageName == "coreapi" and self.platform == "win_i386": + pe2 = copy.copy(pe) + pe2.platform = "win32" + self.packager.contents[pe2.getKey()] = pe2 + self.cleanup() return True From 369305c529572f8936d59f57a028e8305de6c3dd Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 9 Aug 2015 22:26:25 +0200 Subject: [PATCH 05/10] Prevent having to relink most of pandatool when version info changes --- pandatool/src/progbase/programBase.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pandatool/src/progbase/programBase.cxx b/pandatool/src/progbase/programBase.cxx index 94bcb0e13b..a9b7c666bf 100644 --- a/pandatool/src/progbase/programBase.cxx +++ b/pandatool/src/progbase/programBase.cxx @@ -27,7 +27,7 @@ #include "configVariableBool.h" #include "panda_getopt_long.h" #include "preprocess_argv.h" -#include "pandaVersion.h" +#include "pandaSystem.h" #include #include @@ -222,7 +222,8 @@ write_man_page(ostream &out) { } } - out << " 1 \"" << date_str << "\" \"" PANDA_VERSION_STR "\" Panda3D\n"; + out << " 1 \"" << date_str << "\" \"" + << PandaSystem::get_version_string() << "\" Panda3D\n"; out << ".SH NAME\n"; if (_brief.empty()) { From 12af94707fe4ab7e55f0e52ed262f6b45aeec5ed Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 10 Aug 2015 01:53:16 +0200 Subject: [PATCH 06/10] Fix cloggage of the pipe communicating with the forked X11 splash window subprocess --- direct/src/plugin/p3dX11SplashWindow.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/direct/src/plugin/p3dX11SplashWindow.cxx b/direct/src/plugin/p3dX11SplashWindow.cxx index f1afc5a15b..513458521e 100644 --- a/direct/src/plugin/p3dX11SplashWindow.cxx +++ b/direct/src/plugin/p3dX11SplashWindow.cxx @@ -681,10 +681,13 @@ subprocess_run() { } } - if (input_ready) { + do { + // Empty the pipe of whatever is in it. receive_command(); - } + input_ready = _pipe_read.has_gdata(); + } while (input_ready); + // Sleep a good amount in order not to lock up the system. struct timespec req; req.tv_sec = 0; req.tv_nsec = 50000000; // 50 ms From 2abc51d88faa17ccb6d0e805522993ba01da60b1 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 10 Aug 2015 01:57:00 +0200 Subject: [PATCH 07/10] Allow specifying contents of .py modules with file(text=...) in pdef --- direct/src/p3d/Packager.py | 5 ++++- direct/src/showutil/FreezeTool.py | 20 +++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/direct/src/p3d/Packager.py b/direct/src/p3d/Packager.py index d0c009a206..40c30d8485 100644 --- a/direct/src/p3d/Packager.py +++ b/direct/src/p3d/Packager.py @@ -1841,7 +1841,10 @@ class Packager: self.notify.warning(message) return - self.freezer.addModule(moduleName, filename = file.filename) + if file.text: + self.freezer.addModule(moduleName, filename = file.filename, text = file.text) + else: + self.freezer.addModule(moduleName, filename = file.filename) def addEggFile(self, file): # Precompile egg files to bam's. diff --git a/direct/src/showutil/FreezeTool.py b/direct/src/showutil/FreezeTool.py index 28c622a9be..68a6eff60a 100644 --- a/direct/src/showutil/FreezeTool.py +++ b/direct/src/showutil/FreezeTool.py @@ -8,6 +8,7 @@ import marshal import imp import platform import types +from StringIO import StringIO from distutils.sysconfig import PREFIX, get_python_inc, get_python_version # Temporary (?) try..except to protect against unbuilt p3extend_frozen. @@ -499,7 +500,8 @@ class Freezer: def __init__(self, moduleName, filename = None, implicit = False, guess = False, exclude = False, forbid = False, - allowChildren = False, fromSource = None): + allowChildren = False, fromSource = None, + text = None): # The Python module name. self.moduleName = moduleName @@ -534,6 +536,9 @@ class Freezer: # record came from, supplied by the caller. self.fromSource = fromSource + # If this is set, it contains Python code of the module. + self.text = text + # Some sanity checks. if not self.exclude: self.allowChildren = True @@ -750,7 +755,8 @@ class Freezer: return modules def addModule(self, moduleName, implicit = False, newName = None, - filename = None, guess = False, fromSource = None): + filename = None, guess = False, fromSource = None, + text = None): """ Adds a module to the list of modules to be exported by this tool. If implicit is true, it is OK if the module does not actually exist. @@ -806,7 +812,7 @@ class Freezer: # It's actually a regular module. self.modules[newParentName] = self.ModuleDef( parentName, implicit = implicit, guess = guess, - fromSource = fromSource) + fromSource = fromSource, text = text) else: # Now get all the py files in the parent directory. @@ -821,7 +827,7 @@ class Freezer: # A normal, explicit module name. self.modules[newName] = self.ModuleDef( moduleName, filename = filename, implicit = implicit, - guess = guess, fromSource = fromSource) + guess = guess, fromSource = fromSource, text = text) def done(self, compileToExe = False): """ Call this method after you have added all modules with @@ -972,7 +978,11 @@ class Freezer: stuff = ("", "rb", imp.PY_COMPILED) self.mf.load_module(mdef.moduleName, fp, pathname, stuff) else: - fp = open(pathname, modulefinder.READ_MODE) + fp = open(pathname, 'U') + if mdef.text: + fp = StringIO(mdef.text) + else: + fp = open(pathname, modulefinder.READ_MODE) stuff = ("", "r", imp.PY_SOURCE) self.mf.load_module(mdef.moduleName, fp, pathname, stuff) From 03e377091da4e8d2712ce4cdfb3b28c6e189998a Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 10 Aug 2015 02:01:52 +0200 Subject: [PATCH 08/10] Add in 'rocket' module for rocket package --- direct/src/p3d/panda3d.pdef | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/direct/src/p3d/panda3d.pdef b/direct/src/p3d/panda3d.pdef index 4f3df21c97..87a42eff2b 100644 --- a/direct/src/p3d/panda3d.pdef +++ b/direct/src/p3d/panda3d.pdef @@ -362,8 +362,16 @@ class rocket(package): config(display_name = "Panda3D libRocket support") require('panda3d') - module('panda3d.rocket', required = True) - module('_rocketcore', '_rocketcontrols') + file('rocket.py', extract = True, text = """ +from _rocketcore import * +try: + from _rocketcontrols import * +except ImportError: + pass +""") + + module('panda3d.rocket', '_rocketcore', required = True) + module('_rocketcontrols') file('libp3rocket.dll', required = True) class vrpn(package): From caf986fa2ab7de5e835b3b95f2a74cff8385c1b5 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 10 Aug 2015 02:48:53 +0200 Subject: [PATCH 09/10] Fix uninitialized variable that would sometimes prevent mouse movement from being registered by libRocket --- panda/src/rocket/rocketInputHandler.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/panda/src/rocket/rocketInputHandler.cxx b/panda/src/rocket/rocketInputHandler.cxx index 71ea099192..c0a4e22464 100644 --- a/panda/src/rocket/rocketInputHandler.cxx +++ b/panda/src/rocket/rocketInputHandler.cxx @@ -34,6 +34,8 @@ TypeHandle RocketInputHandler::_type_handle; RocketInputHandler:: RocketInputHandler(const string &name) : DataNode(name), + _mouse_xy(-1), + _mouse_xy_changed(false), _modifiers(0), _wheel_delta(0) { From d74f02819861183d163bc7580d87a62b12efa3d7 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 10 Aug 2015 04:00:41 +0200 Subject: [PATCH 10/10] Linux splash window shouldn't block waiting for pipe activity --- direct/src/plugin/p3dX11SplashWindow.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/direct/src/plugin/p3dX11SplashWindow.cxx b/direct/src/plugin/p3dX11SplashWindow.cxx index 513458521e..76c0175a18 100644 --- a/direct/src/plugin/p3dX11SplashWindow.cxx +++ b/direct/src/plugin/p3dX11SplashWindow.cxx @@ -681,11 +681,11 @@ subprocess_run() { } } - do { + while (input_ready) { // Empty the pipe of whatever is in it. receive_command(); input_ready = _pipe_read.has_gdata(); - } while (input_ready); + } // Sleep a good amount in order not to lock up the system. struct timespec req;