1 |
Author: zmedico |
2 |
Date: 2010-01-05 16:01:36 +0000 (Tue, 05 Jan 2010) |
3 |
New Revision: 15167 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/portage/__init__.py |
7 |
Log: |
8 |
Rearrange _selinux ImportError handling so the workaround for bug #298310 |
9 |
isn't necessary. |
10 |
|
11 |
|
12 |
Modified: main/trunk/pym/portage/__init__.py |
13 |
=================================================================== |
14 |
--- main/trunk/pym/portage/__init__.py 2010-01-04 21:30:22 UTC (rev 15166) |
15 |
+++ main/trunk/pym/portage/__init__.py 2010-01-05 16:01:36 UTC (rev 15167) |
16 |
@@ -288,23 +288,19 @@ |
17 |
shutil = _unicode_module_wrapper(_shutil, encoding=_encodings['fs']) |
18 |
|
19 |
# Imports below this point rely on the above unicode wrapper definitions. |
20 |
-_selinux = None |
21 |
-selinux = None |
22 |
-_selinux_merge = None |
23 |
try: |
24 |
import portage._selinux |
25 |
- # Make sure the _selinux attribute is correctly reinitialized after |
26 |
- # reload(portage) is called. See bug #298310. |
27 |
- _selinux = sys.modules['portage._selinux'] |
28 |
selinux = _unicode_module_wrapper(_selinux, |
29 |
encoding=_encodings['fs']) |
30 |
_selinux_merge = _unicode_module_wrapper(_selinux, |
31 |
encoding=_encodings['merge']) |
32 |
-except OSError as e: |
33 |
- sys.stderr.write("!!! SELinux not loaded: %s\n" % str(e)) |
34 |
+except (ImportError, OSError) as e: |
35 |
+ if isinstance(e, OSError): |
36 |
+ sys.stderr.write("!!! SELinux not loaded: %s\n" % str(e)) |
37 |
del e |
38 |
-except ImportError: |
39 |
- pass |
40 |
+ _selinux = None |
41 |
+ selinux = None |
42 |
+ _selinux_merge = None |
43 |
|
44 |
from portage.manifest import Manifest |