misc.py: remove few unnecessary checks
authorArtem Bityutskiy <artem.bityutskiy@intel.com>
Wed, 24 Oct 2012 07:32:46 +0000 (10:32 +0300)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Fri, 26 Oct 2012 08:07:04 +0000 (11:07 +0300)
We use python 2.5 features in several places and we have the
'Requires:   python >= 2.5' in our RPM spec file. This means that
we do not have to check whether hashlib and xml.etree exist, we can
just use them instead, because they are part of python 2.5.

Similarly, remove the 'with_statement' importing, because 'with'
was added in 2.5.

Change-Id: I14cc9741f66f8d397744b1b37f9a55dc47877a9c
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
mic/utils/misc.py

index 9458bae..ee018c3 100644 (file)
@@ -15,7 +15,6 @@
 # with this program; if not, write to the Free Software Foundation, Inc., 59
 # Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-from __future__ import with_statement
 import os
 import sys
 import tempfile
@@ -26,21 +25,10 @@ import hashlib
 import subprocess
 import platform
 import rpmmisc
+from hashlib import md5
+import sqlite3 as sqlite
 
-try:
-    from hashlib import md5
-except ImportError:
-    from md5 import md5
-
-try:
-    import sqlite3 as sqlite
-except ImportError:
-    import sqlite
-
-try:
-    from xml.etree import cElementTree
-except ImportError:
-    import cElementTree
+from xml.etree import cElementTree
 xmlparse = cElementTree.parse
 
 from errors import *