summaryrefslogtreecommitdiff
path: root/morphlib
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-03-30 16:25:26 +0100
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-03-30 16:25:26 +0100
commit45655da4505ba03c84f634501ba8e8eee6f920a4 (patch)
treef6514969aacf13fd9183fff84a86a4c9f5095cd9 /morphlib
parent9573dacaa43d3d05f0e60641dcb2139623ae3007 (diff)
downloadmorph-45655da4505ba03c84f634501ba8e8eee6f920a4.tar.gz
Make build system class return artificial text for missing morphology
Diffstat (limited to 'morphlib')
-rw-r--r--morphlib/buildsystem.py14
-rw-r--r--morphlib/buildsystem_tests.py5
2 files changed, 19 insertions, 0 deletions
diff --git a/morphlib/buildsystem.py b/morphlib/buildsystem.py
index ba6d8998..8b71a640 100644
--- a/morphlib/buildsystem.py
+++ b/morphlib/buildsystem.py
@@ -40,6 +40,20 @@ class BuildSystem(object):
def __getitem__(self, key):
key = '_'.join(key.split('-'))
return getattr(self, key)
+
+ def get_morphology_text(self, name):
+ '''Return the text of an autodetected chunk morphology.'''
+
+ return '''
+ {
+ "name": "%(name)s",
+ "kind": "chunk",
+ "build-system": "%(bs)s"
+ }
+ ''' % {
+ 'name': name,
+ 'bs': self.name,
+ }
def used_by_project(self, srcdir):
'''Does project at ``srcdir`` use this build system?'''
diff --git a/morphlib/buildsystem_tests.py b/morphlib/buildsystem_tests.py
index 5d21b8ba..6d426d8c 100644
--- a/morphlib/buildsystem_tests.py
+++ b/morphlib/buildsystem_tests.py
@@ -51,6 +51,11 @@ class BuildSystemTests(unittest.TestCase):
def test_has_install_commands(self):
self.assertEqual(self.bs['install-commands'], [])
+
+ def test_returns_morphology_text(self):
+ self.bs.name = 'fake'
+ text = self.bs.get_morphology_text('foobar')
+ self.assertTrue(type(text) in (str, unicode))
class ManualBuildSystemTests(unittest.TestCase):