remove or adopt incubated oslo code

Switch to oslo.i18n fully.

Move the old incubated apiclient package to storyboardclient._apiclient
to make it clear it is no longer maintained by the Oslo team.

Remove the configuration file for syncing from the Oslo incubator.

Update the flake8 and coverage settings to ignore the apiclient in its
new home until it is cleaned up and passes completely.

Story: 2000776
Change-Id: I017e965353a20e0af151f0db9dc0ea8da9ff4b2f
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2016-11-08 13:40:43 -05:00
parent b41d60e0c4
commit b9bdddde51
17 changed files with 60 additions and 68 deletions

View File

@ -1,7 +1,7 @@
[run]
branch = True
source = storyboardclient
omit = storyboardclient/tests/*,storyboardclient/openstack/*
omit = storyboardclient/tests/*,storyboardclient/apiclient/*
[report]
ignore_errors = True

View File

@ -1,6 +0,0 @@
[DEFAULT]
# The list of modules to copy from oslo-incubator.git
module=apiclient
# The base module to hold the copy of openstack.common
base=storyboardclient

View File

@ -6,7 +6,7 @@ pbr>=0.6,!=0.7,<1.0
Babel>=1.3
oslo.config>=1.4.0
oslo.i18n>=1.0.0
oslo.i18n>=2.1.0 # Apache-2.0
oslo.log>=3.11.0 # Apache-2.0
oslo.serialization>=1.0.0
oslo.utils>=1.0.0

View File

@ -37,7 +37,7 @@ import os
import six
from stevedore import extension
from storyboardclient.openstack.common.apiclient import exceptions
from storyboardclient._apiclient import exceptions
_discovered_plugins = {}

View File

@ -44,8 +44,8 @@ from oslo_utils import strutils
import six
from six.moves.urllib import parse
from storyboardclient.openstack.common._i18n import _
from storyboardclient.openstack.common.apiclient import exceptions
from storyboardclient._i18n import _
from storyboardclient._apiclient import exceptions
def getid(obj):

View File

@ -38,8 +38,8 @@ from oslo_utils import encodeutils
from oslo_utils import importutils
import requests
from storyboardclient.openstack.common._i18n import _
from storyboardclient.openstack.common.apiclient import exceptions
from storyboardclient._i18n import _
from storyboardclient._apiclient import exceptions
_logger = logging.getLogger(__name__)
SENSITIVE_HEADERS = ('X-Auth-Token', 'X-Subject-Token',)
@ -64,7 +64,7 @@ class HTTPClient(object):
into terminal and send the same request with curl.
"""
user_agent = "storyboardclient.openstack.common.apiclient"
user_agent = "storyboardclient._apiclient"
def __init__(self,
auth_plugin,
@ -292,7 +292,7 @@ class HTTPClient(object):
>>> def test_clients():
... from keystoneclient.auth import keystone
... from openstack.common.apiclient import client
... from openstack.common._apiclient import client
... auth = keystone.KeystoneAuthPlugin(
... username="user", password="pass", tenant_name="tenant",
... auth_url="http://auth:5000/v2.0")

View File

@ -38,7 +38,7 @@ import sys
import six
from storyboardclient.openstack.common._i18n import _
from storyboardclient._i18n import _
class ClientException(Exception):

View File

@ -43,7 +43,7 @@ import requests
import six
from six.moves.urllib import parse
from storyboardclient.openstack.common.apiclient import client
from storyboardclient._apiclient import client
def assert_has_keys(dct, required=None, optional=None):

View File

@ -28,8 +28,8 @@ from oslo_utils import encodeutils
from oslo_utils import uuidutils
import six
from storyboardclient.openstack.common._i18n import _
from storyboardclient.openstack.common.apiclient import exceptions
from storyboardclient._i18n import _
from storyboardclient._apiclient import exceptions
def find_resource(manager, name_or_id, **find_args):

43
storyboardclient/_i18n.py Normal file
View File

@ -0,0 +1,43 @@
# 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 oslo_i18n
DOMAIN = "storyboardclient"
_translators = oslo_i18n.TranslatorFactory(domain=DOMAIN)
# The primary translation function using the well-known name "_"
_ = _translators.primary
# The contextual translation function using the name "_C"
# requires oslo.i18n >=2.1.0
_C = _translators.contextual_form
# The plural translation function using the name "_P"
# requires oslo.i18n >=2.1.0
_P = _translators.plural_form
# Translators for log levels.
#
# The abbreviated names are meant to reflect the usual use of a short
# name like '_'. The "L" is for "log" and the other letter comes from
# the level.
_LI = _translators.log_info
_LW = _translators.log_warning
_LE = _translators.log_error
_LC = _translators.log_critical
def get_available_languages():
return oslo_i18n.get_available_languages(DOMAIN)

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from storyboardclient.openstack.common.apiclient import auth
from storyboardclient._apiclient import auth
class OAuthPlugin(auth.BaseAuthPlugin):

View File

@ -17,9 +17,9 @@ import inspect
import six
from storyboardclient._apiclient import base
from storyboardclient._apiclient import client
from storyboardclient.auth import oauth
from storyboardclient.openstack.common.apiclient import base
from storyboardclient.openstack.common.apiclient import client
DEFAULT_API_URL = "https://storyboard-dev.openstack.org/api/v1"

View File

@ -1,45 +0,0 @@
# 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.
"""oslo.i18n integration module.
See http://docs.openstack.org/developer/oslo.i18n/usage.html
"""
try:
import oslo_i18n
# NOTE(dhellmann): This reference to o-s-l-o will be replaced by the
# application name when this module is synced into the separate
# repository. It is OK to have more than one translation function
# using the same domain, since there will still only be one message
# catalog.
_translators = oslo_i18n.TranslatorFactory(domain='storyboardclient')
# The primary translation function using the well-known name "_"
_ = _translators.primary
# Translators for log levels.
#
# The abbreviated names are meant to reflect the usual use of a short
# name like '_'. The "L" is for "log" and the other letter comes from
# the level.
_LI = _translators.log_info
_LW = _translators.log_warning
_LE = _translators.log_error
_LC = _translators.log_critical
except ImportError:
# NOTE(dims): Support for cases where a project wants to use
# code from oslo-incubator, but is not ready to be internationalized
# (like tempest)
_ = _LI = _LW = _LE = _LC = lambda x: x

View File

@ -31,4 +31,4 @@ commands = python setup.py build_sphinx
show-source = True
ignore = E123,E125,H803,H904
builtins = _
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build
exclude=.venv,.git,.tox,dist,doc,*_apiclient*,*lib/python*,*egg,build