summaryrefslogtreecommitdiffstats
path: root/meson
diff options
context:
space:
mode:
Diffstat (limited to 'meson')
-rwxr-xr-xmeson/check-version.py32
-rw-r--r--meson/generate-manpages.py23
-rw-r--r--meson/generate-stylesheets.py19
3 files changed, 74 insertions, 0 deletions
diff --git a/meson/check-version.py b/meson/check-version.py
new file mode 100755
index 0000000..81750c9
--- /dev/null
+++ b/meson/check-version.py
@@ -0,0 +1,32 @@
+#!/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)
diff --git a/meson/generate-manpages.py b/meson/generate-manpages.py
new file mode 100644
index 0000000..e12df61
--- /dev/null
+++ b/meson/generate-manpages.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python3
+
+import os
+from pathlib import PurePath
+import subprocess
+
+man_pages = [
+ 'man/gnome-shell.1',
+ 'subprojects/extensions-tool/man/gnome-extensions.1',
+]
+
+sourceroot = os.environ.get('MESON_SOURCE_ROOT')
+distroot = os.environ.get('MESON_DIST_ROOT')
+
+for man_page in man_pages:
+ page_path = PurePath(man_page)
+ src = PurePath(sourceroot, page_path.with_suffix('.txt'))
+ dst = PurePath(distroot, page_path)
+ stylesheet = src.with_name('stylesheet.xsl')
+
+ subprocess.call(['a2x', '--xsl-file', os.fspath(stylesheet),
+ '--format', 'manpage', '--destination-dir', os.fspath(dst.parent),
+ os.fspath(src)])
diff --git a/meson/generate-stylesheets.py b/meson/generate-stylesheets.py
new file mode 100644
index 0000000..bd6b641
--- /dev/null
+++ b/meson/generate-stylesheets.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python3
+
+import os
+from pathlib import PurePath
+import subprocess
+
+stylesheets = [
+ 'data/theme/gnome-shell-high-contrast.css',
+ 'data/theme/gnome-shell.css'
+]
+
+sourceroot = os.environ.get('MESON_SOURCE_ROOT')
+distroot = os.environ.get('MESON_DIST_ROOT')
+
+for stylesheet in stylesheets:
+ stylesheet_path = PurePath(stylesheet)
+ src = PurePath(sourceroot, stylesheet_path.with_suffix('.scss'))
+ dst = PurePath(distroot, stylesheet_path)
+ subprocess.run(['sassc', '-a', src, dst], check=True)