mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
36d908f220
I don't think this ever happened to me, but it can't hurt enforcing that every release has a corresponding NEWS entry. (The script has been copied from Polari, thus the metainfo support) Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1980>
33 lines
1.1 KiB
Python
Executable File
33 lines
1.1 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import os, sys
|
|
from pathlib import Path
|
|
import argparse, subprocess
|
|
|
|
def check_version(version, file, type='news'):
|
|
if type == 'news':
|
|
line = file.open().readline()
|
|
ok = line.startswith(version)
|
|
print("{}: {}".format(file, "OK" if ok else "FAILED"))
|
|
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)
|
|
else:
|
|
raise Exception('Not implemented')
|
|
|
|
parser = argparse.ArgumentParser(description='Check release version information.')
|
|
parser.add_argument('--type', choices=['metainfo','news'], default='news')
|
|
parser.add_argument('version', help='the version to check for')
|
|
parser.add_argument('files', nargs='+', help='files to check')
|
|
args = parser.parse_args()
|
|
|
|
distroot = os.environ.get('MESON_DIST_ROOT', './')
|
|
|
|
try:
|
|
for file in args.files:
|
|
check_version(args.version, Path(distroot, file), args.type)
|
|
except:
|
|
sys.exit(1)
|