From 38cf2c5fefb2dcc20d9243d18ceb6d7012642ddb Mon Sep 17 00:00:00 2001 From: TwentyPast4 Date: Sat, 29 Jun 2024 12:24:34 +0200 Subject: [PATCH] style(steam): Added comments --- pbpy/pbsteamcmd.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/pbpy/pbsteamcmd.py b/pbpy/pbsteamcmd.py index 5ebbe42..b98a33b 100644 --- a/pbpy/pbsteamcmd.py +++ b/pbpy/pbsteamcmd.py @@ -9,18 +9,19 @@ def publish_build(branch_type, steamcmd_exec_path, publish_stagedir, app_script, pblog.error("steamcmd was not configured.") return False - script_path = (Path() / app_script.format(branch_type)).resolve() + # The basic needed command line to get into steamcmd + base_steamcmd_command = [steamcmd_exec_path, "+login", pbconfig.get_user("steamcmd", "username"), pbconfig.get_user("steamcmd", "password")] - command = [steamcmd_exec_path, "+login", pbconfig.get_user("steamcmd", "username"), pbconfig.get_user("steamcmd", "password")] + # if drm wrapping is configured if drm_app_id and drm_exe_path: if not Path.is_absolute(drm_exe_path): drm_exe_path = (Path(pbconfig.config_filepath).parent / drm_exe_path).resolve() if not Path.is_file(drm_exe_path): pblog.error("steamcmd/drm/targetbinary does not exist.") return False - drm_command = command.copy() - drm_output = "wrappedBin" + Path(drm_exe_path).suffix - drm_command.extend(["+drm_wrap", drm_exe_path, drm_output, "drmtoolp", "0", "+quit"]) + drm_command = base_steamcmd_command.copy() + drm_output = "wrappedBin" + Path(drm_exe_path).suffix # save file to wrappedBin.exe temporarily + drm_command.extend(["+drm_wrap", drm_exe_path, drm_output, "drmtoolp", "0", "+quit"]) # the drm wrap command https://partner.steamgames.com/doc/features/drm pblog.info("Wrapping game with steamworks DRM...") drm_proc = pbtools.run_with_output(drm_command) pbtools.remove_file(drm_exe_path) # remove original file in any case @@ -32,11 +33,13 @@ def publish_build(branch_type, steamcmd_exec_path, publish_stagedir, app_script, shutil.move(drm_output, drm_exe_path) # move drm-wrapped file to location of original - command.extend(["+run_app_build", script_path, "+quit"]) - proc = pbtools.run(command) + script_path = (Path() / app_script.format(branch_type)).resolve() + build_cmd = base_steamcmd_command.copy() + build_cmd.extend(["+run_app_build", script_path, "+quit"]) + proc = pbtools.run(build_cmd) result = proc.returncode if Path.is_file(drm_exe_path): - pbtools.remove_file(drm_exe_path) # remove drm wrapped file, so that a subsequent build will re-build a non-wrapped version + pbtools.remove_file(drm_exe_path) # remove drm wrapped file, so that a subsequent build will re-build a non-wrapped executable return result