summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-01-05 16:01:36 +0000
committerZac Medico <zmedico@gentoo.org>2010-01-05 16:01:36 +0000
commit25de25bf6c2550c2f00de46c62afaa83decf68ef (patch)
tree06c85b6f0e8e5ba37bbff7357e37dee16c5833d7
parent157e2065c3327e5cab22af9c74e9a46b47d18f29 (diff)
downloadportage-25de25bf6c2550c2f00de46c62afaa83decf68ef.tar.gz
portage-25de25bf6c2550c2f00de46c62afaa83decf68ef.tar.bz2
portage-25de25bf6c2550c2f00de46c62afaa83decf68ef.zip
Rearrange _selinux ImportError handling so the workaround for bug #298310
isn't necessary. svn path=/main/trunk/; revision=15167
-rw-r--r--pym/portage/__init__.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 551d2c177..23e69cabf 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -288,23 +288,19 @@ import shutil as _shutil
shutil = _unicode_module_wrapper(_shutil, encoding=_encodings['fs'])
# Imports below this point rely on the above unicode wrapper definitions.
-_selinux = None
-selinux = None
-_selinux_merge = None
try:
import portage._selinux
- # Make sure the _selinux attribute is correctly reinitialized after
- # reload(portage) is called. See bug #298310.
- _selinux = sys.modules['portage._selinux']
selinux = _unicode_module_wrapper(_selinux,
encoding=_encodings['fs'])
_selinux_merge = _unicode_module_wrapper(_selinux,
encoding=_encodings['merge'])
-except OSError as e:
- sys.stderr.write("!!! SELinux not loaded: %s\n" % str(e))
+except (ImportError, OSError) as e:
+ if isinstance(e, OSError):
+ sys.stderr.write("!!! SELinux not loaded: %s\n" % str(e))
del e
-except ImportError:
- pass
+ _selinux = None
+ selinux = None
+ _selinux_merge = None
from portage.manifest import Manifest