Skip to content

Commit

Permalink
Use version from zap.json to download zap (#25791)
Browse files Browse the repository at this point in the history
  • Loading branch information
lebauce authored and pull[bot] committed Jan 17, 2024
1 parent 8e078f8 commit 1222932
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions scripts/tools/zap/zap_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

import enum
import io
import json
import logging
import os
import re
import shlex
import shutil
import subprocess
Expand Down Expand Up @@ -141,19 +141,19 @@ def _GetZapVersionToUse(project_root):
# This heuristic may be bad at times, however then you can also override the
# version in command line parameters

match_re = re.compile(r'.*ENV\s+ZAP_VERSION=([^# ]*)')

docker_path = os.path.join(project_root, "integrations/docker/images/chip-build/Dockerfile")

with open(docker_path, 'rt') as f:
for l in f.readlines():
l = l.strip()
m = match_re.match(l)
if not m:
continue
return m.group(1)

raise Exception(f"Failed to determine version from {docker_path}")
zap_version = ""
zap_path = os.path.join(project_root, "scripts/setup/zap.json")
zap_json = json.load(open(zap_path))
for package in zap_json.get("packages", []):
for tag in package.get("tags", []):
if tag.startswith("version:2@"):
zap_version = tag.removeprefix("version:2@")
suffix_index = zap_version.rfind(".")
if suffix_index != -1:
zap_version = zap_version[:suffix_index]
return zap_version

raise Exception(f"Failed to determine version from {zap_path}")


@click.command()
Expand Down

0 comments on commit 1222932

Please sign in to comment.