Skip to content

Commit 8906268

Browse files
committed
Address Copilot PR review round 2: template python version, env var for PYTHON_MAJOR_MINOR, fix arithmetic exit code
1 parent 5a1fba8 commit 8906268

5 files changed

Lines changed: 15 additions & 9 deletions

File tree

.azure-pipelines/templates/macos/macos-cask-generation-and-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ jobs:
140140
--arm64-sha "$ARM64_SHA256" \
141141
--x86-64-sha "$X86_64_SHA256" \
142142
--github-repo "${{ parameters.GitHubRepo }}" \
143+
--python-version "${{ parameters.PythonVersion }}" \
143144
--template "$REPO_ROOT/scripts/release/macos/templates/azure-cli.rb.in" \
144145
--output "$(Pipeline.Workspace)/macos-cask-definition/azure-cli.rb"
145146

.azure-pipelines/templates/macos/macos-sign-notarize-jobs.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -618,26 +618,26 @@ jobs:
618618
619619
# 1. Basic signature check
620620
if codesign -v "$file" 2>/dev/null; then
621-
((SIGNED_COUNT++))
621+
SIGNED_COUNT=$((SIGNED_COUNT + 1))
622622
[ -z "$FIRST_SIGNED" ] && FIRST_SIGNED="$file"
623623
624624
# 2. Strict verification (only for signed files)
625625
if codesign --verify --deep --strict "$file" 2>/dev/null; then
626-
((STRICT_PASS++))
626+
STRICT_PASS=$((STRICT_PASS + 1))
627627
else
628-
((STRICT_FAIL++))
628+
STRICT_FAIL=$((STRICT_FAIL + 1))
629629
STRICT_FAILED_FILES+=("$filename")
630630
fi
631631
632632
# 3. Developer ID check (only for signed files)
633633
if codesign -dvv "$file" 2>&1 | grep -q "Developer ID"; then
634-
((DEVID_PASS++))
634+
DEVID_PASS=$((DEVID_PASS + 1))
635635
else
636-
((DEVID_FAIL++))
636+
DEVID_FAIL=$((DEVID_FAIL + 1))
637637
DEVID_FAILED_FILES+=("$filename")
638638
fi
639639
else
640-
((UNSIGNED_COUNT++))
640+
UNSIGNED_COUNT=$((UNSIGNED_COUNT + 1))
641641
UNSIGNED_FILES+=("$filename")
642642
fi
643643
done

scripts/release/macos/build_binary_tar_gz.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050

5151
import argparse
5252
import hashlib
53+
import os
5354
import shutil
5455
import subprocess
5556
import sys
@@ -68,8 +69,9 @@
6869
CLI_EXECUTABLE_NAME = "az"
6970
TARBALL_NAME_TEMPLATE_DEFAULT = "{APP_NAME}-{VERSION}-{PLATFORM_TAG}-nopython.tar.gz"
7071

71-
# Python version we're building for (must match Homebrew python@3.13)
72-
PYTHON_MAJOR_MINOR = "3.13"
72+
# Python version we're building for (must match Homebrew python@X.Y)
73+
# Can be overridden via --python-version CLI arg or PYTHON_MAJOR_MINOR env var
74+
PYTHON_MAJOR_MINOR = os.environ.get("PYTHON_MAJOR_MINOR", "3.13")
7375
PYTHON_BIN = "python3"
7476
TEMPLATE_DIR = Path(__file__).resolve().parent / "templates"
7577
LAUNCHER_TEMPLATE_PATH = TEMPLATE_DIR / "az_launcher.sh.in"

scripts/release/macos/cask_generate.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def generate_cask(args: argparse.Namespace) -> None:
5454
arm64_sha = _require(_env_or_arg(args.arm64_sha, "ARM64_SHA"), "arm64_sha")
5555
x86_64_sha = _require(_env_or_arg(args.x86_64_sha, "X86_64_SHA"), "x86_64_sha")
5656
github_repo = _require(_env_or_arg(args.github_repo, "GITHUB_REPO"), "github_repo")
57+
python_version = _require(_env_or_arg(args.python_version, "PYTHON_VERSION"), "python_version")
5758

5859
template_path = Path(_env_or_arg(args.template, "TEMPLATE") or DEFAULT_TEMPLATE)
5960
output_path = Path(_env_or_arg(args.output, "OUTPUT") or DEFAULT_OUTPUT)
@@ -63,6 +64,7 @@ def generate_cask(args: argparse.Namespace) -> None:
6364
"{{ arm64_sha }}": arm64_sha,
6465
"{{ x86_64_sha }}": x86_64_sha,
6566
"{{ github_repo }}": github_repo,
67+
"{{ python_version }}": python_version,
6668
}
6769

6870
content = _render_template(template_path, replacements)
@@ -75,6 +77,7 @@ def main() -> None:
7577
parser.add_argument("--arm64-sha", dest="arm64_sha", help="ARM64 tarball SHA256")
7678
parser.add_argument("--x86-64-sha", dest="x86_64_sha", help="x86_64 tarball SHA256")
7779
parser.add_argument("--github-repo", dest="github_repo", help="GitHub repo, e.g. Azure/azure-cli")
80+
parser.add_argument("--python-version", dest="python_version", help="Python major.minor version, e.g. 3.13")
7881
parser.add_argument("--template", dest="template", help="Template path (.rb.in)")
7982
parser.add_argument("--output", dest="output", help="Output cask path (.rb)")
8083
parser.set_defaults(func=generate_cask)

scripts/release/macos/templates/azure-cli.rb.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ cask "azure-cli" do
1616
strategy :github_latest
1717
end
1818

19-
depends_on formula: "python@3.13"
19+
depends_on formula: "python@{{ python_version }}"
2020

2121
binary "bin/az"
2222

0 commit comments

Comments
 (0)