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