On 08/19/2013 12:29 PM, Petr Viktorin wrote:
Hello,
The first patch fixes a minor problem that Pylint 1.0 finds in our code.

The second patch makes make-lint compatible with Pylint 1.0. It contains
a workaround for a Pylint bug; before pushing this we should wait for a
while to see if a fixed Pylint is released.


A fixed version of Pylint was released, bug workarounds are no longer necessary.

Updated patches attached.

https://fedorahosted.org/freeipa/ticket/3865

--
PetrĀ³
From 7011b32d4773eeabc8ff136ab361e38d6e87a07a Mon Sep 17 00:00:00 2001
From: Petr Viktorin <pvikt...@redhat.com>
Date: Mon, 19 Aug 2013 12:01:54 +0200
Subject: [PATCH] Remove __all__ specifications in ipaclient and
 ipaserver.install

The __all__ list does not cause submodules to be imported, e.g.
one would still have to `import ipaclient.ipachangeconf` rather than
just `import ipaclient` to use `ipaclient.ipachangeconf`.

Even if they did do anything, the lists were incomplete, and (since
`import *` is not used on these modules) unnecessary.

Pylint 1.0 reports undeclared names in __all__ as a warning.
---
 ipa-client/ipaclient/__init__.py | 3 ---
 ipaserver/install/__init__.py    | 2 --
 2 files changed, 5 deletions(-)

diff --git a/ipa-client/ipaclient/__init__.py b/ipa-client/ipaclient/__init__.py
index 39c97d2fd6b3113eaab6384fe97f0ef27e4e67f3..65ab6ac3ed33541bd8a6d9a50ddc1f04ecaa5e6f 100644
--- a/ipa-client/ipaclient/__init__.py
+++ b/ipa-client/ipaclient/__init__.py
@@ -16,6 +16,3 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
-
-__all__ = ["ipadiscovery", "ipachangeconf"]
-
diff --git a/ipaserver/install/__init__.py b/ipaserver/install/__init__.py
index bc2229415f278dca3294d34578e454f1971a54fc..fc08ea43921b27216df7d5e9d8cba46e1123422a 100644
--- a/ipaserver/install/__init__.py
+++ b/ipaserver/install/__init__.py
@@ -17,5 +17,3 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
-
-__all__ = ["dsinstance", "krbinstance"]
-- 
1.8.3.1

From a6afdd5412efef580a19c0bc6c73b255a6ded05b Mon Sep 17 00:00:00 2001
From: Petr Viktorin <pvikt...@redhat.com>
Date: Mon, 19 Aug 2013 12:18:54 +0200
Subject: [PATCH] Make make-lint compatible with Pylint 1.0

Pylint 1.0 was released[0] and it brings some incompatibilities,
as well as a bug[1] that's triggered by FreeIPA code.

This patch updates make-lint to be compatible with Pylint 1.0,
while keeping support for version 0.26.

[0] http://www.logilab.org/blogentry/163292
[1] https://bitbucket.org/logilab/pylint/issue/47

Ticket: https://fedorahosted.org/freeipa/ticket/3865
---
 make-lint | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/make-lint b/make-lint
index fd7bea2130b94f07ff3e19f8168f95fa561b50fc..d9c66a847c9b62f313c7d057e4805285af8a2d0d 100755
--- a/make-lint
+++ b/make-lint
@@ -28,9 +28,17 @@ from fnmatch import fnmatch, fnmatchcase
 try:
     from pylint import checkers
     from pylint.lint import PyLinter
-    from pylint.reporters.text import ParseableTextReporter
     from pylint.checkers.typecheck import TypeChecker
-    from logilab.astng import Class, Instance, InferenceError
+    try:
+        # Pylint 1.0
+        from astroid import Class, Instance, InferenceError
+        from pylint.reporters.text import TextReporter
+        have_pylint_1_0 = True
+    except ImportError:
+        # Older Pylint
+        from logilab.astng import Class, Instance, InferenceError
+        from pylint.reporters.text import ParseableTextReporter
+        have_pylint_1_0 = False
 except ImportError:
     print >> sys.stderr, "To use {0}, please install pylint.".format(sys.argv[0])
     sys.exit(32)
@@ -222,8 +230,13 @@ def main():
     if options.errors_only:
         linter.disable_noerror_messages()
         linter.enable('F')
-    linter.set_reporter(ParseableTextReporter())
-    linter.set_option('include-ids', True)
+    if have_pylint_1_0:
+        linter.set_reporter(TextReporter())
+        linter.set_option('msg-template',
+                          '{path}:{line}: [{msg_id}({symbol}), {obj}] {msg})')
+    else:
+        linter.set_reporter(ParseableTextReporter())
+        linter.set_option('include-ids', True)
     linter.set_option('reports', False)
     linter.set_option('persistent', False)
 
-- 
1.8.3.1

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to