diff options
Diffstat (limited to 'poky/bitbake/lib/bb/utils.py')
-rw-r--r-- | poky/bitbake/lib/bb/utils.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/poky/bitbake/lib/bb/utils.py b/poky/bitbake/lib/bb/utils.py index 0b79f92e25..f73d31fb73 100644 --- a/poky/bitbake/lib/bb/utils.py +++ b/poky/bitbake/lib/bb/utils.py @@ -944,6 +944,17 @@ def which(path, item, direction = 0, history = False, executable=False): return "", hist return "" +@contextmanager +def umask(new_mask): + """ + Context manager to set the umask to a specific mask, and restore it afterwards. + """ + current_mask = os.umask(new_mask) + try: + yield + finally: + os.umask(current_mask) + def to_boolean(string, default=None): if not string: return default |