From d65ca1edd60415f3acf115a033d46188f6782dca Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 5 Jan 2022 08:01:56 +0100 Subject: [PATCH 1/3] pgraph: Fix nodes with same key but diff value getting flattened This was a regression from 69b3468b2c40111def34e4b609a0aa36267c5582 --- panda/src/pgraph/pandaNode.cxx | 2 +- tests/pgraph/test_nodepath.py | 51 ++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/panda/src/pgraph/pandaNode.cxx b/panda/src/pgraph/pandaNode.cxx index 9aace23918..0baf30c7dd 100644 --- a/panda/src/pgraph/pandaNode.cxx +++ b/panda/src/pgraph/pandaNode.cxx @@ -1325,7 +1325,7 @@ compare_tags(const PandaNode *other) const { return cmp; } - cmp = strcmp(a_data.get_key(ai).c_str(), b_data.get_key(bi).c_str()); + cmp = strcmp(a_data.get_data(ai).c_str(), b_data.get_data(bi).c_str()); if (cmp != 0) { return cmp; } diff --git a/tests/pgraph/test_nodepath.py b/tests/pgraph/test_nodepath.py index 43e43313e1..6a7d0990b4 100644 --- a/tests/pgraph/test_nodepath.py +++ b/tests/pgraph/test_nodepath.py @@ -133,6 +133,57 @@ def test_weak_nodepath_comparison(): assert weak.node() == path.node() +def test_nodepath_flatten_tags_identical(): + from panda3d.core import NodePath, PandaNode + + # Do flatten nodes with same tags + node1 = PandaNode("node1") + node1.set_tag("key", "value") + node2 = PandaNode("node2") + node2.set_tag("key", "value") + + path = NodePath("parent") + path.node().add_child(node1) + path.node().add_child(node2) + + path.flatten_strong() + assert len(path.children) == 1 + + +def test_nodepath_flatten_tags_same_key(): + from panda3d.core import NodePath, PandaNode + + # Don't flatten nodes with different tag keys + node1 = PandaNode("node1") + node1.set_tag("key1", "value") + node2 = PandaNode("node2") + node2.set_tag("key2", "value") + + path = NodePath("parent") + path.node().add_child(node1) + path.node().add_child(node2) + + path.flatten_strong() + assert len(path.children) == 2 + + +def test_nodepath_flatten_tags_same_value(): + from panda3d.core import NodePath, PandaNode + + # Don't flatten nodes with different tag values + node1 = PandaNode("node1") + node1.set_tag("key", "value1") + node2 = PandaNode("node2") + node2.set_tag("key", "value2") + + path = NodePath("parent") + path.node().add_child(node1) + path.node().add_child(node2) + + path.flatten_strong() + assert len(path.children) == 2 + + def test_nodepath_python_tags(): from panda3d.core import NodePath From ae6be7e1139f02d3020bfdb468fd1ead090b0ffb Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 5 Jan 2022 08:14:25 +0100 Subject: [PATCH 2/3] makepackage: Fix extra comma in deb depends line when building without Python --- makepanda/makepackage.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/makepanda/makepackage.py b/makepanda/makepackage.py index e8dfbecbfb..4e0a459488 100755 --- a/makepanda/makepackage.py +++ b/makepanda/makepackage.py @@ -397,7 +397,8 @@ def MakeInstallerLinux(version, debversion=None, rpmversion=None, rpmrelease=1, provides = "panda3d" # Require at least one of the Python versions we built for. - depends += ", " + " | ".join("python" + version_info["version"] for version_info in install_python_versions) + if install_python_versions: + depends += ", " + " | ".join("python" + version_info["version"] for version_info in install_python_versions) # But recommend the system version of Python 3. if python3_ver: From 38488d89a2da930e310af29b7ddfb473ec73fb49 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 5 Jan 2022 08:20:13 +0100 Subject: [PATCH 3/3] test_wheel: Require at least pytest 6.2.4 for Python 3.10+ See pytest-dev/pytest#8539 --- makepanda/test_wheel.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/makepanda/test_wheel.py b/makepanda/test_wheel.py index e234891425..feda269b7e 100755 --- a/makepanda/test_wheel.py +++ b/makepanda/test_wheel.py @@ -49,7 +49,12 @@ def test_wheel(wheel, verbose=False): open(pep425tags, "w").write(data) # Install pytest into the environment, as well as our wheel. - packages = ["pytest", wheel] + packages = [wheel] + if sys.version_info >= (3, 10): + packages += ["pytest>=6.2.4"] + else: + packages += ["pytest"] + if sys.version_info[0:2] == (3, 4): if sys.platform == "win32": packages += ["colorama==0.4.1"]