summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2021-02-25 09:24:38 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2021-03-10 09:39:44 +0000
commit242578ac6ef807bf20125f0fdd14c5e4cb17e176 (patch)
treea993809c6819e74014e8cb10768c72783fbb23ef
parent388aa4870a5344505297a18e8fea233f40f12693 (diff)
Integrate the keysym verifier into make check
autotools can't pass arguments, so let's default to 'verify' in the script itself and for distcheck to succeed, we need to set an environment variable to search for the header (it's an out-of-tree build). And due to the very faint chance of there being no python during the xorgproto build, let's make that conditional too. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--.gitlab-ci.yml1
-rw-r--r--Makefile.am8
-rw-r--r--configure.ac3
-rwxr-xr-xscripts/keysym-generator.py11
4 files changed, 19 insertions, 4 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 43e4288..b4433b0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -58,6 +58,7 @@ autotools:
- autoreconf -ivf
- pushd _build
- ../configure --prefix="$PWD/../_inst" $CONFIGURE_OPTIONS
+ - make check
- make install
- make distcheck
- mv xorgproto*.tar.gz ..
diff --git a/Makefile.am b/Makefile.am
index 4a39da1..3d59178 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -487,3 +487,11 @@ EXTRA_DIST = \
AM_DISTCHECK_CONFIGURE_FLAGS = --enable-legacy
+
+if HAVE_PYTHON
+AM_TESTS_ENVIRONMENT = \
+ INCLUDESDIR=$(top_srcdir)/include
+TESTS = scripts/keysym-generator.py
+TEST_EXTENSIONS = .py
+PY_LOG_COMPILER = $(PYTHON)
+endif
diff --git a/configure.ac b/configure.ac
index e84642b..523f711 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,6 +37,9 @@ XORG_WITH_FOP
XORG_WITH_XSLTPROC
XORG_CHECK_SGML_DOCTOOLS(1.8)
+AM_PATH_PYTHON([3.6], , [:])
+AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
+
AC_CANONICAL_HOST
AC_ARG_ENABLE(legacy,
diff --git a/scripts/keysym-generator.py b/scripts/keysym-generator.py
index e0db965..a583e80 100755
--- a/scripts/keysym-generator.py
+++ b/scripts/keysym-generator.py
@@ -13,6 +13,7 @@
import argparse
import logging
+import os
import sys
import re
import libevdev
@@ -385,9 +386,10 @@ def find_xf86keysym_header():
"""
paths = tuple(Path.cwd().glob("**/XF86keysym.h"))
if not paths:
- path = Path("/usr/include/X11/XF86keysym.h")
+ fallbackdir = Path(os.getenv("INCLUDESDIR") or "/usr/include/")
+ path = fallbackdir / "X11" / "XF86keysym.h"
if not path.exists():
- die("Unable to find XF86keysym.h in CWD or /usr")
+ die(f"Unable to find XF86keysym.h in CWD or {fallbackdir}")
else:
if len(paths) > 1:
die("Multiple XF86keysym.h in CWD, please use --header")
@@ -409,7 +411,7 @@ def main():
subparsers = parser.add_subparsers(help="command-specific help", dest="command")
parser_verify = subparsers.add_parser(
- "verify", help="Verify the XF86keysym.h matches requirements"
+ "verify", help="Verify the XF86keysym.h matches requirements (default)"
)
parser_verify.set_defaults(func=verify)
@@ -443,7 +445,8 @@ def main():
ns.header = Path(ns.header)
if ns.command is None:
- parser.error("Invalid or missing command")
+ print("No command specified, defaulting to verify'")
+ ns.func = verify
sys.exit(ns.func(ns))