add utils/compat.py

This commit is contained in:
Matthew Williams 2015-04-17 04:58:30 +00:00
parent 53b0f0c93f
commit 8db0ccf529

22
salt/utils/compat.py Normal file
View File

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
'''
Compatibility functions for utils
'''
# Import python libs
from __future__ import absolute_import
import sys
# Import salt libs
import salt.loader
def pack_dunder(name):
'''
Compatibility helper function to make __utils__ available on demand.
'''
# TODO: Deprecate starting with Beryllium
mod = sys.modules[name]
if not hasattr(mod, '__utils__'):
setattr(mod, '__utils__', salt.loader.utils(mod.__opts__))