Build the Windows package.
(
ctx: Context,
onedir: str = None,
salt_version: str = None,
arch: str = None,
sign: bool = False,
relenv_version: str = None,
python_version: str = None,
debug_signing: bool = True,
)
| 540 | }, |
| 541 | ) |
| 542 | def windows( |
| 543 | ctx: Context, |
| 544 | onedir: str = None, |
| 545 | salt_version: str = None, |
| 546 | arch: str = None, |
| 547 | sign: bool = False, |
| 548 | relenv_version: str = None, |
| 549 | python_version: str = None, |
| 550 | debug_signing: bool = True, |
| 551 | ): |
| 552 | """ |
| 553 | Build the Windows package. |
| 554 | """ |
| 555 | if TYPE_CHECKING: |
| 556 | assert salt_version is not None |
| 557 | assert arch is not None |
| 558 | |
| 559 | shared_constants = tools.utils.get_cicd_shared_context() |
| 560 | if not python_version: |
| 561 | python_version = shared_constants["python_version"] |
| 562 | if not relenv_version: |
| 563 | relenv_version = shared_constants["relenv_version"] |
| 564 | if TYPE_CHECKING: |
| 565 | assert python_version |
| 566 | assert relenv_version |
| 567 | os.environ["RELENV_FETCH_VERSION"] = relenv_version |
| 568 | |
| 569 | build_cmd = [ |
| 570 | "powershell.exe", |
| 571 | "&", |
| 572 | "pkg/windows/build.cmd", |
| 573 | "-Architecture", |
| 574 | arch, |
| 575 | "-Version", |
| 576 | salt_version, |
| 577 | "-PythonVersion", |
| 578 | python_version, |
| 579 | "-RelenvVersion", |
| 580 | relenv_version, |
| 581 | "-CICD", |
| 582 | ] |
| 583 | |
| 584 | checkout = pathlib.Path.cwd() |
| 585 | if onedir: |
| 586 | build_cmd.append("-SkipInstall") |
| 587 | onedir_artifact = checkout / "artifacts" / onedir |
| 588 | ctx.info(f"Building package from existing onedir: {str(onedir_artifact)}") |
| 589 | _check_pkg_build_files_exist(ctx, onedir_artifact=onedir_artifact) |
| 590 | |
| 591 | unzip_dir = checkout / "pkg" / "windows" |
| 592 | ctx.info(f"Unzipping the onedir artifact to {unzip_dir}") |
| 593 | with zipfile.ZipFile(onedir_artifact, mode="r") as archive: |
| 594 | archive.extractall(unzip_dir) # nosec |
| 595 | |
| 596 | move_dir = unzip_dir / "salt" |
| 597 | build_env = unzip_dir / "buildenv" |
| 598 | _check_pkg_build_files_exist(ctx, move_dir=move_dir) |
| 599 |
nothing calls this directly
no test coverage detected