changeset 38979:c6cfb43bfb92

config: support bitwise options
author Dmitry Selyutin <ghostmansd@gmail.com>
date Tue, 19 Sep 2017 22:36:59 +0300
parents 8f7f1d591522
children e2d5a91aea8a
files pygnulib/config.py
diffstat 1 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pygnulib/config.py	Tue Sep 19 22:36:08 2017 +0300
+++ b/pygnulib/config.py	Tue Sep 19 22:36:59 2017 +0300
@@ -6,6 +6,7 @@
 
 import codecs as _codecs_
 import collections as _collections_
+import enum as _enum_
 import os as _os_
 import re as _re_
 
@@ -21,6 +22,18 @@
 
 
 
+class Option(_enum_.Flag):
+    Obsolete = (1 << 0)
+    Tests = (1 << 1)
+    CXX = (1 << 2)
+    Longrunning = (1 << 3)
+    Privileged = (1 << 4)
+    Unportable = (1 << 5)
+    All = (Obsolete | Tests | CXX | Longrunning | Privileged | Unportable)
+
+
+
+
 class Base:
     """gnulib generic configuration"""
     _TABLE_ = {
@@ -295,6 +308,24 @@
         self.unportable_tests = value
         self.longrunning_tests = value
 
+    @property
+    def options(self):
+        """bitmask of active options"""
+        result = ~Option.All
+        if self.obsolete:
+            result |= Option.Obsolete
+        if self.tests:
+            result |= Option.Tests
+        if self.cxx_tests:
+            result |= Option.CXX
+        if self.longrunning_tests:
+            result |= Option.Longrunning
+        if self.privileged_tests:
+            result |= Option.Privileged
+        if self.unportable_tests:
+            result |= Option.Unportable
+        return result
+
 
     @property
     def libtool(self):