def detect(node, **_): """Autodetect host package and plugins used in the scene. This will only find the package if Conductor knows about the exact version. Otherwise the user will have to use the chooser and select host and plugin versions that can hopefully manage the current scene. We may detect a plugin in the scene that Conductor knows about, but does not have a path-to-host that Conductor knows about. In this case it is considered unreachable and ignored. Again, if the user wants it, they can select it manually along with the path-to-host that Conductor does know about. """ package_tree = get_package_tree() host = houdini_info.HoudiniInfo().get() paths = package_tree.get_all_paths_to(**host) for info in houdini_info.get_used_plugin_info(): plugin_paths = package_tree.get_all_paths_to(**info) paths += plugin_paths paths = ptree.remove_unreachable(paths) if not paths: choose(node) else: _add_package_entries(node, paths)
def test_random_input_order(self): paths = ["a", "a/b", "a/b/c", "b", "b/b", "b/b/c", "d", "c/b", "c/b/c"] random.shuffle(paths) results = ptree.remove_unreachable(paths) self.assertEqual(results, ["a", "a/b", "a/b/c", "b", "b/b", "b/b/c", "d"])
def test_multiple_invalid_tree_culled(self): paths = ["a", "a/b", "a/b/c", "b", "b/b", "b/b/c", "d", "c/b", "c/b/c"] results = ptree.remove_unreachable(paths) self.assertEqual(results, ["a", "a/b", "a/b/c", "b", "b/b", "b/b/c", "d"])
def test_single_invalid_tree_culled_below(self): paths = ["a", "b/b", "a/b/c"] results = ptree.remove_unreachable(paths) self.assertEqual(results, ["a"])
def test_many_valid_trees_unchanged(self): paths = ["a", "a/b", "a/b/c", "b", "b/b", "b/b/c", "c", "c/b", "c/b/c"] results = ptree.remove_unreachable(paths) self.assertEqual(results, paths)
def test_single_valid_tree_unchanged(self): paths = ["a", "a/b", "a/b/c"] results = ptree.remove_unreachable(paths) self.assertEqual(results, paths)