[gtk-doc] check: don't require a Makefile as a fallback



commit 95a93122a2934e618024f291620edd9c9a3c4e3b
Author: Stefan Sauer <ensonic users sf net>
Date:   Thu Sep 7 20:45:50 2017 +0200

    check: don't require a Makefile as a fallback
    
    This lets us support other buildsystems.
    Fixes #787359

 gtkdoc/check.py |    6 +++++-
 tests/check.py  |    5 +++++
 2 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/gtkdoc/check.py b/gtkdoc/check.py
index de5eafd..0a58b0c 100755
--- a/gtkdoc/check.py
+++ b/gtkdoc/check.py
@@ -130,7 +130,11 @@ def run(options=None):
     makefilename = 'Makefile.am'
     if not os.path.exists(makefilename):
         makefilename = 'Makefile'
-    makefile = read_file(makefilename)
+    makefile = []
+    try:
+        makefile = read_file(makefilename)
+    except (OSError, IOError):
+        pass
 
     # For historic reasons tests are launched in srcdir
     workdir = os.environ.get('BUILDDIR', None)
diff --git a/tests/check.py b/tests/check.py
index 2508cd0..997aa6e 100755
--- a/tests/check.py
+++ b/tests/check.py
@@ -46,6 +46,11 @@ class TestCheck(unittest.TestCase):
         result = check.get_variable({}, ['foo = bar'], 'foo')
         self.assertEqual('bar', result)
 
+    def test_get_variable_empty_file(self):
+        with self.assertRaises(check.FileFormatError) as ctx:
+            check.get_variable({'foo': 'bar'}, [], 'foo')
+        self.assertEqual(str(ctx.exception), 'foo')
+
 
 if __name__ == '__main__':
     unittest.main()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]