[magneto, rigo] Python 3 fixes in _dbus_to_string

This commit is contained in:
Sławomir Nizio
2019-12-05 22:41:53 +01:00
parent e2de60dbc3
commit 842979cbba
2 changed files with 10 additions and 4 deletions
+5 -2
View File
@@ -22,7 +22,7 @@ from threading import Lock
# Entropy imports
from entropy.output import nocolor
from entropy.client.interfaces import Client
from entropy.const import etpConst, const_debug_write
from entropy.const import etpConst, const_debug_write, const_is_python3
import entropy.tools
from entropy.i18n import _, ngettext
from entropy.misc import ParallelTask
@@ -322,7 +322,10 @@ class MagnetoCore(MagnetoCoreUI):
"""
Convert dbus.String() to unicode object
"""
return dbus_string.decode(etpConst['conf_encoding'])
if const_is_python3():
return str(dbus_string)
else:
return dbus_string.decode(etpConst['conf_encoding'])
def _updates_available_signal(self, update, update_atoms,
remove, remove_atoms,
+5 -2
View File
@@ -72,7 +72,7 @@ EntropyRepositoryCachePolicies.DEFAULT_CACHE_POLICY = _NONE_POL
from entropy.const import etpConst, const_convert_to_rawstring, \
initconfig_entropy_constants, const_debug_write, dump_signal, \
const_mkstemp
const_mkstemp, const_is_python3
from entropy.locks import EntropyResourcesLock, UpdatesNotificationResourceLock
from entropy.exceptions import DependenciesNotFound, \
DependenciesCollision, DependenciesNotRemovable, SystemDatabaseError, \
@@ -1159,7 +1159,10 @@ class RigoDaemonService(dbus.service.Object):
"""
Convert dbus.String() to unicode object
"""
return dbus_string.decode(etpConst['conf_encoding'])
if const_is_python3():
return str(dbus_string)
else:
return dbus_string.decode(etpConst['conf_encoding'])
def _execute_mainloop(self, function, *args, **kwargs):
"""