Re-Add oslo.middleware namespace for backward compat

Short Story:
If we don't do this then we have to drop,
assert:support-upgrade from nova (Really Really Bad!)

Longer Story:
We need to support kilo paste-ini until liberty-eol per policies
already in place. To do that an alternative would have been
to cap global-requirements, but that got ruled out, please
see work and reasons here:
I5731b0278e266699fe716733b6dd4f7238a35586

There's also another new spec openstack-specs that is gathering
a lot of positive votes regarding backward compat:
I72e4e9cfa0539f6b326a0296c065fa3cb754f8ae

Note that this is not a straight revert of:
I1479f37f500a358cdf7ad416f0257288b65c9245

As i just want to drop the tests and keep the files to a
minimum. The grenade job is enough to test the older
scenario (which was failing) which we need to support.

Change-Id: I04739bc3987786b4bc1fefc70fabaa69b3de52b4
Closes-Bug: 1524404
This commit is contained in:
Davanum Srinivas (dims) 2015-12-10 15:18:39 +00:00 committed by Davanum Srinivas
parent 5c06fa6ea7
commit ce6ca04280
3 changed files with 59 additions and 0 deletions

13
oslo/__init__.py Normal file
View File

@ -0,0 +1,13 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
__import__('pkg_resources').declare_namespace(__name__)

View File

@ -0,0 +1,42 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import sys
import warnings
def deprecated():
new_name = __name__.replace('.', '_')
warnings.warn(
('The oslo namespace package is deprecated. Please use %s instead.' %
new_name),
DeprecationWarning,
stacklevel=3,
)
# NOTE(dims): We cannot remove the deprecation or redirects below
# until Liberty-EOL
deprecated()
from oslo_middleware import base
from oslo_middleware import catch_errors
from oslo_middleware import correlation_id
from oslo_middleware import debug
from oslo_middleware import request_id
from oslo_middleware import sizelimit
sys.modules['oslo.middleware.base'] = base
sys.modules['oslo.middleware.catch_errors'] = catch_errors
sys.modules['oslo.middleware.correlation_id'] = correlation_id
sys.modules['oslo.middleware.debug'] = debug
sys.modules['oslo.middleware.request_id'] = request_id
sys.modules['oslo.middleware.sizelimit'] = sizelimit

View File

@ -20,7 +20,11 @@ classifier =
[files]
packages =
oslo
oslo.middleware
oslo_middleware
namespace_packages =
oslo
[entry_points]
oslo.config.opts =