aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2020-03-26 17:05:46 -0400
committerJake Hunsaker <jhunsake@redhat.com>2020-04-08 09:27:16 -0400
commit63742b322481eca01f902c2a3fde98200b6c0ef2 (patch)
tree7468fef7a752e2f8fc2965fe4f28b3d0d18791cd
parent6a3b296de560e6b4abc1ec56cf34b0028a04a878 (diff)
downloadsos-63742b322481eca01f902c2a3fde98200b6c0ef2.tar.gz
[utilities] Move _sos back into sos/__init__.py
Moving the `_sos_ definition wrapper for gettext into utilities proved to be the wrong direction, so this moves it back into sos/__init__.py in order to preserve the ability to properly import it elsewhere. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r--sos/__init__.py10
-rw-r--r--sos/policies/__init__.py2
-rw-r--r--sos/utilities.py12
3 files changed, 11 insertions, 13 deletions
diff --git a/sos/__init__.py b/sos/__init__.py
index e367d6a7..67871f13 100644
--- a/sos/__init__.py
+++ b/sos/__init__.py
@@ -24,6 +24,16 @@ import tempfile
from argparse import ArgumentParser
from sos.options import SosListOption
+import gettext
+gettext_dir = "/usr/share/locale"
+gettext_app = "sos"
+gettext.bindtextdomain(gettext_app, gettext_dir)
+
+def _default(msg):
+ return gettext.dgettext(gettext_app, msg)
+
+_sos = _default
+
class SoS():
"""Main entrypoint for sos from the command line
diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py
index 207ca793..91e8be0e 100644
--- a/sos/policies/__init__.py
+++ b/sos/policies/__init__.py
@@ -18,8 +18,8 @@ from sos.utilities import (ImporterHelper,
shell_out,
sos_get_command_output)
from sos.report.plugins import IndependentPlugin, ExperimentalPlugin
-from sos.utilities import _sos as _
from sos.options import SoSOptions
+from sos import _sos as _
from textwrap import fill
from six import print_
from six.moves import input
diff --git a/sos/utilities.py b/sos/utilities.py
index 5ac90be9..7921dfa7 100644
--- a/sos/utilities.py
+++ b/sos/utilities.py
@@ -20,7 +20,6 @@ import glob
import tempfile
import threading
import time
-import gettext
from contextlib import closing
from collections import deque
@@ -28,17 +27,6 @@ from collections import deque
# PYCOMPAT
import six
-gettext_dir = "/usr/share/locale"
-gettext_app = "sos"
-
-gettext.bindtextdomain(gettext_app, gettext_dir)
-
-
-def _default(msg):
- return gettext.dgettext(gettext_app, msg)
-
-
-_sos = _default
def tail(filename, number_of_bytes):
"""Returns the last number_of_bytes of filename"""