[Git][NTPsec/ntpsec][master] 9 commits: Set doc string for bin_test in standard manner

Gary E. Miller gitlab at mg.gitlab.com
Sun Sep 11 01:23:19 UTC 2016


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
cf5e3119 by Matt Selsky at 2016-09-10T18:03:49-07:00
Set doc string for bin_test in standard manner

Signed-off-by: Gary E. Miller <gem at rellim.com>

- - - - -
597fc83d by Matt Selsky at 2016-09-10T18:07:41-07:00
Remove trailing whitespace

Signed-off-by: Gary E. Miller <gem at rellim.com>

- - - - -
2b0bcf26 by Matt Selsky at 2016-09-10T18:09:14-07:00
Python2/3: implicitly specify path to wafhelpers

Also, make sure core Python modules are imported before local modules
Amended

Signed-off-by: Gary E. Miller <gem at rellim.com>

- - - - -
54db03f0 by Matt Selsky at 2016-09-10T18:11:03-07:00
Python2/3: Make sure sorted() can handle None elements

Signed-off-by: Gary E. Miller <gem at rellim.com>

- - - - -
3c6194f4 by Matt Selsky at 2016-09-10T18:12:23-07:00
Python2/3: Fix exception handling

Signed-off-by: Gary E. Miller <gem at rellim.com>

- - - - -
0272b379 by Matt Selsky at 2016-09-10T18:14:02-07:00
PEP8: Make sure closing bracket matches indentation of opening bracket

Signed-off-by: Gary E. Miller <gem at rellim.com>

- - - - -
effd4c5d by Matt Selsky at 2016-09-10T18:16:14-07:00
Python2/3: Make sure to consistently use for functional form of print()

Signed-off-by: Gary E. Miller <gem at rellim.com>

- - - - -
70cd6cee by Matt Selsky at 2016-09-10T18:18:08-07:00
Python2/3: Deal with strings vs bytes

Signed-off-by: Gary E. Miller <gem at rellim.com>

- - - - -
9fbee5b9 by Gary E. Miller at 2016-09-10T18:21:53-07:00
Line up a table.  Retab.

- - - - -


20 changed files:

- ntpq/pyntpq
- ntpstats/ntpviz
- ntpwait/ntpwait
- pylib/packet.py
- pylib/statfiles.py
- wafhelpers/asciidoc.py
- wafhelpers/bin_test.py
- wafhelpers/check_cap.py
- wafhelpers/check_libevent2.py
- wafhelpers/check_openssl.py
- wafhelpers/check_pthread.py
- wafhelpers/check_seccomp.py
- wafhelpers/compiler.py
- wafhelpers/configure.py
- wafhelpers/dist.py
- wafhelpers/refclock.py
- wafhelpers/test.py
- wafhelpers/util.py
- wafhelpers/waf.py
- wscript


Changes:

=====================================
ntpq/pyntpq
=====================================
--- a/ntpq/pyntpq
+++ b/ntpq/pyntpq
@@ -127,15 +127,15 @@ NTP_2BIT	= 0x9	# leap bits
 
 # Format values
 PADDING	= 0
-HA	= 1	# host address 
-NA	= 2	# network address 
-LP	= 3	# leap (print in binary) 
-RF	= 4	# refid (sometimes string, sometimes not) 
-AR	= 5	# array of times 
-FX	= 6	# test flags 
-TS	= 7	# l_fp timestamp in hex 
-OC	= 8	# integer, print in octal 
-EOV	= 255	# end of table 
+HA	= 1	# host address
+NA	= 2	# network address
+LP	= 3	# leap (print in binary)
+RF	= 4	# refid (sometimes string, sometimes not)
+AR	= 5	# array of times
+FX	= 6	# test flags
+TS	= 7	# l_fp timestamp in hex
+OC	= 8	# integer, print in octal
+EOV	= 255	# end of table
 
 # For the most part ntpq simply displays what ntpd provides in the
 # mostly plain-text mode 6 responses.  A few variable names are by
@@ -152,32 +152,32 @@ cookedvars = {
     "xmt":		TS,
     "flash":		FX,
     "srcadr":		HA,
-    "peeradr":		HA,	# compat with others 
+    "peeradr":		HA,	# compat with others
     "dstadr":		NA,
     "filtdelay":	AR,
     "filtoffset":	AR,
     "filtdisp":		AR,
-    "filterror":	AR,	# compat with others 
+    "filterror":	AR,	# compat with others
 }
 
 uservars = {
 }
 
-# flasher bits 
+# flasher bits
 tstflagnames = (
-	"pkt_dup",		# BOGON1 
-	"pkt_bogus",		# BOGON2 
-	"pkt_unsync",		# BOGON3 
-	"pkt_denied",		# BOGON4 
-	"pkt_auth",		# BOGON5 
-	"pkt_stratum",		# BOGON6 
-	"pkt_header",		# BOGON7 
-	"pkt_autokey",		# BOGON8 
-	"pkt_crypto",		# BOGON9 
-	"peer_stratum",		# BOGON10 
-	"peer_dist",		# BOGON11 
-	"peer_loop",		# BOGON12 
-	"peer_unreach"		# BOGON13 
+	"pkt_dup",		# BOGON1
+	"pkt_bogus",		# BOGON2
+	"pkt_unsync",		# BOGON3
+	"pkt_denied",		# BOGON4
+	"pkt_auth",		# BOGON5
+	"pkt_stratum",		# BOGON6
+	"pkt_header",		# BOGON7
+	"pkt_autokey",		# BOGON8
+	"pkt_crypto",		# BOGON9
+	"peer_stratum",		# BOGON10
+	"peer_dist",		# BOGON11
+	"peer_loop",		# BOGON12
+	"peer_unreach"		# BOGON13
 )
 
 class ntpq_interpreter(cmd.Cmd):
@@ -191,10 +191,10 @@ class ntpq_interpreter(cmd.Cmd):
         #self.auth_keyid   = 0		# Keyid used for authentication.
         #self.auth_keytype = "NID_md5"	# MD5 (FIXME: string value is a dummy)
         #self.auth_hashlen = 16		# MD5
-        self.rawmode           = False	# Flag which indicates raw mode output. 
+        self.rawmode           = False	# Flag which indicates raw mode output.
         self.showhostnames     = True	# If false, display numeric IPs
 	#self.l_fp delay_time		# delay time
-        self.wideremote = False		# show wide remote names? 
+        self.wideremote = False		# show wide remote names?
         self.ccmds = []			# Queued commands
         self.chosts = []		# Command-line hosts
         self.debug = 0
@@ -244,7 +244,7 @@ usage: delay [ msec ]
             elif self.session.havehost():
                 print("current host remains %s" % self.session.name)
             else:
-                print("still no current host")        
+                print("still no current host")
     def help_host(self):
         sys.stdout.write("""\
 function: specify the host whose NTP server we talk to
@@ -494,7 +494,7 @@ usage: addvars name[=value][,...]
         vars_to_rm = line.split(',')
         for rm_var in vars_to_rm:
             if rm_var not in uservars:
-                print ("%s is not in the variable list" % rm_var)
+                print("%s is not in the variable list" % rm_var)
             else:
                 del uservars[rm_var]
 
@@ -517,9 +517,9 @@ usage: clearvars
     def do_showvars(self, line):
         "print variables on the variable list"
         if len(uservars) == 0:
-            print ("No variables on list.")
+            print("No variables on list.")
         for name in uservars:
-            print ("%s=%s" % (name, uservars[name]))
+            print("%s=%s" % (name, uservars[name]))
 
     def help_showvars(self):
         sys.stdout.write("""\
@@ -857,12 +857,12 @@ DEFHOST 	= "localhost"	# default host name
 # with a single packet dropped, would take around 32 * DEFSTIMEOUT, or
 # 93 seconds to fail each of two times, or 186 seconds.
 # Some commands involve a series of requests, such as "peers" and
-# "mrulist", so the cumulative timeouts are even longer for those. 
-DEFDELAY	= 0x51EB852	# 20 milliseconds, l_fp fraction 
-MAXVARLEN	= 256		# maximum length of a variable name 
-MAXVALLEN	= 2048		# maximum length of a variable value 
-MAXOUTLINE	= 72		# maximum length of an output line 
-SCREENWIDTH	= 76		# nominal screen width in columns 
+# "mrulist", so the cumulative timeouts are even longer for those.
+DEFDELAY	= 0x51EB852	# 20 milliseconds, l_fp fraction
+MAXVARLEN	= 256		# maximum length of a variable name
+MAXVALLEN	= 2048		# maximum length of a variable value
+MAXOUTLINE	= 72		# maximum length of an output line
+SCREENWIDTH	= 76		# nominal screen width in columns
 
 # Macro definitions we use
 def ISSPACE(c):	return ((c) == ' ' or (c) == '\t')
@@ -870,7 +870,7 @@ def ISEOL(c):	return ((c) == '\n' or (c) == '\r' or (c) == '\0')
 
 #
 # main - parse arguments and handle options
-# 
+#
 
 usage = '''
 USAGE: ntpq [-46dphinOV] [-c str] [-D lvl] [ host ...]
@@ -902,7 +902,7 @@ if __name__ == '__main__':
     #delay_time.l_ui = 0
     #delay_time.l_uf = DEFDELAY
 
-    #init_lib()	# sets up ipv4_works, ipv6_works 
+    #init_lib()	# sets up ipv4_works, ipv6_works
     #ssl_applink()
     #init_auth()
 


=====================================
ntpstats/ntpviz
=====================================
--- a/ntpstats/ntpviz
+++ b/ntpstats/ntpviz
@@ -616,7 +616,7 @@ if __name__ == '__main__':
             "all-peer-jitters", "peer-jitters=",
             "local-temps",
             "local-offset-multiplot",
-            ])
+        ])
     except getopt.GetoptError as err:
         sys.stderr.write(str(err) + "\n")
         raise SystemExit(2)
@@ -875,7 +875,7 @@ at 0s. Typical 90% ranges may be: local serial GPS 200 ms; local LAN peer
 80µs; local PPS 20µs.  90% ranges for WAN servers may be 4ms and much larger.
 </p>
 """,
-        }
+    }
 
     start_time = datetime.datetime.utcnow()
     start_time_str = start_time.strftime("%c")
@@ -1032,7 +1032,7 @@ ntpviz</a>, part of the <a href="https://www.ntpsec.org/">NTPsec project</a>
             ("local-offset-histogram", stats.local_offset_histogram_gnuplot()),
             ("local-temps", stats.local_temps_gnuplot()),
             ("peer-offsets", stats.peer_offsets_gnuplot()),
-            ]
+        ]
 
         peerlist = list(stats.peersplit().keys())
         # sort for output order stability


=====================================
ntpwait/ntpwait
=====================================
--- a/ntpwait/ntpwait
+++ b/ntpwait/ntpwait
@@ -117,7 +117,7 @@ if __name__ == "__main__":
     try:
         (options, arguments) = getopt.getopt(sys.argv[1:], "hn:s:v", [
             "tries=", "sleep=", "verbose", "help"
-            ])
+        ])
     except getopt.GetoptError as err:
         sys.stderr.write(str(err) + "\n")
         raise SystemExit(2)


=====================================
pylib/packet.py
=====================================
--- a/pylib/packet.py
+++ b/pylib/packet.py
@@ -152,7 +152,7 @@ class control_frag(ntp_packet):
         self.session.sequence += 1
         self.sequence = self.session.sequence
         ntp_packet.send(self,
-                        self.sequence, self.status, self.associd, self.offset) 
+                        self.sequence, self.status, self.associd, self.offset)
     def analyze(self, data):
         (self.sequence,
          self.status,
@@ -202,8 +202,8 @@ class ntpq_session:
         self.ai_family = socket.AF_UNSPEC
         self.primary_timeout = 5000	# Timeout for first select on receive
         self.secondary_timeout = 3000	# Timeout for later selects
-        self.pktversion = NTP_OLDVERSION + 1	# Packet version number we use 
-        self.always_auth       = False	# Always send authenticated requests 
+        self.pktversion = NTP_OLDVERSION + 1	# Packet version number we use
+        self.always_auth       = False	# Always send authenticated requests
         self.keyid = None
         self.password = None
         self.name = None
@@ -236,13 +236,13 @@ class ntpq_session:
                                         hints)
         try:
             return hinted_lookup(port="ntp", hints=socket.AI_NUMERICHOST)
-        except socket.gaierror as (errno, string):
+        except socket.gaierror as e:
             if self.debug > 2:
-                sys.stderr.write("ntpq: numeric-mode lookup of %s failed, %s\n" % (hname, string))
+                sys.stderr.write("ntpq: numeric-mode lookup of %s failed, %s\n" % (hname, e.strerror))
         try:
             return hinted_lookup(port="ntp", hints=0)
-        except socket.gaierror as (errno, string):
-            sys.stderr.write("ntpq: standard-mode lookup of %s failed, %s\n" % (hname, string))
+        except socket.gaierror as e:
+            sys.stderr.write("ntpq: standard-mode lookup of %s failed, %s\n" % (hname, e.strerror))
         # EAI_NODATA and AI_CANONNAME should both exist - they're in the
         # POSIX API.  If this code throws AttributeErrors there is
         # probably a very old and broken socket layer in your Python
@@ -254,11 +254,11 @@ class ntpq_session:
         except AttributeError:
             pass
         try:
-            if errno in (socket.EAI_NONAME, socket.EAI_NODATA):
+            if e.errno in (socket.EAI_NONAME, socket.EAI_NODATA):
                 try:
                     return hinted_lookup(port="ndp", hints=0)
-                except socket.gaierror as (errno, string):
-                    sys.stderr.write("ntpq: ndp lookup failed, %s\n" % string)
+                except socket.gaierror as e:
+                    sys.stderr.write("ntpq: ndp lookup failed, %s\n" % e.strerror)
         except AttributeError:
             sys.stderr.write("ntpq: API error, missing socket attributes\n")
         return None
@@ -395,7 +395,7 @@ class ntpq_session:
                 if self.debug:
                     warn("Received request, wanted response\n");
                 #continue
-            
+
             # Check opcode and sequence number for a match.
             # Could be old data getting to us.
             if rpkt.sequence != self.sequence:
@@ -437,7 +437,7 @@ class ntpq_session:
             if self.debug >= 2:
                 warn("Packet okay\n")
 
-            # Find the most recent fragment with a 
+            # Find the most recent fragment with a
             not_earlier = [frag for frag in fragments \
                            if frag.offset >= rpkt.offset]
             if len(not_earlier):
@@ -458,7 +458,7 @@ class ntpq_session:
 
             # Passed all tests, insert it into the frag list.
             fragments.append(rpkt)
-            fragments.sort(key=lambda frag: frag.offset) 
+            fragments.sort(key=lambda frag: frag.offset)
 
             # Figure out if this was the last.
             # Record status info out of the last packet.
@@ -468,7 +468,7 @@ class ntpq_session:
 
             # If we've seen the last fragment, look for holes in the sequence.
             # If there aren't any, we're done.
-            if seenlastfrag and fragments[0].offset == 0:                
+            if seenlastfrag and fragments[0].offset == 0:
                 for f in range(1, len(fragments)):
                     if fragments[f-1].endpoint() != fragments[f].offset:
                         break


=====================================
pylib/statfiles.py
=====================================
--- a/pylib/statfiles.py
+++ b/pylib/statfiles.py
@@ -35,7 +35,7 @@ class NTPStats:
     def timestamp(line):
         "get Unix time from converted line."
         return float(line.split()[0])
-    def __init__(self, statsdir, sitename=None, 
+    def __init__(self, statsdir, sitename=None,
                  period=None, starttime=None, endtime=None):
         "Grab content of logfiles, sorted by timestamp."
         if period is None:


=====================================
wafhelpers/asciidoc.py
=====================================
--- a/wafhelpers/asciidoc.py
+++ b/wafhelpers/asciidoc.py
@@ -1,6 +1,6 @@
-from util import ascii_doc_scan
 from waflib import Task
 from waflib.TaskGen import extension
+from wafhelpers.util import ascii_doc_scan
 
 # asciidoc -b html5 -a linkcss -a stylesdir=/mnt/devel/ntp/commit/docs -o asd driver32.txt
 


=====================================
wafhelpers/bin_test.py
=====================================
--- a/wafhelpers/bin_test.py
+++ b/wafhelpers/bin_test.py
@@ -1,66 +1,67 @@
-from waflib.Utils import subprocess
-from waflib.Logs import pprint
+from __future__ import print_function
 import re
 from os.path import exists
+from waflib.Utils import subprocess
+from waflib.Logs import pprint
 
 cmd_map = {
-	("main/ntpd/ntpd",				"-invalid"):			r'.*must be run as root, not uid.*',
-	("main/ntpdig/ntpdig",			"time.apple.com"):		r'.*time.apple.com.*',
-	("main/ntpfrob/ntpfrob",			"-h"):				r'.*illegal option.*',
-	("main/ntpfrob/ntpfrob",			"-b 100000"):		r".*Bumping clock by 100000 microseconds.*",
-	("main/ntpkeygen/ntpkeygen",	  "-M"):				r'.*Generating new md5 file and link.*',
-	("main/ntpq/ntpq",  			  "-p"):				r'.*remote.*jitter.*',
-	("main/ntptime/ntptime",		  None):				r'.*ntp_gettime\(\) returns code 0 \(OK\).*',
-	("main/util/sht",				  "2:r"):				r'.*reader.*',
+        ("main/ntpd/ntpd",              "-invalid"):        br'.*must be run as root, not uid.*',
+        ("main/ntpdig/ntpdig",          "time.apple.com"):  br'.*time.apple.com.*',
+        ("main/ntpfrob/ntpfrob",        "-h"):              br'.*illegal option.*',
+        ("main/ntpfrob/ntpfrob",        "-b 100000"):       br".*Bumping clock by 100000 microseconds.*",
+        ("main/ntpkeygen/ntpkeygen",    "-M"):              br'.*Generating new md5 file and link.*',
+        ("main/ntpq/ntpq",              "-p"):              br'.*remote.*jitter.*',
+        ("main/ntptime/ntptime",        None):              br'.*ntp_gettime\(\) returns code 0 \(OK\).*',
+        ("main/util/sht",               "2:r"):             br'.*reader.*',
 
 # XXX: Need to figure out how to test this.
-#	("main/util/hist",  			  ""):  				r'',
+#       ("main/util/hist",                        ""):                                  br'',
 
 # Perl library
-#	("main/ntptrace/ntptrace",  	  ""):  				r'',
-#	("main/ntpwait/ntpwait",		  ""):  				r'',
-#	("main/util/ntpsweep/ntpsweep",   ""):  				r'',
+#       ("main/ntptrace/ntptrace",        ""):                                  br'',
+#       ("main/ntpwait/ntpwait",                  ""):                                  br'',
+#       ("main/util/ntpsweep/ntpsweep",   ""):                                  br'',
 }
 
 
 # XXX: Needs to run in a thread with a timeout.
 def run(cmd, reg):
-	check = False
+        check = False
 
-	if cmd[1] == None:
-		cmd = [cmd[0]]
+        if cmd[1] == None:
+                cmd = [cmd[0]]
 
-	print "running: ", " ".join(cmd),
+        print("running: ", " ".join(cmd), end="")
 
-	if not exists("build/%s" % cmd[0]):
-		pprint("YELLOW", " SKIPPING (does not exist)")
-		return False
+        if not exists("build/%s" % cmd[0]):
+                pprint("YELLOW", " SKIPPING (does not exist)")
+                return False
 
-	p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=None, cwd="build")
+        p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=None, cwd="build")
 
-	stdout, stderr = p.communicate()
+        stdout, stderr = p.communicate()
 
-	regex = re.compile(reg)
+        regex = re.compile(reg)
 
-	if regex.match(stdout) or regex.match(stderr):
-		check = True
+        if regex.match(stdout) or regex.match(stderr):
+                check = True
 
-	if check:
-		pprint("GREEN", "  OK")
-		return False
-	else:
-		pprint("RED", "  FAILED")
-		return True
+        if check:
+                pprint("GREEN", "  OK")
+                return False
+        else:
+                pprint("RED", "  FAILED")
+                return True
 
 
 def cmd_bin_test(ctx, config):
-	fail = True
+        fail = True
 
-	for cmd in sorted(cmd_map):
-		fail = run(cmd, cmd_map[cmd])
+        for cmd in sorted(cmd_map):
+                fail = run(cmd, cmd_map[cmd])
 
-	if fail:
-		pprint("RED", "Tests failed!")
-#		ctx.fatal("Failed")
+        if fail:
+                pprint("RED", "Tests failed!")
+#               ctx.fatal("Failed")
 
 #cmd_bin_test(None, None)


=====================================
wafhelpers/check_cap.py
=====================================
--- a/wafhelpers/check_cap.py
+++ b/wafhelpers/check_cap.py
@@ -1,5 +1,5 @@
-from waflib.Logs import pprint
 import sys
+from waflib.Logs import pprint
 
 def check_cap(ctx):
 


=====================================
wafhelpers/check_libevent2.py
=====================================
--- a/wafhelpers/check_libevent2.py
+++ b/wafhelpers/check_libevent2.py
@@ -1,5 +1,5 @@
 from waflib.Logs import pprint
-from tool import check_sanity
+from wafhelpers.tool import check_sanity
 
 LIBEVENT2_FRAG = """
 #include <event2/thread.h>


=====================================
wafhelpers/check_openssl.py
=====================================
--- a/wafhelpers/check_openssl.py
+++ b/wafhelpers/check_openssl.py
@@ -1,7 +1,6 @@
-from waflib.Configure import conf
-from util import msg, msg_setting
-
 import os
+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 = """


=====================================
wafhelpers/check_pthread.py
=====================================
--- a/wafhelpers/check_pthread.py
+++ b/wafhelpers/check_pthread.py
@@ -1,5 +1,5 @@
 from waflib.Logs import pprint
-from tool import check_sanity
+from wafhelpers.tool import check_sanity
 
 PTHREAD_FRAG = """
 #include <pthread.h>


=====================================
wafhelpers/check_seccomp.py
=====================================
--- a/wafhelpers/check_seccomp.py
+++ b/wafhelpers/check_seccomp.py
@@ -1,5 +1,5 @@
-from waflib.Logs import pprint
 import sys
+from waflib.Logs import pprint
 
 def check_seccomp(ctx):
 


=====================================
wafhelpers/compiler.py
=====================================
--- a/wafhelpers/compiler.py
+++ b/wafhelpers/compiler.py
@@ -1,12 +1,12 @@
-# Some compilers decide they like to mimic GCC as close as possible.  
-# Unfortunately this usually does not apply to #pragma's.  There can also be 
+# Some compilers decide they like to mimic GCC as close as possible.
+# Unfortunately this usually does not apply to #pragma's.  There can also be
 # quirks that need to be dodged specific to a compiler.
 #
-# There are also differences when it comes to coverage and profiling between 
-# compilers.  We'll want to support all to see how the source reacts under 
+# There are also differences when it comes to coverage and profiling between
+# compilers.  We'll want to support all to see how the source reacts under
 # different compilers and architectures.
 #
-# This file exist as the definitive way to check what compiler we're working 
+# This file exist as the definitive way to check what compiler we're working
 # under it defines COMPILER_X in both config.h and the build system.
 
 COMPILER_FRAG = """


=====================================
wafhelpers/configure.py
=====================================
--- a/wafhelpers/configure.py
+++ b/wafhelpers/configure.py
@@ -1,8 +1,7 @@
-from waflib.Configure import conf
-from util import msg, msg_setting
-from probes import *
 import sys, os
-from util import parse_version
+from waflib.Configure import conf
+from wafhelpers.probes import *
+from wafhelpers.util import msg, msg_setting, parse_version
 
 def cmd_configure(ctx, config):
         srcnode = ctx.srcnode.abspath()
@@ -44,7 +43,7 @@ def cmd_configure(ctx, config):
         for opt in opt_map:
                 ctx.env[opt] = opt_map[opt]
 
-        from compiler import check_compiler
+        from wafhelpers.compiler import check_compiler
         check_compiler(ctx)
 
 
@@ -99,7 +98,7 @@ def cmd_configure(ctx, config):
                 cmd = ["git", "log", "-1", "--format=%H"]
                 p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=None)
                 ctx.env.NTPS_REVISION, stderr = p.communicate()
-                ctx.env.NTPS_REVISION = ctx.env.NTPS_REVISION.replace("\n", "")
+                ctx.env.NTPS_REVISION = str(ctx.env.NTPS_REVISION).replace("\n", "")
                 ctx.end_msg(ctx.env.NTPS_REVISION)
 
         ctx.start_msg("Building version")
@@ -125,9 +124,9 @@ def cmd_configure(ctx, config):
         if ctx.options.enable_doc_only:
                 return
 
-        from check_type import check_type
-        from check_sizeof import check_sizeof
-        from check_structfield import check_structfield
+        from wafhelpers.check_type import check_type
+        from wafhelpers.check_sizeof import check_sizeof
+        from wafhelpers.check_structfield import check_structfield
 
         for opt in opt_map:
                 ctx.env[opt] = opt_map[opt]
@@ -150,17 +149,17 @@ def cmd_configure(ctx, config):
 
 
         if ctx.options.list:
-                from refclock import refclock_map
-                print( "ID    Description")
-                print( "~~    ~~~~~~~~~~~")
+                from wafhelpers.refclock import refclock_map
+                print("ID    Description")
+                print("~~    ~~~~~~~~~~~")
                 for id in refclock_map:
-                        print( "%-5s %s" % (id, refclock_map[id]["descr"]))
+                        print("%-5s %s" % (id, refclock_map[id]["descr"]))
 
                 return
 
         # This needs to be at the top since it modifies CC and AR
         if ctx.options.enable_fortify:
-                from check_fortify import check_fortify
+                from wafhelpers.check_fortify import check_fortify
                 check_fortify(ctx)
 
 
@@ -222,14 +221,14 @@ def cmd_configure(ctx, config):
         net_types = (
                 ("struct if_laddrconf", ["sys/types.h", "net/if6.h"]),
                 ("struct if_laddrreq", ["sys/types.h", "net/if6.h"]),
-                )
+        )
         for (f, h) in net_types:
                 ctx.check_type(f, h)
 
         structures = (
                 ("struct timex", ["sys/time.h", "sys/timex.h"]),
                 ("struct ntptimeval", ["sys/time.h", "sys/timex.h"]),
-                )
+        )
         for (s, h) in structures:
                 ctx.check_type(s, h)
 
@@ -238,7 +237,7 @@ def cmd_configure(ctx, config):
                 ("modes", "timex", ["sys/time.h", "sys/timex.h"]),
                 ("time.tv_nsec", "ntptimeval", ["sys/time.h", "sys/timex.h"]),
                 ("tai", "ntptimeval", ["sys/time.h", "sys/timex.h"]),
-                )
+        )
         for (f, s, h) in structure_fields:
                 ctx.check_structfield(f, s, h)
 
@@ -250,7 +249,7 @@ def cmd_configure(ctx, config):
                 (None,                  "long long"),
         ]
 
-        for header, sizeof in sorted(sizeofs):
+        for header, sizeof in sorted(sizeofs, key=lambda x: x[1:]):
                 ctx.check_sizeof(header, sizeof)
 
         # The protocol major number
@@ -279,7 +278,7 @@ def cmd_configure(ctx, config):
 
         # Find OpenSSL. Must happen before function checks
         if ctx.options.enable_crypto:
-                from check_openssl import configure_ssl
+                from wafhelpers.check_openssl import configure_ssl
                 configure_ssl(ctx)
 
         # Optional functions.  Do all function checks here, otherwise
@@ -302,7 +301,7 @@ def cmd_configure(ctx, config):
                 ('strlcpy', ["string.h"]),
                 ('strlcat', ["string.h"]),
                 ('timer_create', ["time.h"])
-                )
+        )
         for ft in functions:
                 if len(ft) == 2:
                         probe_function_with_prerequisites(ctx, function=ft[0],
@@ -377,7 +376,7 @@ def cmd_configure(ctx, config):
         if ctx.get_define("HAVE_PRIV_H") and sys.platform == "Solaris":
                 ctx.define("HAVE_SOLARIS_PRIVS", 1, comment="Enable Solaris Privileges (Solaris only)")
 
-        from check_sockaddr import check_sockaddr
+        from wafhelpers.check_sockaddr import check_sockaddr
         check_sockaddr(ctx)
 
         # Some systems don't have sys/timex.h eg OS X, OpenBSD...
@@ -385,7 +384,7 @@ def cmd_configure(ctx, config):
                 ctx.env.HEADER_SYS_TIMEX_H = True
 
         if ctx.options.refclocks:
-                from refclock import refclock_config
+                from wafhelpers.refclock import refclock_config
                 refclock_config(ctx)
 
         # NetBSD (used to) need to recreate sockets on changed routing.
@@ -450,7 +449,7 @@ def cmd_configure(ctx, config):
         elif sys.byteorder == "big":
                 ctx.define("WORDS_BIGENDIAN", 1)
         else:
-                print( "Can't determine byte order!")
+                print("Can't determine byte order!")
 
         probe_vsprintfm(ctx, "VSNPRINTF_PERCENT_M",
                             "Checking for %m expansion in vsnprintf(3)")


=====================================
wafhelpers/dist.py
=====================================
--- a/wafhelpers/dist.py
+++ b/wafhelpers/dist.py
@@ -2,7 +2,7 @@ from os import path
 from shutil import copyfile
 from os.path import exists
 import time
-from util import parse_version
+from wafhelpers.util import parse_version
 
 def dist_cmd(ctx, config):
 		files_man = []
@@ -37,7 +37,7 @@ def dist_cmd(ctx, config):
 		for man in files_man:
 			src = man.abspath()
 			dst = src.replace("%s/main/" % bldnode.abspath(), "")
-			print "Copying %s -> %s" % (src, dst)
+			print("Copying %s -> %s" % (src, dst))
 			copyfile(src, dst)
 
 		files = [
@@ -48,7 +48,7 @@ def dist_cmd(ctx, config):
 		for src, dst in files:
 			if not path.exists(src):
 				ctx.fatal("%s doesn't exist please configure and build first.  NTPS_RELEASE must be set to False" % src)
-			print "Copying %s -> %s" % (src, dst)
+			print("Copying %s -> %s" % (src, dst))
 			copyfile(src, dst)
 
 		version = "%d.%d.%d" % (config["NTPS_VERSION_MAJOR"], \


=====================================
wafhelpers/refclock.py
=====================================
--- a/wafhelpers/refclock.py
+++ b/wafhelpers/refclock.py
@@ -33,7 +33,7 @@ refclock_map = {
 		"file":		"generic"
 	},
 
-       "magnavox": {
+	"magnavox": {
 		"descr":	"Magnavox MX4200 and related GPS receivers",
 		"define":	"CLOCK_MAGNAVOX",
 		"require":	["ppsapi"],
@@ -132,7 +132,7 @@ refclock_map = {
 
 @conf
 def refclock_config(ctx):
-	from refclock import refclock_map
+	from wafhelpers.refclock import refclock_map
 
 	if ctx.options.refclocks == "all":
 		ids = refclock_map.keys()
@@ -169,7 +169,7 @@ def refclock_config(ctx):
 				"CLOCK_TRIMTSIP",
 				"CLOCK_VARITEXT",
 				"CLOCK_WHARTON_400A",
-				)
+			)
 			for subtype in parse_clocks:
 				ctx.define(subtype, 1, comment="Enable individual parse clock")
 


=====================================
wafhelpers/test.py
=====================================
--- a/wafhelpers/test.py
+++ b/wafhelpers/test.py
@@ -13,9 +13,9 @@ def test_write_log(ctx):
 			fp.write("BINARY      : %s\n" % binary)
 			fp.write("RETURN VALUE: %s\n" % retval)
 			fp.write("\n*** stdout ***\n")
-			fp.write(lines)
+			fp.write(str(lines))
 			fp.write("\n*** stderr ***\n")
-			fp.write(error)
+			fp.write(str(error))
 			fp.write("\n\n\n")
 
 	pprint("BLUE", "Wrote test log to: ", file_out)
@@ -30,9 +30,9 @@ def test_print_log(ctx):
 		if retval or error:
 			pprint("RED", "****** ERROR ******\n")
 
-			print error or lines
+			print(error or lines)
 
 		if (not retval) and (not error):
 			pprint("GREEN", "****** LOG ******\n", lines)
 
-		print
+		print("")


=====================================
wafhelpers/util.py
=====================================
--- a/wafhelpers/util.py
+++ b/wafhelpers/util.py
@@ -1,5 +1,5 @@
-from waflib.Logs import pprint
 import re
+from waflib.Logs import pprint
 
 def msg(str):
 	pprint("YELLOW", str)


=====================================
wafhelpers/waf.py
=====================================
--- a/wafhelpers/waf.py
+++ b/wafhelpers/waf.py
@@ -69,8 +69,8 @@ def manpage(ctx, section, source):
 		target      = source + '.man-tmp',
 		subst_fun   = manpage_subst_fun
 	)
- 
-	ctx(source=source + '.man-tmp', section=section) 
+
+	ctx(source=source + '.man-tmp', section=section)
 
 
 @conf


=====================================
wscript
=====================================
--- a/wscript
+++ b/wscript
@@ -50,9 +50,9 @@ class check(BuildContext):
 	variant = "main"
 
 def bin_test(ctx):
+	"""Run binary check, use after tests."""
 	from wafhelpers.bin_test import cmd_bin_test
 	cmd_bin_test(ctx, config)
-bin_test.__doc__ = "Run binary check, use after tests."
 
 # Borrowed from https://www.rtems.org/
 variant_cmd = (



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/fad5faf3673a0c2b436109c9178faeb194c62820...9fbee5b9dd1e03e52084b1a92926996ac6e8d6a9
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160911/934b1a87/attachment.html>


More information about the vc mailing list