Fix pylint detection, and clean up the fallout

This commit is contained in:
Cole Robinson 2012-01-31 19:07:32 -05:00
parent f42f3afe42
commit f4aa83e10f
5 changed files with 24 additions and 18 deletions

View File

@ -18,6 +18,8 @@
# MA 02110-1301 USA. # MA 02110-1301 USA.
# #
import logging
import gtk import gtk
from virtManager.baseclass import vmmGObjectUI from virtManager.baseclass import vmmGObjectUI

View File

@ -18,6 +18,8 @@
# MA 02110-1301 USA. # MA 02110-1301 USA.
# #
import logging
import virtManager.uihelpers as uihelpers import virtManager.uihelpers as uihelpers
import virtManager.util as util import virtManager.util as util
from virtManager.baseclass import vmmGObjectUI from virtManager.baseclass import vmmGObjectUI

View File

@ -69,7 +69,7 @@ def _do_we_have_session():
try: try:
ret = manager.GetSessionForUnixProcess(pid) ret = manager.GetSessionForUnixProcess(pid)
logging.debug("Found ConsoleKit session=%s" % ret) logging.debug("Found ConsoleKit session=%s", ret)
except: except:
logging.exception("Failed to lookup pid session") logging.exception("Failed to lookup pid session")
return False return False
@ -1575,7 +1575,8 @@ class vmmConnection(vmmGObject):
except Exception, e: except Exception, e:
logging.exception("Tick for VM '%s' failed", vm.get_name()) logging.exception("Tick for VM '%s' failed", vm.get_name())
if (isinstance(e, libvirt.libvirtError) and if (isinstance(e, libvirt.libvirtError) and
e.get_error_code() == libvirt.VIR_ERR_SYSTEM_ERROR): (getattr(e, "get_error_code")() ==
libvirt.VIR_ERR_SYSTEM_ERROR)):
# Try a simple getInfo call to see if conn was dropped # Try a simple getInfo call to see if conn was dropped
self.vmm.getInfo() self.vmm.getInfo()
logging.debug("vm tick raised system error but " logging.debug("vm tick raised system error but "

View File

@ -22,7 +22,6 @@ import logging
import gtk import gtk
import virtManager.util as util
from virtManager.baseclass import vmmGObjectUI from virtManager.baseclass import vmmGObjectUI
PREFS_PAGE_STATS = 0 PREFS_PAGE_STATS = 0
@ -174,7 +173,6 @@ class vmmPreferences(vmmGObjectUI):
val = self.config.get_keys_combination() val = self.config.get_keys_combination()
# We convert keysyms to names # We convert keysyms to names
print val
if not val: if not val:
keystr = "Control_L+Alt_L" keystr = "Control_L+Alt_L"
else: else:
@ -192,7 +190,6 @@ class vmmPreferences(vmmGObjectUI):
keystr = keystr + "+" + gtk.gdk.keyval_name(key) keystr = keystr + "+" + gtk.gdk.keyval_name(key)
prefs_button = self.widget("prefs-keys-grab-changebtn")
self.widget("prefs-keys-grab-sequence").set_text(keystr) self.widget("prefs-keys-grab-sequence").set_text(keystr)
def refresh_confirm_forcepoweroff(self, ignore1=None, ignore2=None, def refresh_confirm_forcepoweroff(self, ignore1=None, ignore2=None,

View File

@ -18,9 +18,6 @@ PYLINT_FILES="virtManager/ _virt-manager virtManagerTui/ _virt-manager-tui"
# Don't print pylint config warning # Don't print pylint config warning
NO_PYL_CONFIG=".*No config file found.*" NO_PYL_CONFIG=".*No config file found.*"
# The gettext function is installed in the builtin namespace
GETTEXT_VAR="Undefined variable '_'"
# Optional modules that may not be available # Optional modules that may not be available
UNABLE_IMPORT="Unable to import '(appindicator)" UNABLE_IMPORT="Unable to import '(appindicator)"
@ -44,6 +41,10 @@ INFER_ERRORS="Instance of '${INFER_LIST}.*not be inferred"
# Hacks for testing # Hacks for testing
TEST_HACKS="protected member (_is_virtinst_test_uri|_open_test_uri)" TEST_HACKS="protected member (_is_virtinst_test_uri|_open_test_uri)"
# cli/gui diff causes confusion
STUBCLASS="Instance of 'stubclass'"
DBUSINTERFACE="Instance of 'Interface'"
DMSG="" DMSG=""
skipmsg() { skipmsg() {
DMSG="${DMSG},$1" DMSG="${DMSG},$1"
@ -86,23 +87,26 @@ SHOW_REPORT="n"
AWK=awk AWK=awk
[ `uname -s` = 'SunOS' ] && AWK=nawk [ `uname -s` = 'SunOS' ] && AWK=nawk
echo "Running pylint" echo "Running pylint"
pylint --ignore=$IGNOREFILES $PYLINT_FILES \ pylint --ignore=$IGNOREFILES $PYLINT_FILES \
--additional-builtins=_ \
--reports=$SHOW_REPORT \ --reports=$SHOW_REPORT \
--output-format=colorized \ --output-format=colorized \
--dummy-variables-rgx="dummy|ignore.*|.*_ignore" \ --dummy-variables-rgx="dummy|ignore.*|.*_ignore" \
--disable=${DMSG}\ --disable=${DMSG}\
--disable=${DCHECKERS} 2>&1 | \ --disable=${DCHECKERS} 2>&1 | \
egrep -ve "$NO_PYL_CONFIG" \ egrep -ve "$NO_PYL_CONFIG" \
-ve "$GETTEXT_VAR" \ -ve "$OS_EXIT" \
-ve "$OS_EXIT" \ -ve "$BUILTIN_TYPE" \
-ve "$BUILTIN_TYPE" \ -ve "$STUBCLASS" \
-ve "$INFER_ERRORS" \ -ve "$DBUSINTERFACE" \
-ve "$MAIN_NONETYPE" \ -ve "$MAIN_NONETYPE" \
-ve "$TEST_HACKS" \ -ve "$TEST_HACKS" \
-ve "$UNABLE_IMPORT" \ -ve "$UNABLE_IMPORT" \
-ve "$STYLE_ATTACH" \ -ve "$STYLE_ATTACH" \
-ve "$VBOX_ATTACH" | \ -ve "$VBOX_PACK" \
-ve "$INFER_ERRORS" | \
$AWK '\ $AWK '\
# Strip out any "*** Module name" lines if we dont list any errors for them # Strip out any "*** Module name" lines if we dont list any errors for them
BEGIN { found=0; cur_line="" } BEGIN { found=0; cur_line="" }