[Git][NTPsec/ntpsec][master] Add checks for python's argparse
Matt Selsky
gitlab at mg.gitlab.com
Sat Oct 5 05:32:30 UTC 2019
Matt Selsky pushed to branch master at NTPsec / ntpsec
Commits:
f02b8ee5 by Matt Selsky at 2019-10-05T05:32:25Z
Add checks for python's argparse
and skip installation of ntplogtemp and ntpviz if we're missing argparse
Gitlab issue #613
- - - - -
3 changed files:
- pylib/wscript
- wafhelpers/bin_test.py
- wscript
Changes:
=====================================
pylib/wscript
=====================================
@@ -16,6 +16,12 @@ def configure(conf):
except conf.errors.ConfigurationError:
pprint("YELLOW", "WARNING: ntpmon will not be built/installed since "
"python curses module was not found")
+ try:
+ conf.check_python_module('argparse')
+ conf.env['PYTHON_ARGPARSE'] = True
+ except conf.errors.ConfigurationError:
+ pprint("YELLOW", "WARNING: ntploggps, ntplogtemp, and ntpviz will not "
+ "be built/installed since python argparse module was not found")
try:
conf.check_python_module('gps', condition="ver >= num(3, 18)")
conf.env['PYTHON_GPS'] = True
=====================================
wafhelpers/bin_test.py
=====================================
@@ -19,18 +19,22 @@ cmd_map = {
("main/ntpfrob/ntpfrob", "-V"): "ntpfrob %s\n" % verStr,
("main/ntptime/ntptime", "-V"): "ntptime %s\n" % verStr
}
-cmd_map2 = {
+cmd_map_python = {
("main/ntpclients/ntpdig", "--version"): "ntpdig %s\n" % verStr,
("main/ntpclients/ntpkeygen", "--version"): "ntpkeygen %s\n" % verStr,
("main/ntpclients/ntpq", "--version"): "ntpq %s\n" % verStr,
- ("main/ntpclients/ntplogtemp", "--version"): "ntplogtemp %s\n" % verStr,
("main/ntpclients/ntpsnmpd", "--version"): "ntpsnmpd %s\n" % verStr,
("main/ntpclients/ntpsweep", "--version"): "ntpsweep %s\n" % verStr,
("main/ntpclients/ntptrace", "--version"): "ntptrace %s\n" % verStr,
- ("main/ntpclients/ntpviz", "--version"): "ntpviz %s\n" % verStr,
("main/ntpclients/ntpwait", "--version"): "ntpwait %s\n" % verStr
}
-cmd_map3 = { # Need curses
+# Need argparse
+cmd_map_python_argparse = {
+ ("main/ntpclients/ntplogtemp", "--version"): "ntplogtemp %s\n" % verStr,
+ ("main/ntpclients/ntpviz", "--version"): "ntpviz %s\n" % verStr,
+}
+# Need python curses
+cmd_map_python_curses = {
("main/ntpclients/ntpmon", "--version"): "ntpmon %s\n" % verStr,
}
@@ -87,16 +91,18 @@ def cmd_bin_test(ctx, config):
"""Run a suite of binary tests."""
fails = 0
+ if ctx.env['PYTHON_ARGPARSE']:
+ cmd_map_python.update(cmd_map_python_argparse)
+
if ctx.env['PYTHON_CURSES']:
- for cmd in cmd_map3:
- cmd_map2[cmd] = cmd_map3[cmd]
+ cmd_map_python.update(cmd_map_python_curses)
for cmd in sorted(cmd_map):
if not run(cmd, cmd_map[cmd], False):
fails += 1
- for cmd in sorted(cmd_map2):
- if not run(cmd, cmd_map2[cmd], True):
+ for cmd in sorted(cmd_map_python):
+ if not run(cmd, cmd_map_python[cmd], True):
fails += 1
if 1 == fails:
=====================================
wscript
=====================================
@@ -1018,9 +1018,7 @@ python_scripts = [
"ntpclients/ntpq.py",
"ntpclients/ntpsweep.py",
"ntpclients/ntptrace.py",
- "ntpclients/ntpviz.py",
"ntpclients/ntpwait.py",
- "ntpclients/ntplogtemp.py",
"ntpclients/ntpsnmpd.py",
]
@@ -1062,10 +1060,13 @@ def build(ctx):
ctx.recurse("etc")
ctx.recurse("tests")
+ if ctx.env['PYTHON_ARGPARSE']:
+ python_scripts.append("ntpclients/ntplogtemp.py")
+ python_scripts.append("ntpclients/ntpviz.py")
+ if ctx.env['PYTHON_ARGPARSE'] and ctx.env['PYTHON_GPS']:
+ python_scripts.append("ntpclients/ntploggps.py")
if ctx.env['PYTHON_CURSES']:
python_scripts.append("ntpclients/ntpmon.py")
- if ctx.env['PYTHON_GPS']:
- python_scripts.append("ntpclients/ntploggps.py")
# Make sure the python scripts compile, but don't install them
ctx(
@@ -1088,16 +1089,17 @@ def build(ctx):
if ctx.cmd == 'clean':
afterparty(ctx)
- if ctx.env['PYTHON_GPS']:
+ if ctx.env['PYTHON_ARGPARSE']:
+ ctx.manpage(1, "ntpclients/ntplogtemp-man.adoc")
+ ctx.manpage(1, "ntpclients/ntpviz-man.adoc")
+ if ctx.env['PYTHON_ARGPARSE'] and ctx.env['PYTHON_GPS']:
ctx.manpage(1, "ntpclients/ntploggps-man.adoc")
- ctx.manpage(1, "ntpclients/ntpdig-man.adoc")
if ctx.env['PYTHON_CURSES']:
ctx.manpage(1, "ntpclients/ntpmon-man.adoc")
+ ctx.manpage(1, "ntpclients/ntpdig-man.adoc")
ctx.manpage(1, "ntpclients/ntpq-man.adoc")
ctx.manpage(1, "ntpclients/ntpsweep-man.adoc")
ctx.manpage(1, "ntpclients/ntptrace-man.adoc")
- ctx.manpage(1, "ntpclients/ntpviz-man.adoc")
- ctx.manpage(1, "ntpclients/ntplogtemp-man.adoc")
ctx.manpage(8, "ntpclients/ntpkeygen-man.adoc")
ctx.manpage(8, "ntpclients/ntpleapfetch-man.adoc")
ctx.manpage(8, "ntpclients/ntpwait-man.adoc")
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/f02b8ee5472f3fa834b8330c7c761b7027188dd9
--
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/f02b8ee5472f3fa834b8330c7c761b7027188dd9
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/20191005/b9aab9a1/attachment-0001.htm>
More information about the vc
mailing list