From 860885cafc19f604cfc2b426cea4c157772f4e89 Mon Sep 17 00:00:00 2001 From: Luca Scheller Date: Sat, 24 Feb 2024 15:37:14 -0800 Subject: [PATCH] Add Houdini Python 39/37 build support --- .github/scripts/houdini.py | 32 +++++++++++++++-------- .github/workflows/build_houdini.yml | 40 +++++++++++++++++++++-------- 2 files changed, 50 insertions(+), 22 deletions(-) diff --git a/.github/scripts/houdini.py b/.github/scripts/houdini.py index c24154f..3821862 100644 --- a/.github/scripts/houdini.py +++ b/.github/scripts/houdini.py @@ -80,21 +80,23 @@ def download_sidefx_product_release(dir_path, release): return download_file_path -def install_sidefx_houdini(houdini_version): +def install_sidefx_product(product, version): """Install the latest production release of Houdini Args: - houdini_version (str): The target Houdini version (e.g. 20.0, 19.5, etc.) + product (str): The target product name (e.g. houdini, houdini-py39, etc.) + version (str|None): The target product version (e.g. 20.0, 19.5, etc.) """ # Connect to SideFX API logging.info("Connecting to SideFX API") sidefx_service = create_sidefx_service(SIDEFX_CLIENT_ID, SIDEFX_CLIENT_SECRET_KEY) sidefx_platform = get_sidefx_platform() - sidefx_product = "houdini" + sidefx_product_name = product + sidefx_product_version = version # Get release data releases_list = sidefx_service.download.get_daily_builds_list( - product=sidefx_product, - version=houdini_version, + product=sidefx_product_name, + version=sidefx_product_version, platform=sidefx_platform, only_production=True, ) @@ -230,7 +232,7 @@ def install_sidefx_houdini(houdini_version): os.symlink(hfs_dir_path, hfs_symlink_dir_path) -def create_sidefx_houdini_artifact(artifact_src, artifact_dst, artifact_prefix): +def create_sidefx_houdini_artifact(artifact_src, artifact_dst, artifact_prefix, artifact_product_name): """Create a .zip artifact based on the source directory content. The output name will have will end in the houdini build name. @@ -238,6 +240,8 @@ def create_sidefx_houdini_artifact(artifact_src, artifact_dst, artifact_prefix): artifact_src (str): The source directory artifact_dst (str): The target directory artifact_prefix (str): The file name prefix, the suffix will be the Houdini build name + artifact_product_name (str): The file name product name. + This defines the Houdini product name, e.g. like houdini-py39 Returns: str: The artifact file path """ @@ -256,7 +260,7 @@ def create_sidefx_houdini_artifact(artifact_src, artifact_dst, artifact_prefix): ) hfs_build_name = re_digitdot.sub("", hfs_build_name) artifact_file_path = os.path.join( - artifact_dst, f"{artifact_prefix}_houdini-{hfs_build_name}-{sidefx_platform}" + artifact_dst, f"{artifact_prefix}_{artifact_product_name}-{hfs_build_name}-{sidefx_platform}" ) artifact_dir_path = os.path.dirname(artifact_file_path) if not os.path.exists(artifact_dir_path): @@ -269,20 +273,26 @@ def create_sidefx_houdini_artifact(artifact_src, artifact_dst, artifact_prefix): parser = argparse.ArgumentParser() parser.add_argument("--install", action="store_true", help="Install Houdini") parser.add_argument( - "--install_version", - help="Houdini version to install. If not provided, fallback to the latest version.", + "--install_houdini_product_name", + help="Houdini product name to install. If not provided, fallback to the default.", + ) + parser.add_argument( + "--install_houdini_product_version", + help="Houdini product version to install. If not provided, fallback to the latest version.", ) parser.add_argument("--artifact", action="store_true", help="Create artifact") parser.add_argument("--artifact_src", help="Artifact source directory") parser.add_argument("--artifact_dst", help="Artifact target directory") parser.add_argument("--artifact_prefix", help="Artifact name prefix") + parser.add_argument("--artifact_product_name", help="Artifact product name") args = parser.parse_args() # Execute # Install Houdini if args.install: - install_sidefx_houdini(args.install_version) + install_sidefx_product(args.install_houdini_product_name, + args.install_houdini_product_version) # Create artifact tagged with Houdini build name (expects Houdini to be installed via the above install command) if args.artifact: create_sidefx_houdini_artifact( - args.artifact_src, args.artifact_dst, args.artifact_prefix + args.artifact_src, args.artifact_dst, args.artifact_prefix, args.artifact_product_name ) diff --git a/.github/workflows/build_houdini.yml b/.github/workflows/build_houdini.yml index 40f69d1..a34cf8f 100644 --- a/.github/workflows/build_houdini.yml +++ b/.github/workflows/build_houdini.yml @@ -18,7 +18,13 @@ jobs: environment: houdini strategy: matrix: - houdini_version: ["19.5", "20.0"] + houdini_product_name: ["houdini"] + houdini_product_version: ["19.5", "20.0"] + include: + - houdini_product_name: "houdini-py39" + houdini_product_version: "20.0" + - houdini_product_name: "houdini-py37" + houdini_product_version: "19.5" steps: - name: Checkout repository uses: actions/checkout@v3 @@ -48,7 +54,7 @@ jobs: 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 --install_version ${{ matrix.houdini_version }} + sudo --preserve-env python3 .github/scripts/houdini.py --install --install_houdini_product_name ${{ matrix.houdini_product_name }} --install_houdini_product_version ${{ matrix.houdini_product_version }} - name: Build USD File Resolver run: | .github/scripts/houdini_build.sh fileResolver @@ -64,11 +70,11 @@ jobs: - name: Create single .zip archive run: | repo_root=$(cd .; pwd) - python3 .github/scripts/houdini.py --artifact --artifact_src=$repo_root/dist --artifact_dst=$repo_root/artifacts --artifact_prefix=UsdAssetResolver + python3 .github/scripts/houdini.py --artifact --artifact_src=$repo_root/dist --artifact_dst=$repo_root/artifacts --artifact_prefix=UsdAssetResolver --artifact_product_name ${{ matrix.houdini_product_name }} - name: Upload artifact uses: actions/upload-artifact@v3 with: - name: UsdAssetResolver-Linux-Houdini-${{ matrix.houdini_version }} + name: UsdAssetResolver-linux-${{ matrix.houdini_product_name }}-${{ matrix.houdini_product_version }} path: artifacts/*.zip build_windows: @@ -76,7 +82,13 @@ jobs: environment: houdini strategy: matrix: - houdini_version: ["19.5", "20.0"] + houdini_product_name: ["houdini"] + houdini_product_version: ["19.5", "20.0"] + include: + - houdini_product_name: "houdini-py39" + houdini_product_version: "20.0" + - houdini_product_name: "houdini-py37" + houdini_product_version: "19.5" steps: - name: Checkout repository uses: actions/checkout@v3 @@ -102,7 +114,7 @@ jobs: SIDEFX_CLIENT_ID: '${{ secrets.SIDEFX_CLIENT_ID }}' SIDEFX_CLIENT_SECRET_KEY: '${{ secrets.SIDEFX_CLIENT_SECRET_KEY }}' run: | - python3 .github\scripts\houdini.py --install --install_version ${{ matrix.houdini_version }} + python3 .github\scripts\houdini.py --install --install_houdini_product_name ${{ matrix.houdini_product_name }} --install_houdini_product_version ${{ matrix.houdini_product_version }} - name: Build USD File Resolver run: | .\.github\scripts\houdini_build.bat fileResolver @@ -117,11 +129,11 @@ jobs: .\.github\scripts\houdini_build.bat httpResolver - name: Create single .zip archive run: | - & python $pwd\.github\scripts\houdini.py --artifact --artifact_src=$pwd\dist --artifact_dst=$pwd\artifacts --artifact_prefix=UsdAssetResolver + & python $pwd\.github\scripts\houdini.py --artifact --artifact_src=$pwd\dist --artifact_dst=$pwd\artifacts --artifact_prefix=UsdAssetResolver --artifact_product_name ${{ matrix.houdini_product_name }} - name: Upload artifact uses: actions/upload-artifact@v3 with: - name: UsdAssetResolver-Windows-Houdini-${{ matrix.houdini_version }} + name: UsdAssetResolver-windows-${{ matrix.houdini_product_name }}-${{ matrix.houdini_product_version }} path: artifacts/*.zip deploy: @@ -131,8 +143,14 @@ jobs: needs: [build_linux, build_windows] strategy: matrix: - os: ["Linux", "Windows"] - houdini_version: ["19.5", "20.0"] + os: ["linux", "windows"] + houdini_product_name: ["houdini"] + houdini_product_version: ["19.5", "20.0"] + include: + - houdini_product_name: "houdini-py39" + houdini_product_version: "20.0" + - houdini_product_name: "houdini-py37" + houdini_product_version: "19.5" steps: - name: Checkout repository uses: actions/checkout@v3 @@ -141,7 +159,7 @@ jobs: - name: Download artifacts uses: actions/download-artifact@v3 with: - name: UsdAssetResolver-${{ matrix.os }}-Houdini-${{ matrix.houdini_version }} + name: UsdAssetResolver-${{ matrix.os }}-${{ matrix.houdini_product_name }}-${{ matrix.houdini_product_version }} path: artifacts - name: Upload artifacts as release assets run: |