mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
tvpaint's prelaunch hook install pywin32 on windows
This commit is contained in:
parent
b94c247ee0
commit
a69d40add8
1 changed files with 16 additions and 6 deletions
|
|
@ -1,15 +1,13 @@
|
|||
import os
|
||||
import shutil
|
||||
from pype.lib import PypeHook
|
||||
from pype.api import (
|
||||
Anatomy,
|
||||
Logger
|
||||
)
|
||||
import platform
|
||||
import pype.lib
|
||||
from pype.api import Anatomy, Logger
|
||||
import getpass
|
||||
import avalon.api
|
||||
|
||||
|
||||
class TvpaintPrelaunchHook(PypeHook):
|
||||
class TvpaintPrelaunchHook(pype.lib.PypeHook):
|
||||
"""
|
||||
Workfile preparation hook
|
||||
"""
|
||||
|
|
@ -23,10 +21,22 @@ class TvpaintPrelaunchHook(PypeHook):
|
|||
|
||||
self.signature = "( {} )".format(self.__class__.__name__)
|
||||
|
||||
def install_pywin(self):
|
||||
if platform.system().lower() != "windows":
|
||||
return
|
||||
|
||||
try:
|
||||
from win32com.shell import shell
|
||||
except Exception:
|
||||
output = pype.lib._subprocess(["pip", "install", "pywin32==227"])
|
||||
self.log.info(output)
|
||||
|
||||
def execute(self, *args, env: dict = None) -> bool:
|
||||
if not env:
|
||||
env = os.environ
|
||||
|
||||
self.install_pywin()
|
||||
|
||||
# get context variables
|
||||
project_name = env["AVALON_PROJECT"]
|
||||
asset_name = env["AVALON_ASSET"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue