changeset 38978:8f7f1d591522

module: fix applicability
author Dmitry Selyutin <ghostmansd@gmail.com>
date Tue, 19 Sep 2017 22:36:08 +0300
parents 2d142a0d4ecb
children c6cfb43bfb92
files pygnulib/module.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pygnulib/module.py	Mon Sep 18 19:43:02 2017 +0300
+++ b/pygnulib/module.py	Tue Sep 19 22:36:08 2017 +0300
@@ -130,11 +130,14 @@
     def applicability(self):
         """applicability (usually "main" or "tests")"""
         default = "main" if self.name.endswith("-tests") else "tests"
-        return self.__table.get("applicability", default)
+        result = self.__table.get("applicability")
+        return result if result else default
 
     @applicability.setter
     def applicability(self, value):
         _type_assert_("applicability", value, str)
+        if value not in ("all", "main", "tests"):
+            raise ValueError("applicability: \"main\", \"tests\" or \"all\"")
         self.__table["applicability"] = value