File tree 1 file changed +14
-14
lines changed
1 file changed +14
-14
lines changed Original file line number Diff line number Diff line change 16
16
17
17
import enum
18
18
import io
19
+ import json
19
20
import logging
20
21
import os
21
- import re
22
22
import shlex
23
23
import shutil
24
24
import subprocess
@@ -141,19 +141,19 @@ def _GetZapVersionToUse(project_root):
141
141
# This heuristic may be bad at times, however then you can also override the
142
142
# version in command line parameters
143
143
144
- match_re = re . compile ( r'.*ENV\s+ZAP_VERSION=([^# ]*)' )
145
-
146
- docker_path = os . path . join ( project_root , "integrations/docker/images/chip-build/Dockerfile" )
147
-
148
- with open ( docker_path , 'rt' ) as f :
149
- for l in f . readlines ( ):
150
- l = l . strip ( )
151
- m = match_re . match ( l )
152
- if not m :
153
- continue
154
- return m . group ( 1 )
155
-
156
- raise Exception (f"Failed to determine version from { docker_path } " )
144
+ zap_version = ""
145
+ zap_path = os . path . join ( project_root , "scripts/setup/zap.json" )
146
+ zap_json = json . load ( open ( zap_path ) )
147
+ for package in zap_json . get ( "packages" , []):
148
+ for tag in package . get ( "tags" , []) :
149
+ if tag . startswith ( "version:2@" ):
150
+ zap_version = tag . removeprefix ( "version:2@" )
151
+ suffix_index = zap_version . rfind ( "." )
152
+ if suffix_index != - 1 :
153
+ zap_version = zap_version [: suffix_index ]
154
+ return zap_version
155
+
156
+ raise Exception (f"Failed to determine version from { zap_path } " )
157
157
158
158
159
159
@click .command ()
You can’t perform that action at this time.
0 commit comments