[Git][NTPsec/ntpsec][master] 3 commits: Python3 fix: mixed tabs/spaces

Eric S. Raymond gitlab at mg.gitlab.com
Sun Oct 2 15:57:44 UTC 2016


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


Commits:
10105275 by Matt Selsky at 2016-10-02T11:55:54-04:00
Python3 fix: mixed tabs/spaces

Fixes:
TabError: inconsistent use of tabs and spaces in indentation

- - - - -
c5959d99 by Matt Selsky at 2016-10-02T11:55:54-04:00
Python3: use print() function

- - - - -
377d4faf by Matt Selsky at 2016-10-02T11:55:54-04:00
tv_nsec is a long

Don't cast it to long or to u_int. And update the format strings to match.

- - - - -


4 changed files:

- contrib/gps-log
- ntpd/refclock_oncore.c
- ntpdig/main.c
- wafhelpers/configure.py


Changes:

=====================================
contrib/gps-log
=====================================
--- a/contrib/gps-log
+++ b/contrib/gps-log
@@ -1,6 +1,8 @@
 #!/usr/bin/env python
 # coding: utf-8
 
+from __future__ import print_function
+
 from gps import *
 import time
 from datetime import datetime
@@ -29,7 +31,7 @@ if __name__ == '__main__':
     print("# Time       Device     tdop     nSat")
     while True:
       #It may take a second or two to get good data
-      #print gpsd.fix.latitude,', ',gpsd.fix.longitude,'  Time: ',gpsd.utc
+      #print(gpsd.fix.latitude,', ',gpsd.fix.longitude,'  Time: ',gpsd.utc)
 
       try:
         if 'nan' != gpsd.fix.time and not isnan(gpsd.fix.time):
@@ -49,10 +51,10 @@ if __name__ == '__main__':
       time.sleep(5) #set to whatever
 
   except (KeyboardInterrupt, SystemExit): #when you press ctrl+c
-    print "\nKilling Thread..."
+    print("\nKilling Thread...")
   except Exception as e:       # any error, signal
     print( e )
 
   gpsp.running = False
   gpsp.join() # wait for the thread to finish what it's doing
-  print "Done.\nExiting."
+  print("Done.\nExiting.")


=====================================
ntpd/refclock_oncore.c
=====================================
--- a/ntpd/refclock_oncore.c
+++ b/ntpd/refclock_oncore.c
@@ -1899,7 +1899,7 @@ oncore_msg_any(
 	if (debug > 3) {
 		(void) clock_gettime(CLOCK_REALTIME, &ts);
 		oncore_log(instance, LOG_DEBUG, "%ld.%09ld",
-			   (long)tv.tv_sec, (long)tv.tv_nsec);
+			   (long)tv.tv_sec, tv.tv_nsec);
 
 		if (!*fmt) {
 			snprintf(Msg, sizeof(Msg), ">>@@%c%c ", buf[2],


=====================================
ntpdig/main.c
=====================================
--- a/ntpdig/main.c
+++ b/ntpdig/main.c
@@ -759,8 +759,8 @@ queue_xmt(
 		if (xctx->sched > start_cb.tv_sec)
 			delay.tv_sec = xctx->sched - start_cb.tv_sec;
 		ns_event_add(ev_xmt_timer, delay);
-		TRACE(2, ("queue_xmt: xmt timer for %u usec\n",
-			  (u_int)delay.tv_nsec/1000));
+		TRACE(2, ("queue_xmt: xmt timer for %ld usec\n",
+			  delay.tv_nsec/1000));
 	}
 }
 
@@ -789,8 +789,8 @@ xmt_timer_cb(
 	gettimeofday_cached(base, &start_cb);
 	if (xmt_q->sched <= start_cb.tv_sec) {
 		UNLINK_HEAD_SLIST(x, xmt_q, link);
-		TRACE(2, ("xmt_timer_cb: at .%6.6u -> %s\n",
-			  (u_int)start_cb.tv_nsec/1000, socktoa(&x->spkt->addr)));
+		TRACE(2, ("xmt_timer_cb: at .%6.6ld -> %s\n",
+			  start_cb.tv_nsec/1000, socktoa(&x->spkt->addr)));
 		xmt(x);
 		free(x);
 		if (NULL == xmt_q)
@@ -798,15 +798,15 @@ xmt_timer_cb(
 	}
 	if (xmt_q->sched <= start_cb.tv_sec) {
 		ns_event_add(ev_xmt_timer, gap);
-		TRACE(2, ("xmt_timer_cb: at .%6.6u gap %6.6u\n",
-			  (u_int)start_cb.tv_nsec/1000,
-			  (u_int)gap.tv_nsec));
+		TRACE(2, ("xmt_timer_cb: at .%6.6ld gap %6.6ld\n",
+			  start_cb.tv_nsec/1000,
+			  gap.tv_nsec));
 	} else {
 		delay.tv_sec = xmt_q->sched - start_cb.tv_sec;
 		delay.tv_nsec = 0;
 		ns_event_add(ev_xmt_timer, delay);
-		TRACE(2, ("xmt_timer_cb: at .%6.6u next %ld seconds\n",
-			  (u_int)start_cb.tv_nsec/1000,
+		TRACE(2, ("xmt_timer_cb: at .%6.6ld next %ld seconds\n",
+			  start_cb.tv_nsec/1000,
 			  (long)delay.tv_sec));
 	}
 }
@@ -846,8 +846,8 @@ xmt(
 		       pkt_len));
 		spkt->stime = tv_xmt.tv_sec - JAN_1970;
 
-		TRACE(2, ("xmt: %lx.%6.6u %s %s\n", (u_long)tv_xmt.tv_sec,
-			  (u_int)tv_xmt.tv_nsec/1000, dctx->name, socktoa(dst)));
+		TRACE(2, ("xmt: %lx.%6.6ld %s %s\n", (u_long)tv_xmt.tv_sec,
+			  tv_xmt.tv_nsec/1000, dctx->name, socktoa(dst)));
 	} else {
 		dec_pending_ntp(dctx->name, dst);
 	}
@@ -1726,7 +1726,7 @@ gettimeofday_cached(
 		diff = sub_tspec(systemt, latest);
 		if (debug > 1)
 			printf("system minus cached %+ld.%06ld\n",
-			       (long)diff.tv_sec, (long)diff.tv_nsec/1000);
+			       (long)diff.tv_sec, diff.tv_nsec/1000);
 		if (0 != cgt_rc || labs((long)diff.tv_sec) < 3600) {
 			/*
 			 * Either use_monotonic == 0, or this libevent
@@ -1736,14 +1736,14 @@ gettimeofday_cached(
 			diff = sub_tspec(latest, mono);
 			if (debug > 1)
 				printf("cached minus monotonic %+ld.%06ld\n",
-				       (long)diff.tv_sec, (long)diff.tv_nsec/1000);
+				       (long)diff.tv_sec, diff.tv_nsec/1000);
 			if (labs((long)diff.tv_sec) < 3600) {
 				/* older libevent2 using monotonic */
 				offset = sub_tspec(systemt, mono);
 				TRACE(1, ("%s: Offsetting libevent CLOCK_MONOTONIC times  by %+ld.%06ld\n",
 					 "gettimeofday_cached",
 					 (long)offset.tv_sec,
-					 (long)offset.tv_nsec/1000));
+					 offset.tv_nsec/1000));
 			}
 		}
 		offset_ready = true;


=====================================
wafhelpers/configure.py
=====================================
--- a/wafhelpers/configure.py
+++ b/wafhelpers/configure.py
@@ -30,15 +30,15 @@ def cmd_configure(ctx, config):
         # Wipe out and override flags with those from the commandline
         for flag in ctx.env.OPT_STORE:
                 if flag == "--undefine":
-			for sym in ctx.env.OPT_STORE[flag]:
-				ctx.undefine(sym)
+                        for sym in ctx.env.OPT_STORE[flag]:
+                                ctx.undefine(sym)
                 elif flag == "--define":
-			for symval in ctx.env.OPT_STORE[flag]:
-				(sym, val) = symval.split("=")
-				try:
-					ctx.define(sym, int(val))
-				except ValueError:
-					ctx.define(sym, val)
+                        for symval in ctx.env.OPT_STORE[flag]:
+                                (sym, val) = symval.split("=")
+                                try:
+                                        ctx.define(sym, int(val))
+                                except ValueError:
+                                        ctx.define(sym, val)
                 else:
                         opt = flag.replace("--", "").upper()
                         opt_map[opt] = ctx.env.OPT_STORE[flag]
@@ -209,12 +209,12 @@ def cmd_configure(ctx, config):
         if ctx.env.PLATFORM_TARGET == "osx":
                 ctx.define("__APPLE_USE_RFC_3542", 1, comment="Needed for IPv6 support")
 
-	ctx.define("PLATFORM_FULL", platform.platform())
+        ctx.define("PLATFORM_FULL", platform.platform())
 
         # int32_t and uint32_t probes aren't really needed, POSIX guarantees
         # them.  But int64_t and uint64_t are not guaranteed to exist on 32-bit
         # machines.  The calendar and ISC code needs them.
-	types = ["uint64_t"]
+        types = ["uint64_t"]
 
         for inttype in sorted(types):
                 ctx.check_type(inttype, ["stdint.h", "sys/types.h"])
@@ -291,7 +291,7 @@ def cmd_configure(ctx, config):
                 ('clock_gettime', ["time.h"], "RT"),
                 ('clock_settime', ["time.h"], "RT"),
                 ('EVP_MD_do_all_sorted', ["openssl/evp.h"], "CRYPTO"),
-		('getdtablesize', ["unistd.h"]),
+                ('getdtablesize', ["unistd.h"]),
                 ('getpassphrase', ["stdlib.h"]),                # Sun systems
                 ('getrusage', ["sys/time.h", "sys/resource.h"]),
                 ('MD5Init', ["md5.h"], "CRYPTO"),
@@ -327,8 +327,8 @@ def cmd_configure(ctx, config):
         # Some of these are cruft from ancient big-iron systems and should
         # be removed.
         optional_headers = (
-		"alloca.h",
-		"arpa/nameser.h",
+                "alloca.h",
+                "arpa/nameser.h",
                 "dns_sd.h",             # NetBSD, Apple, mDNS
                 ("ifaddrs.h", ["sys/types.h"]),
                 "libscf.h",             # Solaris



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/ed4c07cb1caade555ed43b9ff253a7c097e860fd...377d4faf9c53ceec5f5be059964c5a6d8a08c247
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161002/5eaadf7d/attachment.html>


More information about the vc mailing list