On this page |
In some cases it might be handy to script houdini and launcher installations to make upgrading better integrated into the studios CLI pipeline.
Scripting Launcher installations ¶
Launcher can be programmatically retrieved through the SideFX Web API.
-
Download sidefx.py which provides a convenient wrapper to make authenticated calls to our API.
-
Here is an example which downloads Launcher through our API.
import sys import os import stat import requests import shutil import subprocess import platform import sidefx CLIENT_ID = "==Your Client Id==" CLIENT_SECRET = "==Your Client Secret==" # Return the current platform keyword that can be passed into # the SideFX Web API functions if current platform can be # recognized; Otherwise, an empty string '' will be returned. def get_current_platform(): current_platform = platform.system() if current_platform == 'Windows' or current_platform.startswith('CYGWIN'): return 'win64' elif current_platform == 'Darwin': return 'macos' elif current_platform == 'Linux': return 'linux' else: return '' # Return a sidefx.service object allowing access to API functions. def create_service(client_id, client_secret_key): return sidefx.service( access_token_url="https://www.sidefx.com/oauth2/application_token", client_id=client_id, client_secret_key=client_secret_key, endpoint_url="https://www.sidefx.com/api/") # Download the file specified in "build" argument and return the # downloaded filename on success. def download_build(service, build): platform = get_current_platform() build_info = service.download.get_daily_build_download( build["product"], build["version"], build["build"], platform) download_file(build_info["download_url"], build_info["filename"]) return build_info["filename"] # Download the file hosted on "url" and name it as "filename" def download_file(url, filename): with requests.get(url, stream=True) as response: with open(filename, "wb") as open_file: shutil.copyfileobj(response.raw, open_file) make_executable(filename) # Add executable privilege to the file specified in "file_path" def make_executable(file_path): stat_info = os.stat(file_path) os.chmod(file_path, stat.ST_MODE | stat.S_IEXEC | stat.S_IXUSR | stat.S_IXGRP | stat.S_IRUSR | stat.S_IRGRP) def run(): product = "houdini-launcher" platform = get_current_platform() service = create_service(CLIENT_ID, CLIENT_SECRET) # Retrieve the daily builds list, if you want the latest production # you can skip this step builds = service.download.get_daily_builds_list( product, version=None, platform=platform, only_production=False) # Retrieve the latest daily build available launcher_file = download_build(service, builds[0]) # ==Installation part begins here== if __name__ == "__main__": run()
-
Installation part of code is platform dependent. The following code can be added to the above script accordingly to automate Launcher installation. Launcher installation path can be customized. On Linux and MacOS, both relative and absolute paths are acceptable, but only absolute paths are supported on Windows.
Windows
# Install Launcher to the "C:\\houdini_launcher" folder, which could be modified # to your prefered path. # Note this step might require security privileges of superuser on your machine # depending on your installation path. # If so, please run the command shell as administrator. subprocess.call(["./install-houdini-launcher.exe", "/S", "/D=C:\\houdini_launcher"])
Mac
# Mount the Launcher ".dmg" file. subprocess.call(["hdiutil", "attach", launcher_file]) # Create "houdini_launcher" folder if not exists if not os.path.exists("houdini_launcher"): os.mkdir("houdini_launcher") # Install Launcher to "houdini_launcher" folder next to current script, # which could be modified to your prefered path. subprocess.call(["cp", "-R", "/Volumes/Houdini/Houdini Launcher.app", "houdini_launcher"]) # Unmount the Launcher ".dmg" file subprocess.call(["hdiutil", "unmount", "/Volumes/Houdini"])
Linux
# Install Launcher to "houdini_launcher" folder next to current script, # which could be modified to your prefered path. # Note this step might require security privileges of superuser on your machine # depending on your installation path. # If so, please run the python script with `sudo`. subprocess.call(["./install_houdini_launcher.sh", "houdini_launcher"])
Scripting Houdini installations ¶
The Launcher is a graphical program, however the install includes a command-line executable. This is useful for performing installations remotely or in a script.
The non-graphical command-line executable is called houdini_installer
.
Windows
The command line programs are in C:/Program Files/SideFX/launcher/bin
by default.
Mac
The command line programs are inside the /Applications/Houdini Launcher
app bundle, in Contents/MacOS
.
Linux
The command line programs are in /opt/sidefx/launcher/bin
by default.
To... | Do this |
---|---|
Get ready to install |
|
Script installation |
Tip To install special builds of Houdini, add the arguments The Houdini version string ( |
Script offline installation |
|
See the install subcommand on the launcher page for more information.