Re: [Freeipa-devel] [PATCHES] 0270-0271 Support for Pylint 1.0

2013-09-06 Thread Alexander Bokovoy

On Thu, 05 Sep 2013, Petr Viktorin wrote:

On 09/05/2013 08:08 AM, Alexander Bokovoy wrote:

On Wed, 04 Sep 2013, Petr Viktorin wrote:

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

I tried the patches and still see an error on up to date Fedora 19
(including updates-testing):

./make-lint Traceback (most recent call last):

[...]

TypeError: unbound method infer() must be called with Tuple instance as
first argument (got InferenceContext instance instead)


At this point I'm not sure whether it is astroid's issue or ours...
Astroid did change from 0.24 to 1.0 on August 13th in Fedora (even in
Fedora 19 where version updates after release are generally
discouraged, especially in case of ABI change).


Hello,
Please use Pylint 1.0.0-2. It seems it hasn't reached the mirrors 
yet, you have the earlier buggy version.

I do have pylint 1.0.0-2.fc19 and yet it fails with the same error
message. Nothing works, I had to disable make-lint call in Makefile to
continue development.

--
/ Alexander Bokovoy

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


Re: [Freeipa-devel] [PATCHES] 0270-0271 Support for Pylint 1.0

2013-09-06 Thread Petr Viktorin

On 09/06/2013 10:35 AM, Alexander Bokovoy wrote:

On Thu, 05 Sep 2013, Petr Viktorin wrote:

On 09/05/2013 08:08 AM, Alexander Bokovoy wrote:

On Wed, 04 Sep 2013, Petr Viktorin wrote:

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

I tried the patches and still see an error on up to date Fedora 19
(including updates-testing):

./make-lint Traceback (most recent call last):

[...]

TypeError: unbound method infer() must be called with Tuple instance as
first argument (got InferenceContext instance instead)


At this point I'm not sure whether it is astroid's issue or ours...
Astroid did change from 0.24 to 1.0 on August 13th in Fedora (even in
Fedora 19 where version updates after release are generally
discouraged, especially in case of ABI change).


Hello,
Please use Pylint 1.0.0-2. It seems it hasn't reached the mirrors yet,
you have the earlier buggy version.

I do have pylint 1.0.0-2.fc19 and yet it fails with the same error
message. Nothing works, I had to disable make-lint call in Makefile to
continue development.



That is strange; I've confirmed on several machines that the -2.fc19 
release fixes this bug.


If you run pylint on the following code, do you also get the unbound 
method infer() error? (It's the upstream bug reproducer)


import collections
Point = collections.namedtuple('Point', ['x', 'y'])
p = Point(x=1.0, y=2.0)
print Area: %.1f % (p.x * p.y,)

Can you check the FILE in `pydoc pylint` to make sure you're running 
pylint from the RPM?


--
Petr³

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


Re: [Freeipa-devel] [PATCHES] 0270-0271 Support for Pylint 1.0

2013-09-06 Thread Alexander Bokovoy

On Fri, 06 Sep 2013, Petr Viktorin wrote:

On 09/06/2013 10:35 AM, Alexander Bokovoy wrote:

On Thu, 05 Sep 2013, Petr Viktorin wrote:

On 09/05/2013 08:08 AM, Alexander Bokovoy wrote:

On Wed, 04 Sep 2013, Petr Viktorin wrote:

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

I tried the patches and still see an error on up to date Fedora 19
(including updates-testing):

./make-lint Traceback (most recent call last):

[...]

TypeError: unbound method infer() must be called with Tuple instance as
first argument (got InferenceContext instance instead)


At this point I'm not sure whether it is astroid's issue or ours...
Astroid did change from 0.24 to 1.0 on August 13th in Fedora (even in
Fedora 19 where version updates after release are generally
discouraged, especially in case of ABI change).


Hello,
Please use Pylint 1.0.0-2. It seems it hasn't reached the mirrors yet,
you have the earlier buggy version.

I do have pylint 1.0.0-2.fc19 and yet it fails with the same error
message. Nothing works, I had to disable make-lint call in Makefile to
continue development.



That is strange; I've confirmed on several machines that the -2.fc19 
release fixes this bug.


If you run pylint on the following code, do you also get the unbound 
method infer() error? (It's the upstream bug reproducer)


import collections
Point = collections.namedtuple('Point', ['x', 'y'])
p = Point(x=1.0, y=2.0)
print Area: %.1f % (p.x * p.y,)

Here is clean Fedora 19 VM, created few hours ago:
# rpm -q pylint python-astroid
pylint-1.0.0-2.fc19.noarch
python-astroid-1.0.0-2.fc19.noarch
# pylint test.py 
No config file found, using default configuration

* Module test
C:  1, 0: Missing module docstring (missing-docstring)
C:  3, 0: Invalid constant name p (invalid-name)
Traceback (most recent call last):
  File /usr/bin/pylint, line 9, in module
load_entry_point('pylint==1.0.0', 'console_scripts', 'pylint')()
  File /usr/lib/python2.7/site-packages/pylint/__init__.py, line 21, in 
run_pylint
Run(sys.argv[1:])
  File /usr/lib/python2.7/site-packages/pylint/lint.py, line 1010, in __init__
linter.check(args)
  File /usr/lib/python2.7/site-packages/pylint/lint.py, line 599, in check
self.check_astroid_module(astroid, walker, rawcheckers, tokencheckers)
  File /usr/lib/python2.7/site-packages/pylint/lint.py, line 685, in 
check_astroid_module
walker.walk(astroid)
  File /usr/lib/python2.7/site-packages/pylint/utils.py, line 662, in walk
self.walk(child)
  File /usr/lib/python2.7/site-packages/pylint/utils.py, line 662, in walk
self.walk(child)
  File /usr/lib/python2.7/site-packages/pylint/utils.py, line 662, in walk
self.walk(child)
  File /usr/lib/python2.7/site-packages/pylint/utils.py, line 662, in walk
self.walk(child)
  File /usr/lib/python2.7/site-packages/pylint/utils.py, line 662, in walk
self.walk(child)
  File /usr/lib/python2.7/site-packages/pylint/utils.py, line 659, in walk
cb(astroid)
  File /usr/lib/python2.7/site-packages/pylint/checkers/typecheck.py, line 
174, in visit_getattr
if is_super(owner) or getattr(owner, 'type', None) == 'metaclass':
  File /usr/lib/python2.7/site-packages/astroid/bases.py, line 51, in 
__getattr__
return getattr(self._proxied, name)
  File /usr/lib/python2.7/site-packages/astroid/scoped_nodes.py, line 680, in 
_class_type
for base in klass.ancestors(recurs=False):
  File /usr/lib/python2.7/site-packages/astroid/scoped_nodes.py, line 801, in 
ancestors
for baseobj in stmt.infer(context):
TypeError: unbound method infer() must be called with Tuple instance as
first argument (got InferenceContext instance instead)

Then I've ran 'yum upgrade' again, and python-astroid-1.0.0-3.fc19.noarch was
installed which finally fixed the problem.

So the actual problem was split across both pylint and python-astroid.

That means ACK for your patches.

--
/ Alexander Bokovoy

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


Re: [Freeipa-devel] [PATCHES] 0270-0271 Support for Pylint 1.0

2013-09-06 Thread Petr Viktorin

On 09/06/2013 02:22 PM, Alexander Bokovoy wrote:

On Fri, 06 Sep 2013, Petr Viktorin wrote:

On 09/06/2013 10:35 AM, Alexander Bokovoy wrote:

On Thu, 05 Sep 2013, Petr Viktorin wrote:

On 09/05/2013 08:08 AM, Alexander Bokovoy wrote:

On Wed, 04 Sep 2013, Petr Viktorin wrote:

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

I tried the patches and still see an error on up to date Fedora 19
(including updates-testing):

./make-lint Traceback (most recent call last):

[...]

TypeError: unbound method infer() must be called with Tuple
instance as
first argument (got InferenceContext instance instead)


At this point I'm not sure whether it is astroid's issue or ours...
Astroid did change from 0.24 to 1.0 on August 13th in Fedora (even in
Fedora 19 where version updates after release are generally
discouraged, especially in case of ABI change).


Hello,
Please use Pylint 1.0.0-2. It seems it hasn't reached the mirrors yet,
you have the earlier buggy version.

I do have pylint 1.0.0-2.fc19 and yet it fails with the same error
message. Nothing works, I had to disable make-lint call in Makefile to
continue development.



That is strange; I've confirmed on several machines that the -2.fc19
release fixes this bug.

If you run pylint on the following code, do you also get the unbound
method infer() error? (It's the upstream bug reproducer)

import collections
Point = collections.namedtuple('Point', ['x', 'y'])
p = Point(x=1.0, y=2.0)
print Area: %.1f % (p.x * p.y,)

Here is clean Fedora 19 VM, created few hours ago:
# rpm -q pylint python-astroid
pylint-1.0.0-2.fc19.noarch
python-astroid-1.0.0-2.fc19.noarch
# pylint test.py No config file found, using default configuration
* Module test
C:  1, 0: Missing module docstring (missing-docstring)
C:  3, 0: Invalid constant name p (invalid-name)
Traceback (most recent call last):
   File /usr/bin/pylint, line 9, in module
 load_entry_point('pylint==1.0.0', 'console_scripts', 'pylint')()

[...]

TypeError: unbound method infer() must be called with Tuple instance as
first argument (got InferenceContext instance instead)

Then I've ran 'yum upgrade' again, and
python-astroid-1.0.0-3.fc19.noarch was
installed which finally fixed the problem.

So the actual problem was split across both pylint and python-astroid.

That means ACK for your patches.



I'm glad that got cleared up. Thanks for the review, pushed to
master: a9225be0fa7bb834cd78609603300d81dcc4d3c9
ipa-3-3: 41c255a8e91942377f00d85ed93a0b7afb617266

--
Petr³

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


Re: [Freeipa-devel] [PATCHES] 0270-0271 Support for Pylint 1.0

2013-09-05 Thread Alexander Bokovoy

On Wed, 04 Sep 2013, Petr Viktorin wrote:

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

I tried the patches and still see an error on up to date Fedora 19
(including updates-testing):

./make-lint 
Traceback (most recent call last):

  File ./make-lint, line 272, in module
sys.exit(main())
  File ./make-lint, line 243, in main
linter.check(files)
  File /usr/lib/python2.7/site-packages/pylint/lint.py, line 599, in check
self.check_astroid_module(astroid, walker, rawcheckers, tokencheckers)
  File /usr/lib/python2.7/site-packages/pylint/lint.py, line 685, in 
check_astroid_module
walker.walk(astroid)
  File /usr/lib/python2.7/site-packages/pylint/utils.py, line 662, in walk
self.walk(child)
  File /usr/lib/python2.7/site-packages/pylint/utils.py, line 662, in walk
self.walk(child)
  File /usr/lib/python2.7/site-packages/pylint/utils.py, line 662, in walk
self.walk(child)
  File /usr/lib/python2.7/site-packages/pylint/utils.py, line 662, in walk
self.walk(child)
  File /usr/lib/python2.7/site-packages/pylint/utils.py, line 662, in walk
self.walk(child)
  File /usr/lib/python2.7/site-packages/pylint/utils.py, line 662, in walk
self.walk(child)
  File /usr/lib/python2.7/site-packages/pylint/utils.py, line 659, in walk
cb(astroid)
  File ./make-lint, line 126, in visit_getattr
ignored = self._find_ignored_attrs(owner)
  File ./make-lint, line 110, in _find_ignored_attrs
for klass in self._related_classes(owner):
  File ./make-lint, line 102, in _related_classes
for base in klass.ancestors():
  File /usr/lib/python2.7/site-packages/astroid/scoped_nodes.py, line 810, in 
ancestors
for grandpa in baseobj.ancestors(True, context):
  File /usr/lib/python2.7/site-packages/astroid/scoped_nodes.py, line 801, in 
ancestors
for baseobj in stmt.infer(context):
TypeError: unbound method infer() must be called with Tuple instance as
first argument (got InferenceContext instance instead)


At this point I'm not sure whether it is astroid's issue or ours...
Astroid did change from 0.24 to 1.0 on August 13th in Fedora (even in
Fedora 19 where version updates after release are generally
discouraged, especially in case of ABI change).



--
/ Alexander Bokovoy

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


Re: [Freeipa-devel] [PATCHES] 0270-0271 Support for Pylint 1.0

2013-09-05 Thread Petr Viktorin

On 09/05/2013 08:08 AM, Alexander Bokovoy wrote:

On Wed, 04 Sep 2013, Petr Viktorin wrote:

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

I tried the patches and still see an error on up to date Fedora 19
(including updates-testing):

./make-lint Traceback (most recent call last):

[...]

TypeError: unbound method infer() must be called with Tuple instance as
first argument (got InferenceContext instance instead)


At this point I'm not sure whether it is astroid's issue or ours...
Astroid did change from 0.24 to 1.0 on August 13th in Fedora (even in
Fedora 19 where version updates after release are generally
discouraged, especially in case of ABI change).


Hello,
Please use Pylint 1.0.0-2. It seems it hasn't reached the mirrors yet, 
you have the earlier buggy version.


As for Fedora policy, it would probably be best to make that point with 
the maintainer.

https://admin.fedoraproject.org/updates/FEDORA-2013-14942/pylint-1.0.0-2.fc19

--
Petr³

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


Re: [Freeipa-devel] [PATCHES] 0270-0271 Support for Pylint 1.0

2013-09-04 Thread Petr Viktorin

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

[Freeipa-devel] [PATCHES] 0270-0271 Support for Pylint 1.0

2013-08-19 Thread Petr Viktorin

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.


--
Petr³
From 969ead2e3fbdf9cfbd6bffefef24316d37803a13 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 67f7a0368bc84ef98c1892401549418f093b79b4 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 | 38 ++
 1 file changed, 34 insertions(+), 4 deletions(-)

diff --git a/make-lint b/make-lint
index fd7bea2130b94f07ff3e19f8168f95fa561b50fc..69cce6e5fc3c9ad6ec98634b122dbbec95700ea9 100755
--- a/make-lint
+++ b/make-lint
@@ -28,18 +28,33 @@ 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)
 
 # File names to ignore when searching for python source files
 IGNORE_FILES = ('.*', '*~', '*.in', '*.pyc', '*.pyo')
 IGNORE_PATHS = ('build', 'rpmbuild', 'dist', 'install/po/test_i18n.py',
 'lite-server.py', 'make-lint', 'make-test', 'ipatests')
 
+# FIXME: The following classes cause the following Pylint error:
+# https://bitbucket.org/logilab/pylint/issue/47
+IGNORE_RELATED_CLASSES = [
+'urlparse.SplitResult',
+'ArgSpec.ArgSpec',
+]
+
 class IPATypeChecker(TypeChecker):
 NAMESPACE_ATTRS = ['Command', 'Object', 'Method', 'Property', 'Backend',
 'Updater', 'Advice']
@@ -58,6 +73,11 @@ class IPATypeChecker(TypeChecker):
 'fragment', 'username', 'password', 'hostname', 'port'],
 'urlparse.ParseResult': ['params'],
 
+# Related to IGNORE_RELATED_CLASSES
+'urlparse.SplitResult': ['netloc'],
+'ArgSpec.ArgSpec': ['args'],
+'ldap.LDAPError': ['args'],
+
 # IPA classes
 'ipalib.base.NameSpace': ['add', 'mod', 'del', 'show', 'find'],
 'ipalib.cli.Collector': ['__options'],
@@ -91,6 +111,11 @@ class IPATypeChecker(TypeChecker):
 
 def _related_classes(self, klass):
 yield klass
+
+if any(str(klass) == 'Instance of %s' % n
+   for n in IGNORE_RELATED_CLASSES):
+return
+
 for base in klass.ancestors():