conductor.native.lib.package_tree module¶
This module represents the list of software packages as a tree.
It has methods and functions to traverse the tree to find packages and build paths etc.
See tests in /tests/test_package_tree.py for additional usage info.
-
class
conductor.native.lib.package_tree.
PackageTree
(packages, **kw)¶ Bases:
object
Class to represent available packages as a tree.
Data structure is really a DAG because a tool may be compatible with more than one host product.
-
find_by_keys
(**kw)¶ Search the tree for a product with the given keys.
Whichever keys from the following are given, must match, product, major_version, minor_version, release_version, build_version
-
find_by_name
(name, limit=None, depth=0)¶ Search the tree for a product with the given name.
This name is the name originally constructed from the package using to_name.
-
find_by_path
(path)¶ Find the package uniquely described by this path.
-
get_all_paths_to
(**kw)¶ All paths to the package described in kw.
Its possible there is more than one path to a given node. For now we just get all paths through the tree and then select the ones whose leaf matches.
-
get_environment
(paths)¶ Get merged environment from paths.
-
json
()¶ The whole tree as json.
-
to_path_list
()¶ Get paths to all nodes below and including the top level nodes.
-
tree
¶
-
-
conductor.native.lib.package_tree.
remove_unreachable
(paths)¶ Remove unreachable paths.
Given some paths, remove those for which there are not additional paths present at each level up the hierarchy to the host. It is possible to have orphaned paths if a package can be reached by more than one path. For example, a shader library may be compatible with 2 versions of a renderer, but only one of those renderers is compatible with this host. We need to remove the entry that references a different host.
-
conductor.native.lib.package_tree.
to_all_paths
(path)¶ Extract all ancestor paths from a path.
This can be useful if the user selects a plugin from a chooser, because we know we’ll want its host ancestors. Just split the string and work up the parts.
-
conductor.native.lib.package_tree.
to_name
(pkg)¶ Name like houdini 16.5.323 or maya 2016.SP3.
This name is derived from the product and version fields in a package. Note: It is not necessarily possible to go the other way and extract version fields from the name. It’s purpose is to enable path construction to uniquely identify a package. For example, houdini 16.0.736 /arnold-houdini 2.0.2.2/al-shaders 1.0