Skip to content

maya_zen_tools.install

This module modifies your userSetup.py script to add startup procedures needed to use ZenTools.

install

install() -> None

Add the line "from maya_zen_tools import startup" to userSetup.py, if it isn't already in the script.

Source code in src/maya_zen_tools/install.py
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
def install() -> None:
    """
    Add the line "from maya_zen_tools import startup" to userSetup.py,
    if it isn't already in the script.
    """
    user_setup_py: str = ""
    user_setup_py_path: Path = find_user_setup_py()
    if user_setup_py_path.is_file():
        with open(user_setup_py_path) as user_setup_py_io:
            user_setup_py = user_setup_py_io.read()
    if not (
        user_setup_py
        and re.search(
            r"(^|\n)from maya_zen_tools import startup(\n|$)", user_setup_py
        )
    ):
        with open(user_setup_py_path, "a") as user_setup_py_io:
            user_setup_py_io.write("from maya_zen_tools import startup\n")