From 19680b9c6a2e5009af0d580bc5f4158a7184890f Mon Sep 17 00:00:00 2001 From: Luca Scheller Date: Wed, 20 Mar 2024 21:39:01 -0700 Subject: [PATCH] Fix Python glob bug --- .github/scripts/maya.py | 12 ++++++------ .github/workflows/build_maya.yml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/scripts/maya.py b/.github/scripts/maya.py index 81de85d..456eda9 100644 --- a/.github/scripts/maya.py +++ b/.github/scripts/maya.py @@ -200,15 +200,15 @@ def install_autodesk_product(product, version, install_dir_path): maya_usd_sdk_extract_rpm_file_name = [f for f in os.listdir(maya_usd_sdk_extract_dir_path) if f.endswith(".rpm")][0] maya_usd_sdk_extract_rpm_file_path = os.path.join(maya_usd_sdk_extract_dir_path, maya_usd_sdk_extract_rpm_file_name) command = ["rpm", "-e", maya_usd_sdk_extract_rpm_file_name.replace(".rpm", "")] - process = subprocess.check_call(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + process = subprocess.check_call(command ) command = ["rpm", "-i", "--prefix", maya_usd_sdk_extract_dir_path, maya_usd_sdk_extract_rpm_file_path] - process = subprocess.check_call(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - maya_usd_sdk_extract_usd_dir_path = glob.glob("**{sep}mayausd{sep}USD".format(sep=os.path.sep), root_dir=maya_usd_sdk_extract_dir_path, recursive=True)[0] + process = subprocess.check_call(command) + maya_usd_sdk_extract_usd_dir_path = glob.glob("{root_dir}{sep}**{sep}mayausd{sep}USD".format(root_dir=maya_usd_sdk_extract_dir_path, sep=os.path.sep), recursive=True)[0] maya_usd_sdk_extract_usd_dir_path = os.path.join(maya_usd_sdk_extract_dir_path, maya_usd_sdk_extract_usd_dir_path) os.rename(maya_usd_sdk_extract_usd_dir_path, maya_usd_sdk_install_dir_path) os.chmod(maya_usd_sdk_install_dir_path, 0o777) # Maya USD SDK devkit - maya_usd_sdk_devkit_zip_file_path = glob.glob("**{}devkit.zip".format(os.path.sep), root_dir=maya_usd_sdk_install_dir_path, recursive=True) + maya_usd_sdk_devkit_zip_file_path = glob.glob("{root_dir}{sep}**{sep}devkit.zip".format(root_dir=maya_usd_sdk_extract_dir_path, sep=os.path.sep), recursive=True) maya_usd_sdk_devkit_zip_file_path = os.path.join(maya_usd_sdk_install_dir_path, maya_usd_sdk_devkit_zip_file_path[0]) with zipfile.ZipFile(maya_usd_sdk_devkit_zip_file_path, 'r') as zip_file: zip_file.extractall(maya_usd_sdk_devkit_install_dir_path) @@ -247,12 +247,12 @@ def install_autodesk_product(product, version, install_dir_path): logging.info("Installing Maya USD SDK") command = ["msiexec", "/i", os.path.join(maya_usd_sdk_extract_dir_path, "MayaUSD.msi"), "/quiet", "/passive", "INSTALLDIR={}".format(maya_usd_sdk_extract_dir_path)] process = subprocess.check_call(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - maya_usd_sdk_extract_usd_dir_path = glob.glob("**{sep}mayausd{sep}USD".format(sep=os.path.sep), root_dir=maya_usd_sdk_extract_dir_path, recursive=True)[0] + maya_usd_sdk_extract_usd_dir_path = glob.glob("{root_dir}{sep}**{sep}mayausd{sep}USD".format(root_dir=maya_usd_sdk_extract_dir_path, sep=os.path.sep), recursive=True)[0] maya_usd_sdk_extract_usd_dir_path = os.path.join(maya_usd_sdk_extract_dir_path, maya_usd_sdk_extract_usd_dir_path) os.rename(maya_usd_sdk_extract_usd_dir_path, maya_usd_sdk_install_dir_path) # Maya USD DevKit logging.info("Installing Maya USD SDK DevKit") - maya_usd_sdk_devkit_zip_file_path = glob.glob("**{}devkit.zip".format(os.path.sep), root_dir=maya_usd_sdk_install_dir_path, recursive=True) + maya_usd_sdk_devkit_zip_file_path = glob.glob("{root_dir}{sep}**{sep}devkit.zip".format(root_dir=maya_usd_sdk_extract_dir_path, sep=os.path.sep), recursive=True) maya_usd_sdk_devkit_zip_file_path = os.path.join(maya_usd_sdk_install_dir_path, maya_usd_sdk_devkit_zip_file_path[0]) with zipfile.ZipFile(maya_usd_sdk_devkit_zip_file_path, 'r') as zip_file: zip_file.extractall(maya_usd_sdk_devkit_install_dir_path) diff --git a/.github/workflows/build_maya.yml b/.github/workflows/build_maya.yml index a5e88c3..42de2c7 100644 --- a/.github/workflows/build_maya.yml +++ b/.github/workflows/build_maya.yml @@ -37,7 +37,7 @@ jobs: sudo apt-get install -y build-essential cmake sudo apt-get install -y python3 python3-pip sudo pip3 install requests - - name: Install maya + - name: Install Maya run: | repo_root=$(cd .; pwd) sudo --preserve-env python3 .github/scripts/maya.py --install --install_maya_product_name ${{ matrix.maya_product_name }} --install_maya_product_version ${{ matrix.maya_product_version }} --install_directory $repo_root/dependency