build: Sync check-version script with gnome-shell
The script was updated to not require appstream-util to check for
a corresponding release element in metainfo.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/354>
(cherry picked from commit 1218aee87f)
This commit is contained in:
@@ -6,7 +6,8 @@
|
||||
|
||||
import os, sys
|
||||
from pathlib import Path
|
||||
import argparse, subprocess
|
||||
from xml.etree.ElementTree import ElementTree
|
||||
import argparse
|
||||
|
||||
def check_version(version, file, type='news'):
|
||||
if type == 'news':
|
||||
@@ -16,8 +17,11 @@ def check_version(version, file, type='news'):
|
||||
if not ok:
|
||||
raise Exception("{} does not start with {}".format(file, version))
|
||||
elif type == 'metainfo':
|
||||
subprocess.run(['appstream-util', 'validate-version', file, version],
|
||||
check=True)
|
||||
query = './releases/release[@version="{}"]'.format(version)
|
||||
ok = ElementTree(file=file).find(query) is not None
|
||||
print("{}: {}".format(file, "OK" if ok else "FAILED"))
|
||||
if not ok:
|
||||
raise Exception("{} does not contain release {}".format(file, version))
|
||||
else:
|
||||
raise Exception('Not implemented')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user