[Git][NTPsec/ntpsec][master] 2 commits: replace unnecessary ntp.util imports

Eric S. Raymond gitlab at mg.gitlab.com
Sat Jan 26 13:51:08 UTC 2019


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


Commits:
7c1aee59 by James Browning at 2019-01-26T13:48:03Z
replace unnecessary ntp.util imports

- - - - -
88430fb7 by James Browning at 2019-01-26T13:48:03Z
raise SystemExit(1) on version mismatch

- - - - -


11 changed files:

- ntpclients/ntpdig.py
- ntpclients/ntpkeygen.py
- ntpclients/ntploggps.py
- ntpclients/ntplogtemp.py
- ntpclients/ntpmon.py
- ntpclients/ntpq.py
- ntpclients/ntpsnmpd.py
- ntpclients/ntpsweep.py
- ntpclients/ntptrace.py
- ntpclients/ntpviz.py
- ntpclients/ntpwait.py


Changes:

=====================================
ntpclients/ntpdig.py
=====================================
@@ -262,6 +262,12 @@ USAGE:  ntpdig [-<flag> [<val>] | --<name>[{=| }<val>]]...
 
 
 if __name__ == '__main__':
+    bin_ver = "ntpsec- at NTPSEC_VERSION_EXTENDED@"
+    if ntp.util.stdversion() != bin_ver:
+        sys.stderr.write("Library/Binary version mismatch\n")
+        sys.stderr.write("Binary: %s\n" % bin_ver)
+        sys.stderr.write("Library: %s\n" % ntp.util.stdversion())
+        raise SystemExit(1)
     try:
         try:
             (options, arguments) = getopt.getopt(
@@ -349,7 +355,7 @@ if __name__ == '__main__':
                     print(usage)
                     raise SystemExit(0)
                 elif switch in ("-V", "--version"):
-                    print("ntpdig %s" % ntp.util.stdversion())
+                    print("ntpdig %s" % bin_ver)
                     raise SystemExit(0)
                 else:
                     sys.stderr.write(


=====================================
ntpclients/ntpkeygen.py
=====================================
@@ -27,7 +27,6 @@ import random
 import time
 import getopt
 import stat
-import ntp.util
 
 #
 # Cryptodefines
@@ -99,7 +98,7 @@ if __name__ == '__main__':
             print("usage: ntpkeygen")
             raise SystemExit(0)
         elif switch in ("-V", "--version"):
-            print("ntpkeygen %s" % ntp.util.stdversion())
+            print("ntpkeygen ntpsec- at NTPSEC_VERSION_EXTENDED@")
             raise SystemExit(0)
 
     # The seed is ignored by random.SystemRandom,


=====================================
ntpclients/ntploggps.py
=====================================
@@ -44,14 +44,6 @@ except ImportError as e:
     sys.stderr.write("%s\n" % e)
     sys.exit(1)
 
-try:
-    import ntp.util
-except ImportError as e:
-    sys.stderr.write(
-        "ntploggps: can't find Python NTP library -- check PYTHONPATH.\n")
-    sys.stderr.write("%s\n" % e)
-    sys.exit(1)
-
 
 def logging_setup():
     "Create logging object"
@@ -107,7 +99,7 @@ parser.add_argument('-v', '--verbose',
 
 parser.add_argument('-V', '--version',
                     action="version",
-                    version="ntploggps %s" % ntp.util.stdversion())
+                    version="ntploggps ntpsec- at NTPSEC_VERSION_EXTENDED@")
 
 args = parser.parse_args()
 


=====================================
ntpclients/ntplogtemp.py
=====================================
@@ -31,14 +31,6 @@ import subprocess
 import sys
 import time
 
-try:
-    import ntp.util
-except ImportError as e:
-    sys.stderr.write(
-        "ntplogtemp: can't find Python NTP library -- check PYTHONPATH.\n")
-    sys.stderr.write("%s\n" % e)
-    sys.exit(1)
-
 
 def run_binary(cmd):
     """\
@@ -241,7 +233,7 @@ parser.add_argument('-w', '--wait',
                     type=int)
 parser.add_argument('-V', '--version',
                     action="version",
-                    version="ntplogtemp %s" % ntp.util.stdversion())
+                    version="ntplogtemp ntpsec- at NTPSEC_VERSION_EXTENDED@")
 args = parser.parse_args()
 
 


=====================================
ntpclients/ntpmon.py
=====================================
@@ -211,6 +211,12 @@ USAGE: ntpmon [-dhnuV] [-D lvl] [-l logfile] [host]
 '''
 
 if __name__ == '__main__':
+    bin_ver = "ntpsec- at NTPSEC_VERSION_EXTENDED@"
+    if ntp.util.stdversion() != bin_ver:
+        sys.stderr.write("Library/Binary version mismatch\n")
+        sys.stderr.write("Binary: %s\n" % bin_ver)
+        sys.stderr.write("Library: %s\n" % ntp.util.stdversion())
+        raise SystemExit(1)
     try:
         (options, arguments) = getopt.getopt(sys.argv[1:],
                                              "dD:hl:nuV",


=====================================
ntpclients/ntpq.py
=====================================
@@ -1563,6 +1563,12 @@ USAGE: ntpq [-46dphinOV] [-c str] [-D lvl] [host ...]
 '''
 
 if __name__ == '__main__':
+    bin_ver = "ntpsec- at NTPSEC_VERSION_EXTENDED@"
+    if ntp.util.stdversion() != bin_ver:
+        sys.stderr.write("Library/Binary version mismatch\n")
+        sys.stderr.write("Binary: %s\n" % bin_ver)
+        sys.stderr.write("Library: %s\n" % ntp.util.stdversion())
+        raise SystemExit(1)
     try:
         (options, arguments) = getopt.getopt(
             sys.argv[1:],


=====================================
ntpclients/ntpsnmpd.py
=====================================
@@ -1115,6 +1115,12 @@ USAGE: ntpsnmpd [-n] [ntp host]
 
 
 if __name__ == "__main__":
+    bin_ver = "ntpsec- at NTPSEC_VERSION_EXTENDED@"
+    if ntp.util.stdversion() != bin_ver:
+        sys.stderr.write("Library/Binary version mismatch\n")
+        sys.stderr.write("Binary: %s\n" % bin_ver)
+        sys.stderr.write("Library: %s\n" % ntp.util.stdversion())
+        raise SystemExit(1)
     try:
         (options, arguments) = getopt.getopt(
             sys.argv[1:],


=====================================
ntpclients/ntpsweep.py
=====================================
@@ -149,6 +149,12 @@ def scan_host(host, level):
 
 
 if __name__ == '__main__':
+    bin_ver = "ntpsec- at NTPSEC_VERSION_EXTENDED@"
+    if ntp.util.stdversion() != bin_ver:
+        sys.stderr.write("Library/Binary version mismatch\n")
+        sys.stderr.write("Binary: %s\n" % bin_ver)
+        sys.stderr.write("Library: %s\n" % ntp.util.stdversion())
+        raise SystemExit(1)
     try:
         (options, arguments) = getopt.getopt(
             sys.argv[1:], "h:l:m:ps:?V",


=====================================
ntpclients/ntptrace.py
=====================================
@@ -116,6 +116,13 @@ USAGE: ntptrace [-<flag> [<val>] | --<name>[{=| }<val>]]... [host]
 Options are specified by doubled hyphens and their name or by a single
 hyphen and the flag character.""" + "\n"
 
+bin_ver = "ntpsec- at NTPSEC_VERSION_EXTENDED@"
+if ntp.util.stdversion() != bin_ver:
+    sys.stderr.write("Library/Binary version mismatch\n")
+    sys.stderr.write("Binary: %s\n" % bin_ver)
+    sys.stderr.write("Library: %s\n" % ntp.util.stdversion())
+    raise SystemExit(1)
+
 try:
     (options, arguments) = getopt.getopt(
         sys.argv[1:], "m:nr:?V",


=====================================
ntpclients/ntpviz.py
=====================================
@@ -1362,6 +1362,12 @@ AADRxQAAxBEAAA==
 """
 
 if __name__ == '__main__':
+    bin_ver = "ntpsec- at NTPSEC_VERSION_EXTENDED@"
+    if ntp.util.stdversion() != bin_ver:
+        sys.stderr.write("Library/Binary version mismatch\n")
+        sys.stderr.write("Binary: %s\n" % bin_ver)
+        sys.stderr.write("Library: %s\n" % ntp.util.stdversion())
+        raise SystemExit(1)
 
     parser = MyArgumentParser(description="ntpd stats visualizer",
                               fromfile_prefix_chars='@',


=====================================
ntpclients/ntpwait.py
=====================================
@@ -51,6 +51,12 @@ class Unbuffered(object):
 
 
 if __name__ == "__main__":
+    bin_ver = "ntpsec- at NTPSEC_VERSION_EXTENDED@"
+    if ntp.util.stdversion() != bin_ver:
+        sys.stderr.write("Library/Binary version mismatch\n")
+        sys.stderr.write("Binary: %s\n" % bin_ver)
+        sys.stderr.write("Library: %s\n" % ntp.util.stdversion())
+        raise SystemExit(1)
     try:
         (options, arguments) = getopt.getopt(sys.argv[1:], "hn:s:vV", [
             "tries=", "sleep=", "verbose", "help", "version"



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/024ea85ecdc91d5c630c4062a5117218455d6bff...88430fb7d1fb1dd0bc1e997b8cb03767a0b549de

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/024ea85ecdc91d5c630c4062a5117218455d6bff...88430fb7d1fb1dd0bc1e997b8cb03767a0b549de
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20190126/e7318ded/attachment-0001.html>


More information about the vc mailing list