diff options
author | Ben Brown <ben.brown@codethink.co.uk> | 2013-12-13 14:05:57 +0000 |
---|---|---|
committer | Ben Brown <ben.brown@codethink.co.uk> | 2013-12-16 15:25:15 +0000 |
commit | 53495e0a507a78e120d4589b52a59b5123c2ecfd (patch) | |
tree | a370e906caf48cf0ae8721c98b8b959376511c9d /morphlib/util.py | |
parent | a127ae932b5941f4376f019e5983fcfadfcc068b (diff) | |
download | morph-53495e0a507a78e120d4589b52a59b5123c2ecfd.tar.gz |
Modify morph to strip .morph extensions from parameters
Diffstat (limited to 'morphlib/util.py')
-rw-r--r-- | morphlib/util.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/morphlib/util.py b/morphlib/util.py index 16e56366..90ad425e 100644 --- a/morphlib/util.py +++ b/morphlib/util.py @@ -58,6 +58,15 @@ def indent(string, spaces=4): return '\n'.join(lines) +def strip_morph_extension(morph_name): + if morph_name.startswith('.'): + raise morphlib.Error( + 'Invalid morphology name: %s' % morph_name) + elif morph_name.endswith('.morph'): + return morph_name[:-len('.morph')] + return morph_name + + def make_concurrency(cores=None): '''Return the number of concurrent jobs for make. |