On 01/11/2016 02:49 PM, Martin Basti wrote:
> 
> 
> On 08.01.2016 12:45, Petr Viktorin wrote:
>> On 01/06/2016 03:28 PM, Petr Viktorin wrote:
>>> Hello,
>>>
>>> Patches 0753-0757 fix remaining warnings from `pylint --py3k`, except
>>> "no-absolute-import" (which seems redundant to me) and the ones in
>>> contrib/RHEL4.
>>> The last patch adds py3k lint check  to make-lint. It's a bit
>>> cumbersome, since pylint doesn't allow running regular checkers and the
>>> py3k ones at the same time, but it allows you to run the check. As for
>>> whether to enable --py3k by default, or run it on every package build,
>>> I'd like to defer the decision to core devs. (Is CI good enough nowadays
>>> to only run it there?)
>>>
>>>
>>> [0] https://www.redhat.com/archives/freeipa-users/2013-July/msg00055.html
>> Here's a new version of the patchset, updated to current master.
>> The last patch requires 0758 (removing contrib/RHEL4) which is being
>> reviewed in another thread.

Rebased to current master.


> Hello I tried --py3k option and it doesn't print any error, can we
> enable that check by default to prevent python3 regressions?
> 
> # ./make-lint --py3k
> No config file found, using default configuration

Squash in the other attached patch to enable it by default.

> Otherwise code LGTM and works for me, Honza will give you the final ack.


-- 
Petr Viktorin
From dc1890cdd65244cb13329c14d509b23cbfd3fef9 Mon Sep 17 00:00:00 2001
From: Petr Viktorin <pvikt...@redhat.com>
Date: Tue, 5 Jan 2016 13:19:25 +0100
Subject: [PATCH] Use explicit truncating division

In Python 3, the truncating division operator, //, is needed to
get C-style "int division".
---
 ipalib/plugins/dns.py                    | 6 +++---
 ipalib/plugins/pwpolicy.py               | 4 ++--
 ipalib/plugins/trust.py                  | 2 +-
 ipaserver/install/ipa_otptoken_import.py | 4 ++--
 ipatests/test_integration/util.py        | 2 +-
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py
index 59cb0ea3982256e9d98b8216207514e28e229d03..3b4b204d9640a4f130db687991cb35e18ab6e6e0 100644
--- a/ipalib/plugins/dns.py
+++ b/ipalib/plugins/dns.py
@@ -361,9 +361,9 @@ def _reverse_zone_name(netstr):
     net = netaddr.IPNetwork(netstr)
     items = net.ip.reverse_dns.split('.')
     if net.version == 4:
-        return u'.'.join(items[4 - net.prefixlen / 8:])
+        return u'.'.join(items[4 - net.prefixlen // 8:])
     elif net.version == 6:
-        return u'.'.join(items[32 - net.prefixlen / 4:])
+        return u'.'.join(items[32 - net.prefixlen // 4:])
     else:
         return None
 
@@ -3428,7 +3428,7 @@ class dnsrecord(LDAPObject):
         resolver = dns.resolver.Resolver()
         resolver.set_flags(0)  # disable recursion (for NS RR checks)
         max_attempts = int(self.api.env['wait_for_dns'])
-        warn_attempts = max_attempts / 2
+        warn_attempts = max_attempts // 2
         period = 1  # second
         attempt = 0
         log_fn = self.log.debug
diff --git a/ipalib/plugins/pwpolicy.py b/ipalib/plugins/pwpolicy.py
index 4710b48cc83a257d4f85f0de5c5e348f54d959fc..86c559b7dfeb7dffaa6c777876c6e65caab02075 100644
--- a/ipalib/plugins/pwpolicy.py
+++ b/ipalib/plugins/pwpolicy.py
@@ -380,11 +380,11 @@ class pwpolicy(LDAPObject):
         if not options.get('raw', False):
             if 'krbmaxpwdlife' in entry_attrs:
                 entry_attrs['krbmaxpwdlife'][0] = unicode(
-                    int(entry_attrs['krbmaxpwdlife'][0]) / 86400
+                    int(entry_attrs['krbmaxpwdlife'][0]) // 86400
                 )
             if 'krbminpwdlife' in entry_attrs:
                 entry_attrs['krbminpwdlife'][0] = unicode(
-                    int(entry_attrs['krbminpwdlife'][0]) / 3600
+                    int(entry_attrs['krbminpwdlife'][0]) // 3600
                 )
 
     def convert_time_on_input(self, entry_attrs):
diff --git a/ipalib/plugins/trust.py b/ipalib/plugins/trust.py
index bc347675aa36cd628b3e34fc7102028431b829c2..19d8b53fd0e4e413d289893ec9867c9c281d8fb2 100644
--- a/ipalib/plugins/trust.py
+++ b/ipalib/plugins/trust.py
@@ -396,7 +396,7 @@ def add_range(myapi, trustinstance, range_name, dom_sid, *keys, **options):
                 max_id = int(max(max_uid, max_gid)[0])
 
                 base_id = int(info.get('msSFU30OrderNumber')[0])
-                range_size = (1 + (max_id - base_id) / DEFAULT_RANGE_SIZE)\
+                range_size = (1 + (max_id - base_id) // DEFAULT_RANGE_SIZE)\
                              * DEFAULT_RANGE_SIZE
 
     # Second, options given via the CLI options take precedence to discovery
diff --git a/ipaserver/install/ipa_otptoken_import.py b/ipaserver/install/ipa_otptoken_import.py
index 8ea67fce144f5058ed152378bd677e3f937583eb..89cb2accc38495a96e0a4f20cfa0fff1b021dc30 100644
--- a/ipaserver/install/ipa_otptoken_import.py
+++ b/ipaserver/install/ipa_otptoken_import.py
@@ -246,9 +246,9 @@ class XMLDecryptor(object):
         # Decrypt the data.
         slot = nss.get_best_slot(mech)
         key = nss.import_sym_key(slot, mech, nss.PK11_OriginUnwrap, nss.CKA_ENCRYPT, self.__key)
-        iv = nss.param_from_iv(mech, nss.SecItem(data[0:ivlen/8]))
+        iv = nss.param_from_iv(mech, nss.SecItem(data[0:ivlen//8]))
         ctx = nss.create_context_by_sym_key(mech, nss.CKA_DECRYPT, key, iv)
-        out = ctx.cipher_op(data[ivlen / 8:])
+        out = ctx.cipher_op(data[ivlen // 8:])
         out += ctx.digest_final()
         return out
 
diff --git a/ipatests/test_integration/util.py b/ipatests/test_integration/util.py
index 5cfbb2e948c04c70e77b29fd3813ae3fb8a1b84c..594737b6d753d476cd06aeb0d5cd376b7ca46467 100644
--- a/ipatests/test_integration/util.py
+++ b/ipatests/test_integration/util.py
@@ -57,7 +57,7 @@ def run_repeatedly(host, command, assert_zero_rc=True, test=None,
     raise AssertionError("Command: {cmd} repeatedly failed {times} times, "
                          "exceeding the timeout of {timeout} seconds."
                          .format(cmd=' '.join(command),
-                                 times=timeout / time_step,
+                                 times=timeout // time_step,
                                  timeout=timeout))
 
 
-- 
2.5.0

From 722c8ebc734c927ff90435832bdd7aa7e9f2af03 Mon Sep 17 00:00:00 2001
From: Petr Viktorin <pvikt...@redhat.com>
Date: Tue, 5 Jan 2016 13:36:15 +0100
Subject: [PATCH] Don't index exceptions directly

In Python 3, exceptions don't behave as tuples of their arguments;
instead of e[1] it's necessary to use e.args[1].
---
 ipalib/cli.py           | 4 ++--
 ipalib/plugins/vault.py | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ipalib/cli.py b/ipalib/cli.py
index 3b1b5a39371845d59bab07ac2fc32de598a469be..5398b7e7a8d5e0bfd72ef0638994968f8ae35c7c 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -1291,14 +1291,14 @@ class cli(backend.Executioner):
                     except IOError as e:
                         raise ValidationError(
                             name=to_cli(p.cli_name),
-                            error='%s: %s:' % (fname, e[1])
+                            error='%s: %s:' % (fname, e.args[1])
                         )
                 elif p.stdin_if_missing:
                     try:
                         raw = sys.stdin.read()
                     except IOError as e:
                         raise ValidationError(
-                            name=to_cli(p.cli_name), error=e[1]
+                            name=to_cli(p.cli_name), error=e.args[1]
                         )
 
                 if raw:
diff --git a/ipalib/plugins/vault.py b/ipalib/plugins/vault.py
index 0cf6f1d2447716a469c9c5626fffba97419d8fdb..4d8419e75770dc4c8b856560cf6c1613a132f8c0 100644
--- a/ipalib/plugins/vault.py
+++ b/ipalib/plugins/vault.py
@@ -221,7 +221,7 @@ def validated_read(argname, filename, mode='r', encoding=None):
         raise errors.ValidationError(
             name=argname,
             error=_("Cannot read file '%(filename)s': %(exc)s") % {
-                'filename': filename, 'exc': exc[1]
+                'filename': filename, 'exc': exc.args[1]
                 }
         )
     except UnicodeError as exc:
@@ -1547,7 +1547,7 @@ class vault_archive(PKQuery, Local):
             except OSError as exc:
                 raise errors.ValidationError(name="in", error=_(
                     "Cannot read file '%(filename)s': %(exc)s")
-                    % {'filename': input_file, 'exc': exc[1]})
+                    % {'filename': input_file, 'exc': exc.args[1]})
             if stat.st_size > MAX_VAULT_DATA_SIZE:
                 raise errors.ValidationError(name="in", error=_(
                     "Size of data exceeds the limit. Current vault data size "
-- 
2.5.0

From dcf302ae8a157670177b4b5f5e857589609f4828 Mon Sep 17 00:00:00 2001
From: Petr Viktorin <pvikt...@redhat.com>
Date: Tue, 5 Jan 2016 13:39:39 +0100
Subject: [PATCH] Use print_function future definition wherever print() is used

Pylint considers `print` a statement if the __future__ import is
not present, even if it's used like a function with one argument.

Add the __future__ import to files `pylint --py3k` complains about.
---
 doc/examples/python-api.py         | 1 +
 ipapython/dnssec/ldapkeydb.py      | 2 ++
 ipaserver/install/server/common.py | 2 ++
 3 files changed, 5 insertions(+)

diff --git a/doc/examples/python-api.py b/doc/examples/python-api.py
index 8c79dc4cac0c170a577ed1b5f90fa5f268401559..0a6eb60efa84102ce0571277c1698664b1865619 100755
--- a/doc/examples/python-api.py
+++ b/doc/examples/python-api.py
@@ -19,6 +19,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
+from __future__ import print_function
 from ipalib import api
 
 # 1. Initialize ipalib
diff --git a/ipapython/dnssec/ldapkeydb.py b/ipapython/dnssec/ldapkeydb.py
index b0b259f0ecb995a0eb49eedc732152fdb73cbf30..0ee30952549837f5f2bed0df85295c8200822d28 100644
--- a/ipapython/dnssec/ldapkeydb.py
+++ b/ipapython/dnssec/ldapkeydb.py
@@ -2,6 +2,8 @@
 # Copyright (C) 2014  FreeIPA Contributors see COPYING for license
 #
 
+from __future__ import print_function
+
 from binascii import hexlify
 import collections
 from pprint import pprint
diff --git a/ipaserver/install/server/common.py b/ipaserver/install/server/common.py
index 637e5664348bf3b7f2e4f2a867b8ecb224ccf388..277e839c3691a5ec8865684eedbfadf1984d7526 100644
--- a/ipaserver/install/server/common.py
+++ b/ipaserver/install/server/common.py
@@ -2,6 +2,8 @@
 # Copyright (C) 2015  FreeIPA Contributors see COPYING for license
 #
 
+from __future__ import print_function
+
 import os
 import sys
 
-- 
2.5.0

From 6ffcf586c02b917a7dd6b69ec0d6aeaa28973ce8 Mon Sep 17 00:00:00 2001
From: Petr Viktorin <pvikt...@redhat.com>
Date: Tue, 5 Jan 2016 13:54:43 +0100
Subject: [PATCH] Alias "unicode" to "str" under Python 3

Follow-up to commit 23507e6124041ed17f39db211e802495e37520e7

The six way of doing this is to replace all occurences of "unicode"
with "six.text_type". However, "unicode" is non-ambiguous and
(arguably) easier to read. Also, using it makes the patches smaller,
which should help with backporting.
---
 ipaserver/install/server/common.py                     | 5 +++++
 ipaserver/install/server/replicainstall.py             | 5 +++++
 ipatests/test_xmlrpc/test_caacl_profile_enforcement.py | 5 +++++
 ipatests/test_xmlrpc/test_certprofile_plugin.py        | 3 +++
 ipatests/test_xmlrpc/tracker/certprofile_plugin.py     | 4 ++++
 ipatests/test_xmlrpc/tracker/user_plugin.py            | 5 +++++
 6 files changed, 27 insertions(+)

diff --git a/ipaserver/install/server/common.py b/ipaserver/install/server/common.py
index 277e839c3691a5ec8865684eedbfadf1984d7526..8a9be92ee28d7b8e655198df309daab9c020e167 100644
--- a/ipaserver/install/server/common.py
+++ b/ipaserver/install/server/common.py
@@ -7,6 +7,8 @@ from __future__ import print_function
 import os
 import sys
 
+import six
+
 from ipapython.dn import DN
 from ipapython.install import common, core
 from ipapython.install.core import Knob
@@ -14,6 +16,9 @@ from ipalib.util import validate_domain_name
 from ipaserver.install import bindinstance
 from ipapython.ipautil import check_zone_overlap
 
+if six.PY3:
+    unicode = str
+
 VALID_SUBJECT_ATTRS = ['st', 'o', 'ou', 'dnqualifier', 'c',
                        'serialnumber', 'l', 'title', 'sn', 'givenname',
                        'initials', 'generationqualifier', 'dc', 'mail',
diff --git a/ipaserver/install/server/replicainstall.py b/ipaserver/install/server/replicainstall.py
index 150325b824ce055878791dc3039223342724684e..4bc1fd75ec08b7594120b7b3fa2edd4839168ddf 100644
--- a/ipaserver/install/server/replicainstall.py
+++ b/ipaserver/install/server/replicainstall.py
@@ -15,6 +15,8 @@ import socket
 import sys
 import tempfile
 
+import six
+
 from ipapython import ipaldap, ipautil, sysrestore
 from ipapython.dn import DN
 from ipapython.install.common import step
@@ -40,6 +42,9 @@ from binascii import hexlify
 
 from .common import BaseServer
 
+if six.PY3:
+    unicode = str
+
 DIRMAN_DN = DN(('cn', 'directory manager'))
 
 
diff --git a/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py b/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py
index 9de257a26f424ac00c24e06b15e604dedd5002bd..dca4151d614a4c2e2f5a09455426d117da4c1c80 100644
--- a/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py
+++ b/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py
@@ -7,6 +7,8 @@ import os
 import pytest
 import tempfile
 
+import six
+
 from ipalib import api, errors
 from ipatests.util import (
     prepare_config, unlock_principal_password, change_principal)
@@ -16,6 +18,9 @@ from ipatests.test_xmlrpc.tracker.caacl_plugin import CAACLTracker
 
 from ipapython.ipautil import run
 
+if six.PY3:
+    unicode = str
+
 BASE_DIR = os.path.dirname(__file__)
 
 SMIME_PROFILE_TEMPLATE = os.path.join(BASE_DIR, 'data/smime.cfg.tmpl')
diff --git a/ipatests/test_xmlrpc/test_certprofile_plugin.py b/ipatests/test_xmlrpc/test_certprofile_plugin.py
index 66a72de3e0da346289d9a8aa8eda039b6d6ddebc..e8459772d7a0b53b80b9cfa08a08dd57e4e12a47 100644
--- a/ipatests/test_xmlrpc/test_certprofile_plugin.py
+++ b/ipatests/test_xmlrpc/test_certprofile_plugin.py
@@ -10,12 +10,15 @@ Test the `ipalib.plugins.certprofile` module.
 import os
 
 import pytest
+import six
 
 from ipalib import api, errors
 from ipatests.util import prepare_config
 from ipatests.test_xmlrpc.xmlrpc_test import XMLRPC_test, raises_exact
 from ipatests.test_xmlrpc.tracker.certprofile_plugin import CertprofileTracker
 
+if six.PY3:
+    unicode = str
 
 IPA_CERT_SUBJ_BASE = (
     api.Command.config_show()
diff --git a/ipatests/test_xmlrpc/tracker/certprofile_plugin.py b/ipatests/test_xmlrpc/tracker/certprofile_plugin.py
index eeb27eb14a5ab77695264afb5770fb9218e56bd4..21c96c5eb36bfeacdcae9f1df61d2f6f4aafa7e9 100644
--- a/ipatests/test_xmlrpc/tracker/certprofile_plugin.py
+++ b/ipatests/test_xmlrpc/tracker/certprofile_plugin.py
@@ -5,12 +5,16 @@
 
 import os
 
+import six
 
 from ipapython.dn import DN
 from ipatests.test_xmlrpc.tracker.base import Tracker
 from ipatests.test_xmlrpc import objectclasses
 from ipatests.util import assert_deepequal
 
+if six.PY3:
+    unicode = str
+
 
 class CertprofileTracker(Tracker):
     """Tracker class for certprofile plugin.
diff --git a/ipatests/test_xmlrpc/tracker/user_plugin.py b/ipatests/test_xmlrpc/tracker/user_plugin.py
index bcae2ec787b3d3a54e34917f125be006094e07b0..2e042c60eaea330819dd7747a696d2ece7c87449 100644
--- a/ipatests/test_xmlrpc/tracker/user_plugin.py
+++ b/ipatests/test_xmlrpc/tracker/user_plugin.py
@@ -5,12 +5,17 @@
 from ipalib import api, errors
 from ipapython.dn import DN
 
+import six
+
 from ipatests.util import assert_deepequal, get_group_dn, get_user_dn
 from ipatests.test_xmlrpc import objectclasses
 from ipatests.test_xmlrpc.xmlrpc_test import (
     fuzzy_digits, fuzzy_uuid, raises_exact)
 from ipatests.test_xmlrpc.tracker.base import Tracker
 
+if six.PY3:
+    unicode = str
+
 
 class UserTracker(Tracker):
     """ Class for host plugin like tests """
-- 
2.5.0

From 908c1eedc0b121cf0ad6c6192b83daad64a7dd72 Mon Sep 17 00:00:00 2001
From: Petr Viktorin <pvikt...@redhat.com>
Date: Tue, 5 Jan 2016 13:57:51 +0100
Subject: [PATCH] Avoid builtins that were removed in Python 3

- `file` was removed in favor of `open`. Switch to the new spelling.
- `buffer` was removed in favor of a buffer protocol (and memoryview).
  It is used in a py2-only block so just placate PyLint.
---
 ipa-client/ipa-install/ipa-client-install | 2 +-
 ipalib/x509.py                            | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install
index af8d27bd0da9b847fef917d3bcc2ebd1837c5fb0..81443fd23964cf71f5e2e30eb0ce41c1eee65a0d 100755
--- a/ipa-client/ipa-install/ipa-client-install
+++ b/ipa-client/ipa-install/ipa-client-install
@@ -1573,7 +1573,7 @@ def do_nsupdate(update_txt):
     root_logger.debug("Writing nsupdate commands to %s:", UPDATE_FILE)
     root_logger.debug("%s", update_txt)
 
-    update_fd = file(UPDATE_FILE, "w")
+    update_fd = open(UPDATE_FILE, "w")
     update_fd.write(update_txt)
     update_fd.flush()
     update_fd.close()
diff --git a/ipalib/x509.py b/ipalib/x509.py
index 886bf6af61c10b298e71ba1c605e8a3e7897611f..2d28876de6ba7963417ef1505558a1d7b52a429f 100644
--- a/ipalib/x509.py
+++ b/ipalib/x509.py
@@ -130,7 +130,7 @@ def load_certificate(data, datatype=PEM, dbdir=None):
     initialize_nss_database(dbdir=dbdir)
 
     if six.PY2:
-        return nss.Certificate(buffer(data))
+        return nss.Certificate(buffer(data))  # pylint: disable=buffer-builtin
     else:
         # In python 3 , `bytes` has the buffer interface
         return nss.Certificate(data)
-- 
2.5.0

From 293d680350d5ba17cc465ceac8c457c574fac830 Mon Sep 17 00:00:00 2001
From: Petr Viktorin <pvikt...@redhat.com>
Date: Tue, 5 Jan 2016 14:03:50 +0100
Subject: [PATCH] dnsutil: Rename __nonzero__ to __bool__

In Python 3, this special method got renamed. Set both to the same
function to keep compatibility.
---
 ipapython/dnsutil.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ipapython/dnsutil.py b/ipapython/dnsutil.py
index a11d744d7131206cd0bb5d950c3725271b66410c..18141fa091b37c5e59a2efc1028812981bfd4884 100644
--- a/ipapython/dnsutil.py
+++ b/ipapython/dnsutil.py
@@ -49,11 +49,13 @@ class DNSName(dns.name.Name):
             # instead of a dns.exception
             raise dns.exception.SyntaxError(e)
 
-    def __nonzero__(self):
+    def __bool__(self):
         #dns.name.from_text('@') is represented like empty tuple
         #we need to acting '@' as nonzero value
         return True
 
+    __nonzero__ = __bool__  # for Python 2
+
     def __copy__(self):
         return DNSName(self.labels)
 
-- 
2.5.0

From abe5eb1a71a81405ada20af9c393b1b0213c013f Mon Sep 17 00:00:00 2001
From: Petr Viktorin <pvikt...@redhat.com>
Date: Tue, 5 Jan 2016 14:31:39 +0100
Subject: [PATCH] make-lint: Allow running pylint --py3k to detect Python3
 issues

Pylint can be run with the --py3k switch to detect porting issues.
This is not compatible with regular checking (i.e. to do all checks,
pylint must be run twice, with and without --py3k).

Add a --py3k switch to make-lint to do a py3 run.
Also add a --no-lint switch to allow only running the py3 checks.
---
 make-lint | 63 ++++++++++++++++++++++++++++++++++++++-------------------------
 1 file changed, 38 insertions(+), 25 deletions(-)

diff --git a/make-lint b/make-lint
index 97b5cd0f92e19911dd59d7e6122be54c01ae2997..e78127c1d324585ecfce472630a8bf3ba0ca2e24 100755
--- a/make-lint
+++ b/make-lint
@@ -28,6 +28,7 @@ import os
 import sys
 from optparse import OptionParser
 from fnmatch import fnmatch, fnmatchcase
+import subprocess
 
 try:
     from pylint import checkers
@@ -222,6 +223,10 @@ def main():
         dest='fail', default=True, action='store_false')
     optparser.add_option('--enable-noerror', help='enable warnings and other non-error messages',
         dest='errors_only', default=True, action='store_false')
+    optparser.add_option('--py3k', help='Also check for Python 3 porting issues',
+        dest='py3k', default=False, action='store_true')
+    optparser.add_option('--no-lint', help='Skil the main lint check',
+        dest='do_lint', default=True, action='store_false')
 
     options, args = optparser.parse_args()
     cwd = os.getcwd()
@@ -310,33 +315,41 @@ def main():
     linter.set_option('persistent', False)
     linter.set_option('disable', 'python3')
 
-    linter.check(files)
+    if options.do_lint:
+        linter.check(files)
 
-    if linter.msg_status != 0:
-        print("""
-===============================================================================
-Errors were found during the static code check.
-""", file=sys.stderr)
-
-        if len(linter.missing) > 0:
-            print("There are some missing imports:", file=sys.stderr)
-            for mod in sorted(linter.missing):
-                print("    " + mod, file=sys.stderr)
+        if linter.msg_status != 0:
             print("""
-Please make sure all of the required and optional (python-gssapi, python-rhsm)
-python packages are installed.
-""", file=sys.stderr)
-
-        print("""\
-If you are certain that any of the reported errors are false positives, please
-mark them in the source code according to the pylint documentation.
-===============================================================================
-""", file=sys.stderr)
-
-    if options.fail:
-        return linter.msg_status
-    else:
-        return 0
+    ===============================================================================
+    Errors were found during the static code check.
+    """, file=sys.stderr)
+
+            if len(linter.missing) > 0:
+                print("There are some missing imports:", file=sys.stderr)
+                for mod in sorted(linter.missing):
+                    print("    " + mod, file=sys.stderr)
+                print("""
+    Please make sure all of the required and optional (python-gssapi, python-rhsm)
+    python packages are installed.
+    """, file=sys.stderr)
+
+            print("""\
+    If you are certain that any of the reported errors are false positives, please
+    mark them in the source code according to the pylint documentation.
+    ===============================================================================
+    """, file=sys.stderr)
+
+        if options.fail and linter.msg_status != 0:
+            return linter.msg_status
+
+    if options.py3k:
+        args = ['pylint', '--py3k', '-d', 'no-absolute-import']
+        args.extend(files)
+        returncode = subprocess.call(args)
+        if options.fail and returncode != 0:
+            return returncode
+
+    return 0
 
 if __name__ == "__main__":
     sys.exit(main())
-- 
2.5.0

From f9781284b2e7b6c689ebeb0a66113a6c39d4ef47 Mon Sep 17 00:00:00 2001
From: Petr Viktorin <pvikt...@redhat.com>
Date: Tue, 12 Jan 2016 12:30:03 +0100
Subject: [PATCH] [SQUASH] Run pylint --py3k by default

---
 make-lint | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/make-lint b/make-lint
index e78127c1d324585ecfce472630a8bf3ba0ca2e24..f06649ba33576bdf78606dea0bb2c033fe6b2ec9 100755
--- a/make-lint
+++ b/make-lint
@@ -223,8 +223,8 @@ def main():
         dest='fail', default=True, action='store_false')
     optparser.add_option('--enable-noerror', help='enable warnings and other non-error messages',
         dest='errors_only', default=True, action='store_false')
-    optparser.add_option('--py3k', help='Also check for Python 3 porting issues',
-        dest='py3k', default=False, action='store_true')
+    optparser.add_option('--no-py3k', help='Do not check for Python 3 porting issues',
+        dest='py3k', default=True, action='store_false')
     optparser.add_option('--no-lint', help='Skil the main lint check',
         dest='do_lint', default=True, action='store_false')
 
-- 
2.5.0

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to