From ac8f3be0bdb0bc7fd2ca2ff65b29f7e67fe9f8b6 Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Wed, 24 Oct 2012 10:32:46 +0300 Subject: [PATCH] misc.py: remove few unnecessary checks 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 --- mic/utils/misc.py | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/mic/utils/misc.py b/mic/utils/misc.py index 9458bae..ee018c3 100644 --- a/mic/utils/misc.py +++ b/mic/utils/misc.py @@ -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 * -- 2.7.4