From 57ff1a5441c9fa9f74dd2b4dc96e5b9c52feb7d7 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 3 Sep 2019 12:15:02 +0200 Subject: [PATCH 1/6] interrogate: remove vestigial code causing assert for C bindings Fixes #722 --- dtool/src/interrogate/interrogateBuilder.cxx | 32 +++----------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/dtool/src/interrogate/interrogateBuilder.cxx b/dtool/src/interrogate/interrogateBuilder.cxx index 7473d085d3..4735157d1d 100644 --- a/dtool/src/interrogate/interrogateBuilder.cxx +++ b/dtool/src/interrogate/interrogateBuilder.cxx @@ -2038,33 +2038,11 @@ get_make_property(CPPMakeProperty *make_property, CPPStructType *struct_type, CP iproperty._length_function = length_function; } - if (make_property->_type == CPPMakeProperty::T_normal) { - if (getter != nullptr) { - iproperty._flags |= InterrogateElement::F_has_getter; - iproperty._getter = get_function(getter, "", struct_type, - struct_type->get_scope(), 0); - nassertr(iproperty._getter, 0); - } - } else { - // We could have a mixed sequence/mapping property, so synthesize a - // getitem function. We don't really care what's in here; we just use - // this to store the remaps. - if (!iproperty.has_getter()) { - iproperty._flags |= InterrogateElement::F_has_getter; - iproperty._getter = InterrogateDatabase::get_ptr()->get_next_index(); - InterrogateFunction *ifunction = new InterrogateFunction; - ifunction->_instances = new InterrogateFunction::Instances; - InterrogateDatabase::get_ptr()->add_function(iproperty._getter, ifunction); - } - - // Add our getter to the generated getitem function. - string signature = TypeManager::get_function_signature(getter); - InterrogateFunction &ifunction = - InterrogateDatabase::get_ptr()->update_function(iproperty._getter); - if (ifunction._instances == nullptr) { - ifunction._instances = new InterrogateFunction::Instances; - } - ifunction._instances->insert(InterrogateFunction::Instances::value_type(signature, getter)); + if (getter != nullptr) { + iproperty._flags |= InterrogateElement::F_has_getter; + iproperty._getter = get_function(getter, "", struct_type, + struct_type->get_scope(), 0); + nassertr(iproperty._getter, 0); } if (hasser != nullptr) { From 2e03eb405b00a61543a36e2b82a0200be9ae742c Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 3 Sep 2019 22:29:54 +0200 Subject: [PATCH 2/6] deploy-ng: handle .pz and .gz models correctly --- direct/src/dist/commands.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/direct/src/dist/commands.py b/direct/src/dist/commands.py index 8a865f98dc..f8160ed546 100644 --- a/direct/src/dist/commands.py +++ b/direct/src/dist/commands.py @@ -66,6 +66,8 @@ def _parse_dict(input): def egg2bam(_build_cmd, srcpath, dstpath): + if dstpath.endswith('.gz') or dstpath.endswith('.pz'): + dstpath = dstpath[:-3] dstpath = dstpath + '.bam' try: subprocess.check_call([ @@ -895,6 +897,9 @@ class build_apps(setuptools.Command): os.makedirs(dst_dir) ext = os.path.splitext(src)[1] + # If the file ends with .gz/.pz, we strip this off. + if ext in ('.gz', '.pz'): + ext = os.path.splitext(src[:-3])[1] if not ext: ext = os.path.basename(src) From 79c71a5d978c19eb75c977fca2f1b05937e84ef7 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 3 Sep 2019 22:31:06 +0200 Subject: [PATCH 3/6] pgraph: fix missing includes of *Collection classes in nodePath.h --- panda/src/pgraph/nodePath.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/panda/src/pgraph/nodePath.h b/panda/src/pgraph/nodePath.h index 4f0849fac4..eaec935a29 100644 --- a/panda/src/pgraph/nodePath.h +++ b/panda/src/pgraph/nodePath.h @@ -41,6 +41,8 @@ #include "pta_LVecBase2.h" #include "stl_compares.h" #include "shaderInput.h" +#include "internalNameCollection.h" +#include "materialCollection.h" #include "textureCollection.h" #include "textureStageCollection.h" @@ -49,13 +51,9 @@ class FindApproxPath; class FindApproxLevelEntry; class Light; class PolylightNode; -class InternalNameCollection; class Texture; class TextureStage; -class TextureCollection; -class TextureStageCollection; class Material; -class MaterialCollection; class Fog; class GlobPattern; class PreparedGraphicsObjects; @@ -1054,6 +1052,8 @@ private: INLINE std::ostream &operator << (std::ostream &out, const NodePath &node_path); +#include "nodePathCollection.h" + #include "nodePath.I" #endif From 323f74cb55861afbd936a69d279f364d79e28a02 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 4 Sep 2019 10:19:01 +0200 Subject: [PATCH 4/6] event: squelch unprotected NewFrame event spam warning --- panda/src/event/eventQueue.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/panda/src/event/eventQueue.cxx b/panda/src/event/eventQueue.cxx index 69c025734c..426bf161de 100644 --- a/panda/src/event/eventQueue.cxx +++ b/panda/src/event/eventQueue.cxx @@ -46,11 +46,13 @@ queue_event(CPT_Event event) { LightMutexHolder holder(_lock); _queue.push_back(event); - if (event_cat.is_spam() || event_cat.is_debug()) { + if (event_cat.is_debug()) { if (event->get_name() == "NewFrame") { // Don't bother us with this particularly spammy event. - event_cat.spam() - << "Throwing event " << *event << "\n"; + if (event_cat.is_spam()) { + event_cat.spam() + << "Throwing event " << *event << "\n"; + } } else { event_cat.debug() << "Throwing event " << *event << "\n"; From ba1023efa9817ee2dbc03b06ff24873e299447c2 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 4 Sep 2019 12:26:43 +0200 Subject: [PATCH 5/6] stdpy: clarify comment to indicate os.PathLike is supported in open() --- direct/src/stdpy/file.py | 1 + 1 file changed, 1 insertion(+) diff --git a/direct/src/stdpy/file.py b/direct/src/stdpy/file.py index 222739612a..394fde2436 100644 --- a/direct/src/stdpy/file.py +++ b/direct/src/stdpy/file.py @@ -83,6 +83,7 @@ def open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, elif isinstance(file, strType): filename = core.Filename.fromOsSpecific(file) else: + # It's either a Filename object or an os.PathLike. # If a Filename is given, make a writable copy anyway. filename = core.Filename(file) From 7f7cbd1c25a9297b81c802f47b0f3d643c5b4556 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 4 Sep 2019 12:40:58 +0200 Subject: [PATCH 6/6] tests: add Filename unit tests for fspath protocol in particular --- tests/dtoolutil/test_filename.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/dtoolutil/test_filename.py diff --git a/tests/dtoolutil/test_filename.py b/tests/dtoolutil/test_filename.py new file mode 100644 index 0000000000..d24d9d52d7 --- /dev/null +++ b/tests/dtoolutil/test_filename.py @@ -0,0 +1,24 @@ +from panda3d.core import Filename +import sys, os +import pytest + + +@pytest.mark.skipif(sys.version_info < (3, 6), reason="Requires Python 3.6") +def test_filename_fspath(): + fn = Filename.from_os_specific(__file__) + assert os.fspath(fn) == fn.to_os_specific_w() + + +@pytest.mark.skipif(sys.version_info < (3, 6), reason="Requires Python 3.6") +def test_filename_open(): + fn = Filename.from_os_specific(__file__) + open(fn, 'rb') + + +@pytest.mark.skipif(sys.version_info < (3, 4), reason="Requires Python 3.4") +def test_filename_ctor_pathlib(): + pathlib = pytest.importorskip('pathlib') + + path = pathlib.Path(__file__) + fn = Filename(path) + assert fn.to_os_specific_w() == str(path)