diff --git a/.github/scripts/houdini.py b/.github/scripts/houdini.py index c51855c..181a70f 100644 --- a/.github/scripts/houdini.py +++ b/.github/scripts/houdini.py @@ -31,7 +31,7 @@ def create_sidefx_service(client_id, client_secret_key): def get_sidefx_platform(): """Get the active platform usable for SideFX platform API calls Returns: - string: The active platform + str: The active platform """ current_platform = platform.system() if current_platform == 'Windows' or current_platform.startswith('CYGWIN'): @@ -50,34 +50,26 @@ def download_sidefx_product_release(dir_path, release): dir_path (str): The target directory release (dict): The download build release dict Returns: - folder_dir_path: The folder dir path of the unpacked tar file + str: The file path of the downloaded file """ - # Download tar file - tar_file_name = release['filename'] - tar_file_path = os.path.join(dir_path, tar_file_name) + # Download file + download_file_name = release['filename'] + download_file_path = os.path.join(dir_path, download_file_name) request = requests.get(release['download_url'], stream=True) if request.status_code == 200: - with open(tar_file_path, 'wb') as tar_file: + with open(download_file_path, 'wb') as download_file: request.raw.decode_content = True - shutil.copyfileobj(request.raw, tar_file) + shutil.copyfileobj(request.raw, download_file) else: raise Exception('Error downloading file!') - # Verify tar file checksum - tar_file_hash = hashlib.md5() - with open(tar_file_path, 'rb') as tar_file: - for chunk in iter(lambda: tar_file.read(4096), b''): - tar_file_hash.update(chunk) - if tar_file_hash.hexdigest() != release['hash']: + # Verify file checksum + download_file_hash = hashlib.md5() + with open(download_file_path, 'rb') as download_file: + for chunk in iter(lambda: download_file.read(4096), b''): + download_file_hash.update(chunk) + if download_file_hash.hexdigest() != release['hash']: raise Exception('Checksum does not match!') - # Unpack tar file - with tarfile.open(tar_file_path) as tar_file: - tar_file.extractall(dir_path) - os.remove(tar_file_path) - # Get folder name - product_release_folder_name = tar_file_name - product_release_folder_name = product_release_folder_name.replace(".tar", "") - product_release_folder_name = product_release_folder_name.replace(".gz", "") - return os.path.join(dir_path, product_release_folder_name) + return download_file_path def install_sidefx_houdini(): @@ -86,6 +78,7 @@ def install_sidefx_houdini(): sidefx_service = create_sidefx_service(SIDEFX_CLIENT_ID, SIDEFX_CLIENT_SECRET_KEY) sidefx_platform = get_sidefx_platform() sidefx_product = "houdini" + print(sidefx_platform) # Get release data releases_list = sidefx_service.download.get_daily_builds_list(product=sidefx_product, platform=sidefx_platform, @@ -95,15 +88,26 @@ def install_sidefx_houdini(): version=latest_production_release["version"], build=latest_production_release["build"], platform=sidefx_platform) + + # Download latest production release downloads_dir_path = os.path.join(os.path.expanduser("~"), "Downloads") if not os.path.isdir(downloads_dir_path): os.makedirs(downloads_dir_path) - houdini_installer_dir_path = download_sidefx_product_release(downloads_dir_path, - latest_production_release_download) + houdini_installer_file_path = download_sidefx_product_release(downloads_dir_path, + latest_production_release_download) # Install latest production release hfs_dir_path = "" if sidefx_platform == "linux": + # Unpack tar file + with tarfile.open(houdini_installer_file_path) as tar_file: + tar_file.extractall(downloads_dir_path) + os.remove(houdini_installer_file_path) + # Get folder name + houdini_installer_dir_name = houdini_installer_dir_name['filename'] + houdini_installer_dir_name = houdini_installer_dir_name.replace(".tar", "") + houdini_installer_dir_name = houdini_installer_dir_name.replace(".gz", "") + houdini_installer_dir_path = os.path.join(downloads_dir_path, houdini_installer_dir_name) cmd = [os.path.join(houdini_installer_dir_path, "houdini.install"), "--auto-install", "--accept-EULA", "2021-10-13", "--install-houdini", "--no-install-license", "--no-install-avahi", @@ -115,11 +119,22 @@ def install_sidefx_houdini(): raise Exception("Failed to install Houdini, ran into the following error:\n {error}".format(error=status.stderr)) hfs_dir_path = os.path.join("/opt", "hfs{}.{}".format(latest_production_release["version"], latest_production_release["build"])) + hfs_versionless_dir_path = os.path.join(os.path.dirname(hfs_dir_path), "hfs") + elif sidefx_platform == "win64": + cmd = [houdini_installer_file_path, + "/S", "/AcceptEULA=2021-10-13", + "/MainApp", "/LicenseServer=No", "/StartMenu=No", + "/HQueueServer=No", "/HQueueClient=No", + "/EngineMaya=No", "/Engine3dsMax", "/EngineUnity", "/EngineUnreal=No", "/SideFXLabs=No"] + status = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + if status.returncode != 0: + raise Exception("Failed to install Houdini, ran into the following error:\n {error}".format(error=status.stderr)) + hfs_dir_path = os.path.join("C:\Program Files\Side Effects Software", "Houdini {}.{}".format(latest_production_release["version"], latest_production_release["build"])) + hfs_versionless_dir_path = os.path.join(os.path.dirname(hfs_dir_path), "Houdini") else: raise Exception("Platform {platform} is currently not" "supported!".format(platform=platform)) # Create version-less symlink - hfs_version_less_dir_path = os.path.join(os.path.dirname(hfs_dir_path), "hfs") os.symlink(hfs_dir_path, hfs_version_less_dir_path) diff --git a/.github/workflows/build_houdini.yml b/.github/workflows/build_houdini.yml index cf0ab01..5916a59 100644 --- a/.github/workflows/build_houdini.yml +++ b/.github/workflows/build_houdini.yml @@ -13,8 +13,8 @@ concurrency: jobs: - build: - runs-on: ubuntu-latest + build_windows: + runs-on: windows-2019 environment: houdini steps: - name: Checkout repository @@ -26,54 +26,10 @@ jobs: git checkout tags/$latest_release_tag - name: Install system packages run: | - sudo apt-get update - sudo apt-get install -y zip - sudo apt-get install -y build-essential cmake - sudo apt-get install -y python3 python3-pip - sudo pip3 install requests + pip3 install requests - name: Install Houdini env: SIDEFX_CLIENT_ID: '${{ secrets.SIDEFX_CLIENT_ID }}' SIDEFX_CLIENT_SECRET_KEY: '${{ secrets.SIDEFX_CLIENT_SECRET_KEY }}' run: | - sudo --preserve-env python3 .github/scripts/houdini.py --install - - name: Build USD File Resolver - run: | - .github/scripts/houdini_build.sh fileResolver - - name: Build USD Python Resolver - run: | - .github/scripts/houdini_build.sh pythonResolver - - name: Create single .zip archive - run: | - pushd /opt/hfs > /dev/null && source houdini_setup && popd > /dev/null - ARTIFACT_FILE_NAME=UsdAssetResolver_houdini-${HOUDINI_MAJOR_RELEASE}.${HOUDINI_MINOR_RELEASE}.${HOUDINI_BUILD_VERSION}-linux.zip - cd dist && zip -r $ARTIFACT_FILE_NAME * && cd .. - mkdir artifacts && mv dist/$ARTIFACT_FILE_NAME artifacts/$ARTIFACT_FILE_NAME - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: UsdAssetResolver - path: artifacts/*.zip - - deploy: - runs-on: ubuntu-latest - permissions: - contents: write - needs: build - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - name: Download artifact - uses: actions/download-artifact@v3 - with: - name: UsdAssetResolver - path: artifacts - - name: Upload artifact as release asset - run: | - git fetch --all --tags - latest_release_tag=$(git tag -l --sort=-version:refname v* | head -1) - gh release upload $latest_release_tag artifacts/*.zip --clobber - env: - GITHUB_TOKEN: ${{ github.TOKEN }} - - \ No newline at end of file + python3 .github/scripts/houdini.py --install \ No newline at end of file diff --git a/README.md b/README.md index f981e0d..2cdc865 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # Usd Asset Resolver -[![Deploy Documentation to GitHub Pages](https://github.com/LucaScheller/VFX-UsdAssetResolver/actions/workflows/mdbook.yml/badge.svg)](https://github.com/LucaScheller/VFX-UsdAssetResolver/actions/workflows/mdbook.yml) - -[![Build USD Asset Resolvers against Houdini](https://github.com/LucaScheller/VFX-UsdAssetResolver/actions/workflows/build_houdini.yml/badge.svg)](https://github.com/LucaScheller/VFX-UsdAssetResolver/actions/workflows/build_houdini.yml) +[![Deploy Documentation to GitHub Pages](https://github.com/LucaScheller/VFX-UsdAssetResolver/actions/workflows/mdbook.yml/badge.svg)](https://github.com/LucaScheller/VFX-UsdAssetResolver/actions/workflows/mdbook.yml) [![Build USD Asset Resolvers against Houdini](https://github.com/LucaScheller/VFX-UsdAssetResolver/actions/workflows/build_houdini.yml/badge.svg)](https://github.com/LucaScheller/VFX-UsdAssetResolver/actions/workflows/build_houdini.yml) This repository holds reference implementations for [Usd](https://openusd.org/release/index.html) [asset resolvers](https://openusd.org/release/glossary.html#usdglossary-assetresolution). The resolvers are compatible with the AR 2.0 standard proposed in the [Asset Resolver 2.0 Specification](https://openusd.org/release/wp_ar2.html). As the Usd documentation offers quite a good overview over the overall asset resolution system, we will not be covering it in this repository's documentation.