Browse Source

Port to use oslo.i18n

Module gettextutils from oslo-incubator was graduated to separate
library (oslo.i18n) and removed from repository, so we should use
new library.

Change-Id: I15d36ac5a2bb88b332ffa38d29488b75c55a20a9
Andrey Kurilin 4 years ago
parent
commit
dc09cf27e3

+ 1
- 1
novaclient/client.py View File

@@ -44,7 +44,7 @@ except ImportError:
44 44
 from six.moves.urllib import parse
45 45
 
46 46
 from novaclient import exceptions
47
-from novaclient.openstack.common.gettextutils import _
47
+from novaclient.i18n import _
48 48
 from novaclient import service_catalog
49 49
 from novaclient import utils
50 50
 

+ 35
- 0
novaclient/i18n.py View File

@@ -0,0 +1,35 @@
1
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
2
+# not use this file except in compliance with the License. You may obtain
3
+# a copy of the License at
4
+#
5
+#      http://www.apache.org/licenses/LICENSE-2.0
6
+#
7
+# Unless required by applicable law or agreed to in writing, software
8
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10
+# License for the specific language governing permissions and limitations
11
+# under the License.
12
+
13
+"""oslo.i18n integration module for novaclient.
14
+
15
+See http://docs.openstack.org/developer/oslo.i18n/usage.html .
16
+
17
+"""
18
+
19
+from oslo import i18n
20
+
21
+
22
+_translators = i18n.TranslatorFactory(domain='novaclient')
23
+
24
+# The primary translation function using the well-known name "_"
25
+_ = _translators.primary
26
+
27
+# Translators for log levels.
28
+#
29
+# The abbreviated names are meant to reflect the usual use of a short
30
+# name like '_'. The "L" is for "log" and the other letter comes from
31
+# the level.
32
+_LI = _translators.log_info
33
+_LW = _translators.log_warning
34
+_LE = _translators.log_error
35
+_LC = _translators.log_critical

+ 1
- 1
novaclient/shell.py View File

@@ -47,8 +47,8 @@ import novaclient.auth_plugin
47 47
 from novaclient import client
48 48
 from novaclient import exceptions as exc
49 49
 import novaclient.extension
50
+from novaclient.i18n import _
50 51
 from novaclient.openstack.common import cliutils
51
-from novaclient.openstack.common.gettextutils import _
52 52
 from novaclient import utils
53 53
 from novaclient.v1_1 import shell as shell_v1_1
54 54
 from novaclient.v3 import shell as shell_v3

+ 1
- 1
novaclient/utils.py View File

@@ -23,8 +23,8 @@ import prettytable
23 23
 import six
24 24
 
25 25
 from novaclient import exceptions
26
+from novaclient.i18n import _
26 27
 from novaclient.openstack.common import cliutils
27
-from novaclient.openstack.common.gettextutils import _
28 28
 
29 29
 
30 30
 arg = cliutils.arg

+ 2
- 1
novaclient/v1_1/contrib/baremetal.py View File

@@ -16,8 +16,9 @@
16 16
 """
17 17
 Baremetal interface (v2 extension).
18 18
 """
19
+
19 20
 from novaclient import base
20
-from novaclient.openstack.common.gettextutils import _
21
+from novaclient.i18n import _
21 22
 from novaclient import utils
22 23
 
23 24
 

+ 1
- 1
novaclient/v1_1/contrib/cells.py View File

@@ -14,7 +14,7 @@
14 14
 #    under the License.
15 15
 
16 16
 from novaclient import base
17
-from novaclient.openstack.common.gettextutils import _
17
+from novaclient.i18n import _
18 18
 from novaclient import utils
19 19
 
20 20
 

+ 1
- 1
novaclient/v1_1/contrib/host_evacuate.py View File

@@ -14,7 +14,7 @@
14 14
 #    under the License.
15 15
 
16 16
 from novaclient import base
17
-from novaclient.openstack.common.gettextutils import _
17
+from novaclient.i18n import _
18 18
 from novaclient import utils
19 19
 
20 20
 

+ 1
- 1
novaclient/v1_1/contrib/host_evacuate_live.py View File

@@ -13,7 +13,7 @@
13 13
 #    License for the specific language governing permissions and limitations
14 14
 #    under the License.
15 15
 
16
-from novaclient.openstack.common.gettextutils import _
16
+from novaclient.i18n import _
17 17
 from novaclient import utils
18 18
 
19 19
 

+ 1
- 1
novaclient/v1_1/contrib/host_servers_migrate.py View File

@@ -14,7 +14,7 @@
14 14
 #    under the License.
15 15
 
16 16
 from novaclient import base
17
-from novaclient.openstack.common.gettextutils import _
17
+from novaclient.i18n import _
18 18
 from novaclient import utils
19 19
 
20 20
 

+ 1
- 1
novaclient/v1_1/contrib/instance_action.py View File

@@ -16,7 +16,7 @@
16 16
 import pprint
17 17
 
18 18
 from novaclient import base
19
-from novaclient.openstack.common.gettextutils import _
19
+from novaclient.i18n import _
20 20
 from novaclient import utils
21 21
 
22 22
 

+ 1
- 1
novaclient/v1_1/contrib/metadata_extensions.py View File

@@ -13,7 +13,7 @@
13 13
 #    License for the specific language governing permissions and limitations
14 14
 #    under the License.
15 15
 
16
-from novaclient.openstack.common.gettextutils import _
16
+from novaclient.i18n import _
17 17
 from novaclient import utils
18 18
 from novaclient.v1_1 import shell
19 19
 

+ 1
- 1
novaclient/v1_1/contrib/migrations.py View File

@@ -17,7 +17,7 @@ migration interface
17 17
 from six.moves.urllib import parse
18 18
 
19 19
 from novaclient import base
20
-from novaclient.openstack.common.gettextutils import _
20
+from novaclient.i18n import _
21 21
 from novaclient import utils
22 22
 
23 23
 

+ 1
- 1
novaclient/v1_1/contrib/tenant_networks.py View File

@@ -13,7 +13,7 @@
13 13
 # limitations under the License.
14 14
 
15 15
 from novaclient import base
16
-from novaclient.openstack.common.gettextutils import _
16
+from novaclient.i18n import _
17 17
 from novaclient import utils
18 18
 
19 19
 

+ 1
- 1
novaclient/v1_1/flavor_access.py View File

@@ -16,7 +16,7 @@
16 16
 """Flavor access interface."""
17 17
 
18 18
 from novaclient import base
19
-from novaclient.openstack.common.gettextutils import _
19
+from novaclient.i18n import _
20 20
 
21 21
 
22 22
 class FlavorAccess(base.Resource):

+ 1
- 1
novaclient/v1_1/flavors.py View File

@@ -21,7 +21,7 @@ from six.moves.urllib import parse
21 21
 
22 22
 from novaclient import base
23 23
 from novaclient import exceptions
24
-from novaclient.openstack.common.gettextutils import _
24
+from novaclient.i18n import _
25 25
 from novaclient import utils
26 26
 
27 27
 

+ 1
- 1
novaclient/v1_1/networks.py View File

@@ -19,7 +19,7 @@ Network interface.
19 19
 
20 20
 from novaclient import base
21 21
 from novaclient import exceptions
22
-from novaclient.openstack.common.gettextutils import _
22
+from novaclient.i18n import _
23 23
 
24 24
 
25 25
 class Network(base.Resource):

+ 1
- 1
novaclient/v1_1/security_group_default_rules.py View File

@@ -16,7 +16,7 @@ Security group default rules interface.
16 16
 
17 17
 from novaclient import base
18 18
 from novaclient import exceptions
19
-from novaclient.openstack.common.gettextutils import _
19
+from novaclient.i18n import _
20 20
 
21 21
 
22 22
 class SecurityGroupDefaultRule(base.Resource):

+ 1
- 1
novaclient/v1_1/security_group_rules.py View File

@@ -19,7 +19,7 @@ Security group rules interface (1.1 extension).
19 19
 
20 20
 from novaclient import base
21 21
 from novaclient import exceptions
22
-from novaclient.openstack.common.gettextutils import _
22
+from novaclient.i18n import _
23 23
 
24 24
 
25 25
 class SecurityGroupRule(base.Resource):

+ 1
- 1
novaclient/v1_1/servers.py View File

@@ -27,7 +27,7 @@ from six.moves.urllib import parse
27 27
 
28 28
 from novaclient import base
29 29
 from novaclient import crypto
30
-from novaclient.openstack.common.gettextutils import _
30
+from novaclient.i18n import _
31 31
 from novaclient.v1_1 import security_groups
32 32
 
33 33
 

+ 1
- 1
novaclient/v1_1/shell.py View File

@@ -34,8 +34,8 @@ from oslo.utils import timeutils
34 34
 import six
35 35
 
36 36
 from novaclient import exceptions
37
+from novaclient.i18n import _
37 38
 from novaclient.openstack.common import cliutils
38
-from novaclient.openstack.common.gettextutils import _
39 39
 from novaclient.openstack.common import uuidutils
40 40
 from novaclient import utils
41 41
 from novaclient.v1_1 import availability_zones

+ 2
- 1
novaclient/v3/servers.py View File

@@ -27,7 +27,8 @@ from six.moves.urllib import parse
27 27
 
28 28
 from novaclient import base
29 29
 from novaclient import crypto
30
-from novaclient.openstack.common.gettextutils import _
30
+from novaclient.i18n import _
31
+
31 32
 
32 33
 REBOOT_SOFT, REBOOT_HARD = 'SOFT', 'HARD'
33 34
 

+ 1
- 1
novaclient/v3/shell.py View File

@@ -32,8 +32,8 @@ from oslo.utils import timeutils
32 32
 import six
33 33
 
34 34
 from novaclient import exceptions
35
+from novaclient.i18n import _
35 36
 from novaclient.openstack.common import cliutils
36
-from novaclient.openstack.common.gettextutils import _
37 37
 from novaclient.openstack.common import uuidutils
38 38
 from novaclient import utils
39 39
 from novaclient.v3 import availability_zones

+ 0
- 1
openstack-common.conf View File

@@ -3,7 +3,6 @@
3 3
 # The list of modules to copy from oslo-incubator
4 4
 module=apiclient
5 5
 module=cliutils
6
-module=gettextutils
7 6
 module=install_venv_common
8 7
 module=uuidutils
9 8
 

+ 1
- 0
requirements.txt View File

@@ -4,6 +4,7 @@
4 4
 pbr>=0.6,!=0.7,<1.0
5 5
 argparse
6 6
 iso8601>=0.1.9
7
+oslo.i18n>=1.0.0                        # Apache-2.0
7 8
 oslo.serialization>=1.0.0               # Apache-2.0
8 9
 oslo.utils>=1.0.0                       # Apache-2.0
9 10
 PrettyTable>=0.7,<0.8

+ 1
- 1
tox.ini View File

@@ -48,4 +48,4 @@ show-source = True
48 48
 exclude=.venv,.git,.tox,dist,*openstack/common*,*lib/python*,*egg,build,doc/source/conf.py
49 49
 
50 50
 [hacking]
51
-import_exceptions = novaclient.openstack.common.gettextutils
51
+import_exceptions = novaclient.i18n

Loading…
Cancel
Save