diff --git a/virt-manager-0.6.1-pylint-script.patch b/virt-manager-0.6.1-pylint-script.patch new file mode 100644 index 0000000..4a1aeb9 --- /dev/null +++ b/virt-manager-0.6.1-pylint-script.patch @@ -0,0 +1,136 @@ +diff -rupN virt-manager-0.6.1/tests/Makefile.am new/tests/Makefile.am +--- virt-manager-0.6.1/tests/Makefile.am 1969-12-31 19:00:00.000000000 -0500 ++++ new/tests/Makefile.am 2009-03-18 13:05:51.516847000 -0400 +@@ -0,0 +1,4 @@ ++testsdir = $(pkgdatadir)/tests ++tests_DATA = $(wildcard $(srcdir)/*.sh) ++ ++EXTRA_DIST = $(tests_DATA) +diff -rupN virt-manager-0.6.1/tests/pylint-virt-manager.sh new/tests/pylint-virt-manager.sh +--- virt-manager-0.6.1/tests/pylint-virt-manager.sh 1969-12-31 19:00:00.000000000 -0500 ++++ new/tests/pylint-virt-manager.sh 2009-03-18 13:05:51.513848000 -0400 +@@ -0,0 +1,115 @@ ++#!/bin/sh ++ ++# pylint doesn't work well with a file named xxx.py.xxx ++cp src/virt-manager.py.in src/_virt-manager ++ ++cd src || exit 1 ++ ++IGNOREFILES="IPy.py" ++FILES="virtManager/ _virt-manager" ++ ++# Deliberately ignored warnings: ++# Don't print pylint config warning ++NO_PYL_CONFIG=".*No config file found.*" ++ ++# The gettext function is installed in the builtin namespace ++GETTEXT_VAR="Undefined variable '_'" ++ ++# These all work fine and are legit, just false positives ++GOBJECT_VAR="has no '__gobject_init__' member" ++EMIT_VAR="has no 'emit' member" ++ERROR_VBOX="vmmErrorDialog.__init__.*Class 'vbox' has no 'pack_start' member" ++EXCEPTHOOK="no '__excepthook__' member" ++CONNECT_VAR="no 'connect' member" ++DISCONNECT_VAR="no 'disconnect' member" ++ ++# os._exit is needed for forked processes. ++OS_EXIT="protected member _exit of a client class" ++ ++# Avahi API may have requirements on callback argument names, so ignore these ++# warnings ++BTYPE_LIST="(vmmConnect.add_service|vmmConnect.remove_service|vmmConnect.add_conn_to_list)" ++BUILTIN_TYPE="${BTYPE_LIST}.*Redefining built-in 'type'" ++ ++ ++DMSG="" ++addmsg() { ++ DMSG="${DMSG},$1" ++} ++ ++addchecker() { ++ DCHECKERS="${DCHECKERS},$1" ++} ++ ++# Disabled unwanted messages ++addmsg "C0103" # C0103: Name doesn't match some style regex ++addmsg "C0111" # C0111: No docstring ++addmsg "C0301" # C0301: Line too long ++addmsg "C0302" # C0302: Too many lines in module ++addmsg "C0324" # C0324: *Comma not followed by a space* ++addmsg "R0201" # R0201: Method could be a function ++addmsg "W0105" # W0105: String statement has no effect ++addmsg "W0141" # W0141: Complaining about 'map' and 'filter' ++addmsg "W0142" # W0142: *Used * or ** magic* ++addmsg "W0403" # W0403: Relative imports ++addmsg "W0603" # W0603: Using the global statement ++addmsg "W0702" # W0703: No exception type specified ++addmsg "W0703" # W0703: Catch 'Exception' ++addmsg "W0704" # W0704: Exception doesn't do anything ++ ++# Potentially useful messages, disabled for now ++addmsg "C0322" # C0322: *Operator not preceded by a space* ++addmsg "C0323" # C0323: *Operator not followed by a space* ++addmsg "W0201" # W0201: Defined outside __init__ ++addmsg "W0511" # W0511: FIXME and XXX: messages ++addmsg "W0613" # W0613: Unused arguments ++ ++# Disabled Checkers: ++addchecker "Design" # Things like "Too many func arguments", ++ # "Too man public methods" ++addchecker "Similarities" # Finds duplicate code (enable this later?) ++ ++# May want to enable this in the future ++SHOW_REPORT="n" ++ ++AWK=awk ++[ `uname -s` = 'SunOS' ] && AWK=nawk ++ ++pylint --ignore=IPy.py $FILES \ ++ --reports=$SHOW_REPORT \ ++ --output-format=colorized \ ++ --dummy-variables-rgx="dummy|ignore*" \ ++ --disable-msg=${DMSG}\ ++ --disable-checker=${DCHECKERS} 2>&1 | \ ++ egrep -ve "$NO_PYL_CONFIG" \ ++ -ve "$GOBJECT_VAR" \ ++ -ve "$EMIT_VAR" \ ++ -ve "$CONNECT_VAR" \ ++ -ve "$DISCONNECT_VAR" \ ++ -ve "$GETTEXT_VAR" \ ++ -ve "$OS_EXIT" \ ++ -ve "$BUILTIN_TYPE" \ ++ -ve "$ERROR_VBOX" \ ++ -ve "$EXCEPTHOOK" | \ ++$AWK '\ ++# Strip out any "*** Module name" lines if we dont list any errors for them ++BEGIN { found=0; cur_line="" } ++{ ++ if (found == 1) { ++ if ( /\*\*\*/ ) { ++ prev_line = $0 ++ } else { ++ print prev_line ++ print $0 ++ found = 0 ++ } ++ } else if ( /\*\*\*/ ) { ++ found = 1 ++ prev_line = $0 ++ } else { ++ print $0 ++ } ++}' ++ ++cd - > /dev/null ++rm src/_virt-manager +diff -rup virt-manager-0.6.1/Makefile.am new/Makefile.am +--- virt-manager-0.6.1/Makefile.am 2009-01-26 14:33:33.000000000 -0500 ++++ new/Makefile.am 2009-03-18 13:25:07.912999000 -0400 +@@ -11,4 +11,4 @@ rpm: clean + $(MAKE) dist && rpmbuild -ta $(distdir).tar.gz + + check-pylint: +- tests/pylint-virt-manager.sh ++ sh tests/pylint-virt-manager.sh diff --git a/virt-manager.spec b/virt-manager.spec index bccc7cc..e485be4 100644 --- a/virt-manager.spec +++ b/virt-manager.spec @@ -22,6 +22,8 @@ Patch3: %{name}-%{version}-fix-stats-prefs.patch Patch4: %{name}-%{version}-migrate-fixes.patch # Back compat fixes for connecting to older xen installations (bz 489885) Patch5: %{name}-%{version}-rhel-fixes.patch +# Add pylint script for sanity testing the build +Patch6: %{name}-%{version}-pylint-script.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -99,6 +101,7 @@ management API. %patch3 -p1 %patch4 -p1 %patch5 -p1 +%patch6 -p1 %build %configure