def _get_deadline_command_path()

in packages/aws-rfdk/lib/deadline/scripts/python/configure_identity_registration_settings.py [0:0]


    def _get_deadline_command_path():
        """
        Find the Deadline executable on the current machine

        :return: the string path to the Deadline executable.
        """

        deadline_bin = os.environ.get('DEADLINE_PATH', '')

        # On Linux, the Deadline Client installer creates a system-wide script to set the DEADLINE_PATH environment
        # variable. Cloud-init does not load system environment variables. Cherry-pick the
        # environment variable installed by the Deadline Client installer.
        if not deadline_bin and os.path.exists(DL_ENV_SCRIPT_PATH_LINUX):
            print(f'using environement script at "{DL_ENV_SCRIPT_PATH_LINUX}"...')
            with io.open(DL_ENV_SCRIPT_PATH_LINUX, 'r', encoding='utf8') as env_script:
                env_script_contents = env_script.read()
            dl_path_match = DL_ENV_SCRIPT_PATH_RE.search(env_script_contents)
            if dl_path_match:
                deadline_bin = dl_path_match.group('DeadlineDir')

        # On OSX, we look for the DEADLINE_PATH file if the environment variable does not exist.
        if deadline_bin == "" and os.path.exists(DL_PATH_FILE_MACOS):
            print(f'using MacOS Deadline path file at "{DL_PATH_FILE_MACOS}"...')
            with io.open(DL_PATH_FILE_MACOS, 'r', encoding='utf8') as f:
                deadline_bin = f.read().strip()

        if not deadline_bin:
            raise ValueError('Could not determine deadline path')

        deadline_command = os.path.join(deadline_bin, "deadlinecommand")

        return deadline_command