[game-data-packager] 13/17: Add a syntax check to "make check"

Simon McVittie smcv at debian.org
Fri Jan 2 21:11:56 UTC 2015


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch master
in repository game-data-packager.

commit ac029ad59753af05e56cf4106b74eae4f59c0a68
Author: Simon McVittie <smcv at debian.org>
Date:   Fri Jan 2 19:34:07 2015 +0000

    Add a syntax check to "make check"
---
 Makefile                               |  1 +
 lib/game_data_packager/check_syntax.py | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/Makefile b/Makefile
index c260a81..935e88b 100644
--- a/Makefile
+++ b/Makefile
@@ -104,6 +104,7 @@ clean:
 
 check:
 	./t/verify-md5sum-alternatives.sh
+	DATADIR=data PYTHONPATH=lib python3 -m game_data_packager.check_syntax
 	pyflakes3 lib/game_data_packager/*.py || :
 
 .PHONY: default clean check
diff --git a/lib/game_data_packager/check_syntax.py b/lib/game_data_packager/check_syntax.py
new file mode 100644
index 0000000..a6b9e66
--- /dev/null
+++ b/lib/game_data_packager/check_syntax.py
@@ -0,0 +1,33 @@
+#!/usr/bin/python3
+# vim:set fenc=utf-8:
+#
+# Copyright © 2014 Simon McVittie <smcv at debian.org>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+# You can find the GPL license text on a Debian system under
+# /usr/share/common-licenses/GPL-2.
+
+import glob
+import os
+import os.path
+
+from . import GameDataPackage
+
+if __name__ == '__main__':
+    datadir=os.environ['DATADIR']
+
+    for yaml in glob.glob(datadir + '/*.yaml'):
+        try:
+            GameDataPackage(os.path.splitext(os.path.basename(yaml))[0],
+                    datadir=datadir)
+        except:
+            print('Error loading %s:\n' % yaml)
+            raise

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git



More information about the Pkg-games-commits mailing list