c2b5a3f6b4
This will get used in upcoming patches that actually create RPC aliases. Thanks to Ben Walker for help on the deprecated_alias helper. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: Ica4432888b1ecb9bd234690758f67ef82794c50a Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453035 Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
17 lines
461 B
Python
17 lines
461 B
Python
import sys
|
|
|
|
deprecated_aliases = {}
|
|
|
|
|
|
def deprecated_alias(old_name):
|
|
def wrap(f):
|
|
def old_f(*args, **kwargs):
|
|
ret = f(*args, **kwargs)
|
|
print("{} is deprecated, use {} instead.".format(old_name, f.__name__), file=sys.stderr)
|
|
return ret
|
|
old_f.__name__ = old_name
|
|
deprecated_aliases[old_name] = f.__name__
|
|
setattr(sys.modules[f.__module__], old_name, old_f)
|
|
return f
|
|
return wrap
|