# (c) 2025 by Stephan Menzel # Licensed under the Apache License, Version 2.0. # See attached file LICENSE for full details def write_package_version_batch(version: str): """In order to propagate the version we have installed to subsequent Azure tasks, there seems to be only one choice: to set a task variable. This writes a small script to do that. Each build operation writes that script and the pipeline task calls it after the build, removing the need of the pipeline to really know the version. """ version_cmd = f"echo ##vso[task.setvariable variable=installed_version]{version}\r\n" output_version_cmd = f"echo ##vso[task.setvariable variable=out_installed_version;isOutput=true]{version}\r\n" with open("version_setter.bat", "w") as batch_file: batch_file.write(version_cmd) batch_file.write(output_version_cmd)