diff options
Diffstat (limited to 'mesonbuild/wrap/__init__.py')
-rw-r--r-- | mesonbuild/wrap/__init__.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/mesonbuild/wrap/__init__.py b/mesonbuild/wrap/__init__.py index b792dfa74..6be2c4492 100644 --- a/mesonbuild/wrap/__init__.py +++ b/mesonbuild/wrap/__init__.py @@ -33,6 +33,15 @@ from enum import Enum # Note that these options do not affect subprojects that # are git submodules since those are only usable in git # repositories, and you almost always want to download them. + +# This did _not_ work when inside the WrapMode class. +# I don't know why. If you can fix this, patches welcome. +string_to_value = {'default': 1, + 'nofallback': 2, + 'nodownload': 3, + 'forcefallback': 4, + } + class WrapMode(Enum): default = 1 nofallback = 2 @@ -41,3 +50,8 @@ class WrapMode(Enum): def __str__(self): return self.name + + @staticmethod + def from_string(mode_name): + g = string_to_value[mode_name] + return WrapMode(g) |