[Git][NTPsec/ntpsec][master] 3 commits: ImportError doesn't have a message attribute

Eric S. Raymond gitlab at mg.gitlab.com
Mon Nov 14 10:56:07 UTC 2016


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
824c0cfa by Matt Selsky at 2016-11-14T00:30:51-05:00
ImportError doesn't have a message attribute

- - - - -
c611e988 by Matt Selsky at 2016-11-14T03:37:40-05:00
Remove unused imports

- - - - -
695741ac by Matt Selsky at 2016-11-14T03:37:40-05:00
Python3: fix tabs/spacing, exception syntax

- - - - -


13 changed files:

- libntp/wscript
- ntpq/ntpq
- ntpstats/ntpviz
- ntptrace/ntptrace
- pylib/packet.py
- pylib/statfiles.py
- pylib/util.py
- wafhelpers/check_multicast.py
- wafhelpers/check_openssl.py
- wafhelpers/check_pthread.py
- wafhelpers/check_vsprintfm.py
- wafhelpers/configure.py
- wscript


Changes:

=====================================
libntp/wscript
=====================================
--- a/libntp/wscript
+++ b/libntp/wscript
@@ -1,5 +1,3 @@
-import sys
-
 def build(ctx):
 	srcnode = ctx.srcnode.abspath()
 


=====================================
ntpq/ntpq
=====================================
--- a/ntpq/ntpq
+++ b/ntpq/ntpq
@@ -21,7 +21,7 @@ try:
     import ntp.version
 except ImportError as e:
     sys.stderr.write("ntpq: can't find Python NTP library -- check PYTHONPATH.\n")
-    sys.stderr.write("%s\n" % e.message)
+    sys.stderr.write("%s\n" % e)
     sys.exit(1)
 
 # This import only works on Unixes.  The intention is to enable


=====================================
ntpstats/ntpviz
=====================================
--- a/ntpstats/ntpviz
+++ b/ntpstats/ntpviz
@@ -45,7 +45,7 @@ try:
     import ntp.util
 except ImportError as e:
     sys.stderr.write("ntpviz: can't find Python NTP library -- check PYTHONPATH.\n")
-    sys.stderr.write("%s\n" % e.message)
+    sys.stderr.write("%s\n" % e)
     sys.exit(1)
 
 # overload ArgumentParser


=====================================
ntptrace/ntptrace
=====================================
--- a/ntptrace/ntptrace
+++ b/ntptrace/ntptrace
@@ -14,7 +14,6 @@ from __future__ import print_function
 
 import getopt
 import re
-import socket
 import subprocess
 import sys
 import ntp.util


=====================================
pylib/packet.py
=====================================
--- a/pylib/packet.py
+++ b/pylib/packet.py
@@ -606,7 +606,7 @@ class ControlSession:
         return True
 
     def password(self):
-	"Get a keyid and the password if we don't have one."
+        "Get a keyid and the password if we don't have one."
         if self.keyid is None:
             if self.auth is None:
                 try:
@@ -693,7 +693,7 @@ class ControlSession:
             raise ControlException(SERR_NOKEY)
         else:
             pkt.extension += mac
-	return pkt.send()
+        return pkt.send()
 
     def getresponse(self, opcode, associd, timeo):
         "Get a response expected to match a given opcode and associd."
@@ -979,9 +979,9 @@ class ControlSession:
 
     def mrulist(self, variables=None, rawhook=None):
         "Retrieve MRU list data"
-	nonce_uses = 0
-	restarted_count = 0
-	cap_frags = True
+        nonce_uses = 0
+        restarted_count = 0
+        cap_frags = True
         warn = sys.stderr.write
         sorter = None
         if variables is None:
@@ -1063,20 +1063,20 @@ class ControlSession:
                             cap_frags = False
                             if self.debug:
                                 warn("Reverted to row limit from fragments limit.\n")
-			else:
+                        else:
                             # ntpd has lower cap on row limit
                             self.ntpd_row_limit -= 1
                             limit = min(limit, ntpd_row_limit)
                             if self.debug:
                                 warn("Row limit reduced to %d following CERR_BADVALUE.\n" % limit)
                     elif e.errorcode in (ERR_INCOMPLETE, ERR_TIMEOUT):
-			 # Reduce the number of rows/frags requested by
-			 # half to recover from lost response fragments.
-			if cap_frags:
+                        # Reduce the number of rows/frags requested by
+                        # half to recover from lost response fragments.
+                        if cap_frags:
                             frags = max(2, frags / 2)
                             if self.debug:
                                 warn("Frag limit reduced to %d following incomplete response.\n"% frags)
-			else:
+                        else:
                             limit = max(2, limit / 2)
                             if self.debug:
                                 warn("Row limit reduced to %d following incomplete response.\n" % limit)
@@ -1124,15 +1124,15 @@ class ControlSession:
                 if span.is_complete():
                     break
 
-		# Snooze for a bit between queries to let ntpd catch
-		# up with other duties.
+                # Snooze for a bit between queries to let ntpd catch
+                # up with other duties.
                 time.sleep(0.05)
 
-		# If there were no errors, increase the number of rows
-		# to a maximum of 3 * MAXFRAGS (the most packets ntpq
-		# can handle in one response), on the assumption that
-		# no less than 3 rows fit in each packet, capped at 
-		# our best guess at the server's row limit.
+                # If there were no errors, increase the number of rows
+                # to a maximum of 3 * MAXFRAGS (the most packets ntpq
+                # can handle in one response), on the assumption that
+                # no less than 3 rows fit in each packet, capped at
+                # our best guess at the server's row limit.
                 if not recoverable_read_errors:
                     if cap_frags:
                         frags = min(MAXFRAGS, frags + 1)
@@ -1142,14 +1142,14 @@ class ControlSession:
                                     max(limit + 1,
                                         limit * 33 / 32))
 
-		# prepare next query with as many address and last-seen
-		# timestamps as will fit in a single packet.
-		req_buf = "%s, %s=%d%s" % \
+                # prepare next query with as many address and last-seen
+                # timestamps as will fit in a single packet.
+                req_buf = "%s, %s=%d%s" % \
                           (nonce,
                            "frags" if cap_frags else "limit",
                            frags if cap_frags else limit,
                            parms)
-		nonce_uses += 1
+                nonce_uses += 1
                 if nonce_uses >= 4:
                     nonce = self.fetch_nonce()
                     nonce_uses = 0


=====================================
pylib/statfiles.py
=====================================
--- a/pylib/statfiles.py
+++ b/pylib/statfiles.py
@@ -7,7 +7,7 @@ Requires GNUPLOT and liberation fonts installed.
 #SPDX-License-Identifier: BSD-2-Clause
 from __future__ import print_function, division
 
-import calendar, datetime, glob, gzip, os, socket, subprocess, sys, time
+import glob, gzip, os, socket, sys, time
 
 class NTPStats:
     "Gather statistics for a specified NTP site"


=====================================
pylib/util.py
=====================================
--- a/pylib/util.py
+++ b/pylib/util.py
@@ -5,7 +5,6 @@ from __future__ import print_function
 
 import socket
 import sys
-import subprocess
 import time
 import ntp.ntpc
 import re
@@ -39,8 +38,8 @@ def canonicalize_dns(hostname, family=socket.AF_UNSPEC):
     (hostname, portsuffix) = portsplit(hostname)
     try:
         ai = socket.getaddrinfo(hostname, None, family, 0, 0, socket.AI_CANONNAME)
-    except socket.gaierror as (s, _e):
-        print('getaddrinfo failed: %s' % s, file=sys.stderr)
+    except socket.gaierror as e:
+        print('getaddrinfo failed: %s' % e, file=sys.stderr)
         raise SystemExit(1)
     (family, socktype, proto, canonname, sockaddr) = ai[0]
     try:


=====================================
wafhelpers/check_multicast.py
=====================================
--- a/wafhelpers/check_multicast.py
+++ b/wafhelpers/check_multicast.py
@@ -1,6 +1,3 @@
-import sys
-from waflib.Logs import pprint
-
 def check_multicast(ctx):
         "Probe for IP multicast capability."
         ctx.check_cc(


=====================================
wafhelpers/check_openssl.py
=====================================
--- a/wafhelpers/check_openssl.py
+++ b/wafhelpers/check_openssl.py
@@ -1,6 +1,3 @@
-from waflib.Configure import conf
-from wafhelpers.util import msg, msg_setting
-
 # Versions older than 0.9.7d were deemed incompatible in NTP Classic.
 OPENSSL_FRAG = """
 %s


=====================================
wafhelpers/check_pthread.py
=====================================
--- a/wafhelpers/check_pthread.py
+++ b/wafhelpers/check_pthread.py
@@ -1,4 +1,3 @@
-from waflib.Logs import pprint
 from wafhelpers.tool import check_sanity
 
 PTHREAD_FRAG = """


=====================================
wafhelpers/check_vsprintfm.py
=====================================
--- a/wafhelpers/check_vsprintfm.py
+++ b/wafhelpers/check_vsprintfm.py
@@ -1,6 +1,3 @@
-import sys
-from waflib.Logs import pprint
-
 # What we really want to do here is test to see if the following program
 # compiles *and exits with 9 status*.  Because we don't know how to check
 # the return status we must settle for a simpler test.


=====================================
wafhelpers/configure.py
=====================================
--- a/wafhelpers/configure.py
+++ b/wafhelpers/configure.py
@@ -1,7 +1,7 @@
 import sys, os, platform
 from waflib.Configure import conf
 from wafhelpers.probes import *
-from wafhelpers.util import msg, msg_setting, parse_version
+from wafhelpers.util import msg, msg_setting
 
 def cmd_configure(ctx, config):
         srcnode = ctx.srcnode.abspath()


=====================================
wscript
=====================================
--- a/wscript
+++ b/wscript
@@ -231,10 +231,10 @@ def build(ctx):
 		from waflib import Options
 		Options.options.no_tests = True
 
-        if ctx.cmd == "build":
-            if not "PYTHONPATH" in os.environ:
-                print("--- PYTHONPATH is not set, "
-                  "loading the Python ntp library may be troublesome ---")
+	if ctx.cmd == "build":
+		if not "PYTHONPATH" in os.environ:
+			print("--- PYTHONPATH is not set, "
+				"loading the Python ntp library may be troublesome ---")
 
 #
 # Miscellaneous utility productions



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/21a5b3b84c20d154f9863c3cd909f2e7a3d85279...695741ac4b8fd499b3b311d3a80183921bd569c5
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161114/ba06a055/attachment.html>


More information about the vc mailing list