Check to see if the ZenTools Autodesk marketplace add-in
is installed, and if not—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
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42 | def install() -> None:
"""
Check to see if the ZenTools Autodesk marketplace add-in
is installed, and if not—add the line "from maya_zen_tools import startup"
to userSetup.py (if it isn't already in the script).
"""
if find_zen_tools_package_directory():
# If there's a package—we don't need to look for a userSetup.py script.
return
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")
|