Add importing file to import warnings

Add the Python file doing the import to the warnings emitted by
the modules moved to osc-lib. Users will at least have a hint as
to which package is out-of-date.

Change-Id: I633b440c30b2b15cfde7a9013e30dfa39ab200bc
This commit is contained in:
Dean Troyer 2016-08-30 09:20:59 -05:00
parent 84c83fc3ae
commit 110a62f277
7 changed files with 28 additions and 7 deletions

View File

@ -14,12 +14,15 @@
# NOTE(dtroyer): This file is deprecated in Jun 2016, remove after 4.x release
# or Jun 2017.
import inspect
import sys
from osc_lib.api.auth import * # noqa
parent_import = inspect.getouterframes(inspect.currentframe())[1][1]
sys.stderr.write(
"WARNING: %s is deprecated and will be removed after Jun 2017. "
"Please use osc_lib.api.auth\n" % __name__
"Please use osc_lib.api.auth. This warning is caused by an "
"out-of-date import in %s\n" % (__name__, parent_import)
)

View File

@ -15,12 +15,15 @@
# NOTE(dtroyer): This file is deprecated in Jun 2016, remove after 4.x release
# or Jun 2017.
import inspect
import sys
from osc_lib.command.command import * # noqa
parent_import = inspect.getouterframes(inspect.currentframe())[1][1]
sys.stderr.write(
"WARNING: %s is deprecated and will be removed after Jun 2017. "
"Please use osc_lib.command.command\n" % __name__
"Please use osc_lib.command.command. This warning is caused by an "
"out-of-date import in %s\n" % (__name__, parent_import)
)

View File

@ -14,12 +14,15 @@
# NOTE(dtroyer): This file is deprecated in Jun 2016, remove after 4.x release
# or Jun 2017.
import inspect
import sys
from osc_lib.exceptions import * # noqa
parent_import = inspect.getouterframes(inspect.currentframe())[1][1]
sys.stderr.write(
"WARNING: %s is deprecated and will be removed after Jun 2017. "
"Please use osc_lib.exceptions\n" % __name__
"Please use osc_lib.exceptions. This warning is caused by an "
"out-of-date import in %s\n" % (__name__, parent_import)
)

View File

@ -14,13 +14,16 @@
# NOTE(dtroyer): This file is deprecated in Jun 2016, remove after 4.x release
# or Jun 2017.
import inspect
import sys
from osc_lib.logs import * # noqa
from osc_lib.logs import _FileFormatter # noqa
parent_import = inspect.getouterframes(inspect.currentframe())[1][1]
sys.stderr.write(
"WARNING: %s is deprecated and will be removed after Jun 2017. "
"Please use osc_lib.logs\n" % __name__
"Please use osc_lib.logs. This warning is caused by an "
"out-of-date import in %s\n" % (__name__, parent_import)
)

View File

@ -14,12 +14,15 @@
# NOTE(dtroyer): This file is deprecated in Jun 2016, remove after 4.x release
# or Jun 2017.
import inspect
import sys
from osc_lib.cli.parseractions import * # noqa
parent_import = inspect.getouterframes(inspect.currentframe())[1][1]
sys.stderr.write(
"WARNING: %s is deprecated and will be removed after Jun 2017. "
"Please use osc_lib.cli.parseractions\n" % __name__
"Please use osc_lib.cli.parseractions. This warning is caused by an "
"out-of-date import in %s\n" % (__name__, parent_import)
)

View File

@ -14,12 +14,15 @@
# NOTE(dtroyer): This file is deprecated in Jun 2016, remove after 4.x release
# or Jun 2017.
import inspect
import sys
from osc_lib.command.timing import * # noqa
parent_import = inspect.getouterframes(inspect.currentframe())[1][1]
sys.stderr.write(
"WARNING: %s is deprecated and will be removed after Jun 2017. "
"Please use osc_lib.command.timing\n" % __name__
"Please use osc_lib.command.timing. This warning is caused by an "
"out-of-date import in %s\n" % (__name__, parent_import)
)

View File

@ -14,12 +14,15 @@
# NOTE(dtroyer): This file is deprecated in Jun 2016, remove after 4.x release
# or Jun 2017.
import inspect
import sys
from osc_lib.utils import * # noqa
parent_import = inspect.getouterframes(inspect.currentframe())[1][1]
sys.stderr.write(
"WARNING: %s is deprecated and will be removed after Jun 2017. "
"Please use osc_lib.utils\n" % __name__
"Please use osc_lib.utils. This warning is caused by an "
"out-of-date import in %s\n" % (__name__, parent_import)
)