Skip to content

Commit 5556a72

Browse files
authored
Merge pull request Webperf-se#652 from Webperf-se/dep-tool-vnu
Improved vnu-jar version detection in Dependency Tool
2 parents bda774a + dc1b435 commit 5556a72

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tools/dependency.py

+22
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,28 @@ def check_package():
217217
'node_modules',
218218
dependency_name,
219219
'package.json')
220+
if dependency_name == 'vnu-jar':
221+
vnu_jar_path = os.path.join(
222+
webperf_dir,
223+
'node_modules',
224+
dependency_name,
225+
'build',
226+
'dist',
227+
'vnu.jar')
228+
if os.path.exists(vnu_jar_path):
229+
try:
230+
import zipfile
231+
archive = zipfile.ZipFile(vnu_jar_path, 'r')
232+
manifest_content = archive.read('META-INF/MANIFEST.MF').decode()
233+
if f'Implementation-Version: {dependency_version}' in manifest_content:
234+
print(f"\t\t- {dependency_name}: OK")
235+
continue
236+
except Exception as ex:
237+
print('ERROR', ex)
238+
_ = 1
239+
print(f"\t\t- {dependency_name}: Unknown version")
240+
continue
241+
220242
if not os.path.exists(dependency_package_path):
221243
print(f"\t\t- {dependency_name} v{dependency_version}: Not found")
222244
continue

0 commit comments

Comments
 (0)