From 1695637b8683a18ba7d0898b76396e4be16e8b3a Mon Sep 17 00:00:00 2001 From: James Browning Date: Fri, 22 Jul 2022 19:17:14 -0700 Subject: [PATCH] Attempt at building without target python (mostly for cross) --- attic/wscript | 13 +- docs/wscript | 25 +- libaes_siv/wscript | 28 +- libntp/wscript | 22 +- ntpd/wscript | 42 +-- ntpfrob/wscript | 13 +- ntptime/wscript | 3 +- pylib/version.txt.in | 1 + pylib/wscript | 93 +++--- tests/wscript | 62 ++-- wafhelpers/bin_test.py | 64 ++--- wscript | 632 +++++++++++++++++++++++------------------ 12 files changed, 547 insertions(+), 451 deletions(-) create mode 100644 pylib/version.txt.in diff --git a/attic/wscript b/attic/wscript index aaeb5ea35..cad19bd91 100644 --- a/attic/wscript +++ b/attic/wscript @@ -1,8 +1,13 @@ def build(ctx): - util = [ 'sht', - 'digest-find', 'clocks', "random", - 'digest-timing', 'cmac-timing', - 'backwards'] + util = [ + "sht", + "digest-find", + "clocks", + "random", + "digest-timing", + "cmac-timing", + "backwards", + ] for name in util: ctx( diff --git a/docs/wscript b/docs/wscript index 0e41f508e..b9a557d98 100644 --- a/docs/wscript +++ b/docs/wscript @@ -1,6 +1,6 @@ def build(ctx): - doc_source = ctx.path.ant_glob("*.adoc", excl='*-body.adoc') + doc_source = ctx.path.ant_glob("*.adoc", excl="*-body.adoc") ctx( source=doc_source, @@ -8,11 +8,11 @@ def build(ctx): ) image_source = [] - ctx.path.get_bld().make_node("hints").mkdir() # create 'hints' directory + ctx.path.get_bld().make_node("hints").mkdir() # create 'hints' directory for dir in ["icons", "pic"]: - files = ctx.path.ant_glob('%s/*' % dir) # Find images - ctx.path.get_bld().make_node(dir).mkdir() # create 'pic' directory + files = ctx.path.ant_glob("%s/*" % dir) # Find images + ctx.path.get_bld().make_node(dir).mkdir() # create 'pic' directory image_source += files # Copy images @@ -20,21 +20,16 @@ def build(ctx): features="subst", is_copy=True, source=files, - target=[ctx.path.find_node(dir).get_bld().make_node(x.name) - for x in files] + target=[ctx.path.find_node(dir).get_bld().make_node(x.name) for x in files], ) extra = ["asciidoc.js", "asciidoc.css"] # Copy extra files - ctx( - features="subst", - is_copy=True, - source=extra, - target=extra - ) + ctx(features="subst", is_copy=True, source=extra, target=extra) # Install HTML - ctx.install_files('${HTMLDIR}', extra + - [x.change_ext(".html").name for x in doc_source]) - ctx.install_files('${HTMLDIR}', image_source, relative_trick=True) + ctx.install_files( + "${HTMLDIR}", extra + [x.change_ext(".html").name for x in doc_source] + ) + ctx.install_files("${HTMLDIR}", image_source, relative_trick=True) diff --git a/libaes_siv/wscript b/libaes_siv/wscript index 6723e3b38..33da8b6f0 100644 --- a/libaes_siv/wscript +++ b/libaes_siv/wscript @@ -1,21 +1,21 @@ def build(ctx): - aes_cflags=['-Wno-shadow', - # '-Wall', '-Wextra', '-Wstrict-prototypes', # default - '-Wconversion', - '-O3', - '-fomit-frame-pointer', - '-funroll-loops', - '-ftree-vectorize', - '-Wno-inline', # gcc 10 gives inline warnings? - ] - + aes_cflags = [ + "-Wno-shadow", + # '-Wall', '-Wextra', '-Wstrict-prototypes', # default + "-Wconversion", + "-O3", + "-fomit-frame-pointer", + "-funroll-loops", + "-ftree-vectorize", + "-Wno-inline", # gcc 10 gives inline warnings? + ] ctx( - target='aes_siv', - features='c cstlib', + target="aes_siv", + features="c cstlib", includes=[ctx.bldnode.parent.abspath()], - source='aes_siv.c', - use='CRYPTO', + source="aes_siv.c", + use="CRYPTO", cflags=aes_cflags, ) diff --git a/libntp/wscript b/libntp/wscript index dfb2aa518..6e64890b1 100644 --- a/libntp/wscript +++ b/libntp/wscript @@ -4,6 +4,7 @@ import waflib from waflib import Errors, Options from waflib.Logs import pprint + def build(ctx): libntp_source = [ @@ -53,7 +54,7 @@ def build(ctx): use="CRYPTO SSL", ) - if ctx.env['ntpc'] == 'ffi': + if ctx.env["ntpc"] == "ffi": # Loadable FFI stub ctx( features="c cshlib", @@ -61,22 +62,25 @@ def build(ctx): source=["ntp_c.c", "pymodule-mac.c"] + libntp_source_sharable, target="../pylib/ntpc", # Put the output in the pylib directory use="M RT CRYPTO", - vnum=ctx.env['ntpcver'], + vnum=ctx.env["ntpcver"], ) ctx.add_post_fun(post) - elif ctx.env['ntpc'] == 'ext': + elif ctx.env["ntpc"] == "ext": # Loadable Python extension ctx( features="c cshlib pyext", - install_path='${PYTHONARCHDIR}/ntp', + install_path="${PYTHONARCHDIR}/ntp", includes=[ctx.bldnode.parent.abspath(), "../include"], source=["pymodule.c", "pymodule-mac.c"] + libntp_source_sharable, target="../pylib/ntpc", # Put the output in the pylib directory use="M RT CRYPTO", ) + elif "none" == ctx.env["ntpc"]: + return + def post(ctx): - if not (ctx.cmd == 'install' and ctx.env.BIN_LDCONFIG): + if not (ctx.cmd == "install" and ctx.env.BIN_LDCONFIG): return destdir = Options.options.destdir @@ -92,11 +96,13 @@ def post(ctx): # Try to run ldconfig. It is not a fatal error here if it fails, as the # install could be run by a non-root user. - ldconfig = ' '.join(ctx.env.BIN_LDCONFIG) + ldconfig = " ".join(ctx.env.BIN_LDCONFIG) try: out = ctx.cmd_and_log( - ctx.env.BIN_LDCONFIG, output=waflib.Context.STDOUT, - quiet=waflib.Context.BOTH) + ctx.env.BIN_LDCONFIG, + output=waflib.Context.STDOUT, + quiet=waflib.Context.BOTH, + ) pprint("GREEN", "running: %s OK" % ldconfig) except Errors.WafError as e: pprint("RED", "running: %s FAILED" % ldconfig) diff --git a/ntpd/wscript b/ntpd/wscript index 92500498a..d42b317b3 100644 --- a/ntpd/wscript +++ b/ntpd/wscript @@ -1,4 +1,3 @@ - def build(ctx): bldnode = ctx.bldnode.abspath() @@ -15,7 +14,9 @@ def build(ctx): # Generate Bison file first. ctx.add_group() - keyword_gen_source = ["keyword-gen.c", ] + keyword_gen_source = [ + "keyword-gen.c", + ] ctx( features="c cprogram", @@ -35,7 +36,7 @@ def build(ctx): features="c", rule="%s/ntpd/keyword-gen ${SRC} > ${TGT}" % bldnode, source="ntp_parser.tab.h", - target="ntp_keyword.h" + target="ntp_keyword.h", ) # Make sure ntp_keyword.h is created last. @@ -47,20 +48,20 @@ def build(ctx): "ntp_control.c", "ntp_filegen.c", "ntp_leapsec.c", - "ntp_monitor.c", # Needed by the restrict code + "ntp_monitor.c", # Needed by the restrict code "ntp_recvbuff.c", "ntp_restrict.c", "ntp_util.c", ] if not ctx.env.DISABLE_NTS: - libntpd_source += [ - "nts.c", - "nts_server.c", - "nts_client.c", - "nts_cookie.c", - "nts_extens.c", - ] + libntpd_source += [ + "nts.c", + "nts_server.c", + "nts_client.c", + "nts_cookie.c", + "nts_extens.c", + ] ctx( features="c", @@ -77,12 +78,10 @@ def build(ctx): # use="libntpd_obj bison_obj", ) - use_refclock = "" # XXX: there must be a better way to do this + use_refclock = "" # XXX: there must be a better way to do this if ctx.env.REFCLOCK_ENABLE: - refclock_source = ["ntp_refclock.c", - "refclock_conf.c" - ] + refclock_source = ["ntp_refclock.c", "refclock_conf.c"] ctx( target="refclock", @@ -117,19 +116,22 @@ def build(ctx): "ntp_timer.c", "ntp_dns.c", "ntpd.c", - ctx.bldnode.parent.find_node("host/ntpd/ntp_parser.tab.c") + ctx.bldnode.parent.find_node("host/ntpd/ntp_parser.tab.c"), ] ctx( features="c rtems_trace cprogram", includes=[ - ctx.bldnode.parent.abspath(), "../include", - "%s/host/ntpd/" % ctx.bldnode.parent.abspath(), "." ], - install_path='${SBINDIR}', + ctx.bldnode.parent.abspath(), + "../include", + "%s/host/ntpd/" % ctx.bldnode.parent.abspath(), + ".", + ], + install_path="${SBINDIR}", source=ntpd_source, target="ntpd", use="libntpd_obj ntp M parse RT CAP SECCOMP PTHREAD NTPD " - "CRYPTO SSL DNS_SD %s SOCKET NSL SCF" % use_refclock, + "CRYPTO SSL DNS_SD %s SOCKET NSL SCF" % use_refclock, ) ctx.manpage(8, "ntpd-man.adoc") diff --git a/ntpfrob/wscript b/ntpfrob/wscript index b2e0f30e3..944e79436 100644 --- a/ntpfrob/wscript +++ b/ntpfrob/wscript @@ -1,11 +1,18 @@ def build(ctx): - frob_sources = ['main.c', 'bumpclock.c', 'dump.c', 'jitter.c', - 'precision.c', 'pps-api.c', 'tickadj.c'] + frob_sources = [ + "main.c", + "bumpclock.c", + "dump.c", + "jitter.c", + "precision.c", + "pps-api.c", + "tickadj.c", + ] ctx( features="c cprogram", includes=[ctx.bldnode.parent.abspath(), "../include"], - install_path='${BINDIR}', + install_path="${BINDIR}", source=frob_sources, target="ntpfrob", use="M RT", diff --git a/ntptime/wscript b/ntptime/wscript index 875c595b9..d0349d6fd 100644 --- a/ntptime/wscript +++ b/ntptime/wscript @@ -6,9 +6,10 @@ def build(ctx): includes=[ctx.bldnode.parent.abspath(), "../include"], source=["ntptime.c"], use="ntp M RT", - install_path='${BINDIR}', + install_path="${BINDIR}", ) ctx.manpage(8, "ntptime-man.adoc") + # end diff --git a/pylib/version.txt.in b/pylib/version.txt.in new file mode 100644 index 000000000..89ec9b671 --- /dev/null +++ b/pylib/version.txt.in @@ -0,0 +1 @@ +ntpsec-@NTPSEC_VERSION_EXTENDED@ diff --git a/pylib/wscript b/pylib/wscript index c09cd0dc5..f1c838ea9 100644 --- a/pylib/wscript +++ b/pylib/wscript @@ -2,45 +2,60 @@ from waflib.Logs import pprint def options(opt): - opt.load('python') + opt.load("python") def configure(conf): - conf.load('python') + if conf.env["ntpc"] == "none": + return + conf.load("python") + if not conf.env.ENABLE_CROSS: conf.check_python_version((2, 6, 0)) - conf.check_python_headers(features='pyext') # Extension-only, no embedded + conf.check_python_headers(features="pyext") # Extension-only try: - conf.check_python_module('curses') - conf.env['PYTHON_CURSES'] = True + conf.check_python_module("curses") + conf.env["PYTHON_CURSES"] = True except conf.errors.ConfigurationError: - pprint("YELLOW", "WARNING: ntpmon will not be built/installed since " - "python curses module was not found") + 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 + 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") + 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 + conf.check_python_module("gps", condition="ver >= num(3, 18)") + conf.env["PYTHON_GPS"] = True except conf.errors.ConfigurationError: - pprint("YELLOW", "WARNING: ntploggps will not be built/installed since " - "python gps module >= 3.18 was not found") + pprint( + "YELLOW", + "WARNING: ntploggps will not be built/installed" + " since python gps module >= 3.18 was not found", + ) def build(ctx): - srcnode = ctx.srcnode.make_node('pylib') - bldnode = ctx.bldnode.make_node('pylib') - target1 = bldnode.make_node('control.py') - target2 = bldnode.make_node('magic.py') + ctx(features="subst", source=["version.txt.in"], target=['version.txt']) + if ctx.env["ntpc"] == "none": + return + srcnode = ctx.srcnode.make_node("pylib") + bldnode = ctx.bldnode.make_node("pylib") + target1 = bldnode.make_node("control.py") + target2 = bldnode.make_node("magic.py") sources = [] - if ctx.env['ntpc'] == 'ext': - sources = srcnode.ant_glob("*.py", excl='ntpc.py') - elif ctx.env['ntpc'] == 'ffi': - sources = srcnode.ant_glob('*.py') + if ctx.env["ntpc"] == "ext": + sources = srcnode.ant_glob("*.py", excl="ntpc.py") + elif ctx.env["ntpc"] == "ffi": + sources = srcnode.ant_glob("*.py") builds = [x.get_bld() for x in sources] # The rm's here were added to fix a reported (but underdocumented) problem @@ -52,13 +67,13 @@ def build(ctx): # including during 'install'. They are now disabled but retained as a # comment. - ## Remove generated files to ensure they are properly updated - #ctx.exec_command("rm -f %s" % target1.abspath()) - #ctx.exec_command("rm -f %s" % target2.abspath()) + # # Remove generated files to ensure they are properly updated + # ctx.exec_command("rm -f %s" % target1.abspath()) + # ctx.exec_command("rm -f %s" % target2.abspath()) - if ctx.env['ntpc'] is None: + if ctx.env["ntpc"] is None: return - + # Make sure Python sees .py as well as .pyc/.pyo ctx( features="subst", @@ -67,17 +82,17 @@ def build(ctx): ) ctx( - before=['pyc', 'pyo'], + before=["pyc", "pyo"], cwd=srcnode, - rule='${PYTHON} ${SRC} >${TGT}', + rule="${PYTHON} ${SRC} >${TGT}", source=["../wafhelpers/pythonize-header", "../include/ntp_control.h"], target=target1, ) ctx( - before=['pyc', 'pyo'], + before=["pyc", "pyo"], cwd=srcnode, - rule='${PYTHON} ${SRC} >${TGT}', + rule="${PYTHON} ${SRC} >${TGT}", source=["../wafhelpers/pythonize-header", "../include/ntp.h"], target=target2, ) @@ -86,17 +101,13 @@ def build(ctx): ctx.add_group() ctx( - features='py', - source=builds+[target1, target2], + features="py", + source=builds + [target1, target2], install_from=bldnode, - install_path='${PYTHONARCHDIR}/ntp' + install_path="${PYTHONARCHDIR}/ntp", ) # pep241 lay an egg - egg = ['ntp-%s.egg-info' % ctx.env.NTPSEC_VERSION] - ctx( - features="subst", - source=['ntp-in.egg-info'], - target=egg - ) + egg = ["ntp-%s.egg-info" % ctx.env.NTPSEC_VERSION] + ctx(features="subst", source=["ntp-in.egg-info"], target=egg) ctx.install_files(ctx.env.PYTHONARCHDIR, egg) diff --git a/tests/wscript b/tests/wscript index 685038a7a..c3f57823c 100644 --- a/tests/wscript +++ b/tests/wscript @@ -3,11 +3,6 @@ from waflib import Utils # pylint: disable=import-error def build(ctx): - testsrc = ctx.srcnode.make_node('tests') - pylib = ctx.srcnode.make_node('pylib') - testpylib = testsrc.make_node('pylib') - testpysrc = testpylib.ant_glob('*.py') - # Unity source unity_source = [ "unity/unity.c", @@ -17,12 +12,7 @@ def build(ctx): unity_config = ["UNITY_INCLUDE_DOUBLE", "UNITY_SUPPORT_64"] - ctx( - defines=unity_config, - features="c", - target="unity", - source=unity_source - ) + ctx(defines=unity_config, features="c", target="unity", source=unity_source) # Test main. common_source = [ @@ -52,7 +42,7 @@ def build(ctx): "libntp/strtolfp.c", "libntp/timespecops.c", "libntp/vi64ops.c", - "libntp/ymd2yd.c" + "libntp/ymd2yd.c", ] + common_source ctx.ntp_test( @@ -95,31 +85,43 @@ def build(ctx): ] + common_source if not ctx.env.DISABLE_NTS: - ntpd_source += [ - "ntpd/nts.c", - "ntpd/nts_client.c", - "ntpd/nts_server.c", - "ntpd/nts_cookie.c", - "ntpd/nts_extens.c", - ] + ntpd_source += [ + "ntpd/nts.c", + "ntpd/nts_client.c", + "ntpd/nts_server.c", + "ntpd/nts_cookie.c", + "ntpd/nts_extens.c", + ] ctx.ntp_test( defines=unity_config + ["TEST_NTPD=1"], features="c cprogram test", - includes=[ctx.bldnode.parent.abspath(), "../include", "unity", "../ntpd", "common", "../libaes_siv"], + includes=[ + ctx.bldnode.parent.abspath(), + "../include", + "unity", + "../ntpd", + "common", + "../libaes_siv", + ], install_path=None, source=ntpd_source, target="test_ntpd", - use="ntpd_lib libntpd_obj unity ntp aes_siv " - "M PTHREAD CRYPTO RT SOCKET NSL", + use="ntpd_lib libntpd_obj unity ntp aes_siv " "M PTHREAD CRYPTO RT SOCKET NSL", ) + if "none" == ctx.env["ntpc"]: + return + testsrc = ctx.srcnode.make_node("tests") + pylib = ctx.srcnode.make_node("pylib") + testpylib = testsrc.make_node("pylib") + testpysrc = testpylib.ant_glob("*.py") testpylib.get_bld().mkdir() pypath = pylib.get_bld() targdir = "tests/pylib" linkpath = ctx.bldnode.make_node(targdir + "/ntp").abspath() - relpath = ("../" * (targdir.count("/")+1)) + pypath.path_from(ctx.bldnode) + relpath = ("../" * (targdir.count("/") + 1)) + pypath.path_from(ctx.bldnode) if (not os.path.exists(linkpath)) or os.readlink(linkpath) != relpath: try: os.remove(linkpath) @@ -127,12 +129,14 @@ def build(ctx): pass os.symlink(relpath, linkpath) - pytests = ["pylib/test_util.py", - "pylib/test_agentx.py", - "pylib/test_agentx_packet.py", - "pylib/test_ntpc.py", - "pylib/test_packet.py", - "pylib/test_statfiles.py"] + pytests = [ + "pylib/test_util.py", + "pylib/test_agentx.py", + "pylib/test_agentx_packet.py", + "pylib/test_ntpc.py", + "pylib/test_packet.py", + "pylib/test_statfiles.py", + ] ctx( features="subst", diff --git a/wafhelpers/bin_test.py b/wafhelpers/bin_test.py index 61076eb6d..5d16931cf 100644 --- a/wafhelpers/bin_test.py +++ b/wafhelpers/bin_test.py @@ -2,7 +2,8 @@ from __future__ import print_function import os import os.path -import sys + +# import sys import waflib.Context import waflib.Logs import waflib.Utils @@ -13,7 +14,7 @@ cmd_map = { ("main/ntpclients/ntpleapfetch", "--version"): "ntpleapfetch %s\n", ("main/ntpd/ntpd", "--version"): "ntpd %s\n", ("main/ntpfrob/ntpfrob", "-V"): "ntpfrob %s\n", - ("main/ntptime/ntptime", "-V"): "ntptime %s\n" + ("main/ntptime/ntptime", "-V"): "ntptime %s\n", } cmd_map_python = { ("main/ntpclients/ntpdig", "--version"): "ntpdig %s\n", @@ -22,7 +23,7 @@ cmd_map_python = { ("main/ntpclients/ntpsnmpd", "--version"): "ntpsnmpd %s\n", ("main/ntpclients/ntpsweep", "--version"): "ntpsweep %s\n", ("main/ntpclients/ntptrace", "--version"): "ntptrace %s\n", - ("main/ntpclients/ntpwait", "--version"): "ntpwait %s\n" + ("main/ntpclients/ntpwait", "--version"): "ntpwait %s\n", } # Need argparse cmd_map_python_argparse = { @@ -57,15 +58,19 @@ def run(cmd, expected, python=None): addLog("YELLOW", prefix + " SKIPPING (does not exist)") return False + envy = {} if python: cmd = python + list(cmd) - p = Popen(cmd, env={'PYTHONPATH': '%s/main/tests/pylib' % - waflib.Context.out_dir}, - universal_newlines=True, - stdin=waflib.Utils.subprocess.PIPE, - stdout=waflib.Utils.subprocess.PIPE, - stderr=waflib.Utils.subprocess.PIPE, - cwd=waflib.Context.out_dir) + envy = {"PYTHONPATH": waflib.Context.out_dir + "/main/tests/pylib"} + p = Popen( + cmd, + env=envy, + universal_newlines=True, + stdin=waflib.Utils.subprocess.PIPE, + stdout=waflib.Utils.subprocess.PIPE, + stderr=waflib.Utils.subprocess.PIPE, + cwd=waflib.Context.out_dir, + ) stdout, stderr = p.communicate() @@ -73,44 +78,33 @@ def run(cmd, expected, python=None): addLog("GREEN", prefix + " OK") return True addLog("RED", prefix + " FAILED") - addLog("PINK", "Expected: " + expected) + addLog("PINK", "Expected: '%s'" % expected) if stdout: - addLog("PINK", "Got (stdout): " + stdout) + addLog("PINK", "Got (stdout): '%s'" % stdout) if stderr: - addLog("PINK", "Got (stderr): " + stderr) + addLog("PINK", "Got (stderr): '%s'" % stderr) return False def cmd_bin_test(ctx): """Run a suite of binary tests.""" fails = 0 - - cmd = ctx.env['PYTHON'] + ['-c', - 'from __future__ import print_function;' - 'import ntp.util;' - 'print(ntp.util.stdversion())'] - p = waflib.Utils.subprocess.Popen(cmd, env={'PYTHONPATH': '%s/main/tests/pylib' % - waflib.Context.out_dir}, - universal_newlines=True, - stdin=waflib.Utils.subprocess.PIPE, - stdout=waflib.Utils.subprocess.PIPE, - stderr=waflib.Utils.subprocess.PIPE, cwd=waflib.Context.out_dir) - version = p.communicate()[0].rstrip() - - if ctx.env['PYTHON_ARGPARSE']: - cmd_map_python.update(cmd_map_python_argparse) - - if ctx.env['PYTHON_CURSES']: - cmd_map_python.update(cmd_map_python_curses) + with open(waflib.Context.out_dir + "/main/pylib/version.txt") as fp: + version = fp.read().strip(' \n') + + if not os.path.isdir(waflib.Context.out_dir + "/main/tests/pylib"): + if ctx.env["PYTHON_ARGPARSE"]: + cmd_map_python.update(cmd_map_python_argparse) + if ctx.env["PYTHON_CURSES"]: + cmd_map_python.update(cmd_map_python_curses) + for cmd in sorted(cmd_map_python): + if not run(cmd, cmd_map_python[cmd] % version, ctx.env["PYTHON"]): + fails += 1 for cmd in sorted(cmd_map): if not run(cmd, cmd_map[cmd] % version): fails += 1 - for cmd in sorted(cmd_map_python): - if not run(cmd, cmd_map_python[cmd] % version, ctx.env['PYTHON']): - fails += 1 - if 1 == fails: bin_test_summary(ctx) ctx.fatal("1 binary test failed!") diff --git a/wscript b/wscript index d8a20b82e..a81244c95 100644 --- a/wscript +++ b/wscript @@ -1,18 +1,24 @@ from __future__ import print_function -from datetime import datetime +# from datetime import datetime import itertools import os import shlex import sys -import time + +# import time from waflib import Build from waflib import Context from waflib import Scripting from waflib import Utils -from waflib.Build import (BuildContext, CleanContext, InstallContext, - StepContext, ListContext) +from waflib.Build import ( + BuildContext, + CleanContext, + InstallContext, + StepContext, + ListContext, +) from waflib.Context import BOTH from waflib.Errors import WafError from waflib.Logs import pprint @@ -28,19 +34,17 @@ from wafhelpers.test import test_write_log, test_print_log pprint.__doc__ = None -APPNAME = 'ntpsec' +APPNAME = "ntpsec" out = "build" -config = { - "out": out, - "OPT_STORE": {} -} +config = {"out": out, "OPT_STORE": {}} def help(ctx): "Be helpful, give a usage" - print(''' + print( + """ Usage: waf build Build the project check Run tests @@ -50,36 +54,47 @@ Usage: waf loccount Show SLOC count of the source tree uninstall Uninstall the project -''') +""" + ) def options(ctx): options_cmd(ctx, config) - ctx.load('asciidoc', tooldir='wafhelpers/') + ctx.load("asciidoc", tooldir="wafhelpers/") ctx.recurse("pylib") def configure(ctx): - ctx.load('asciidoc', tooldir='wafhelpers/') + ctx.load("asciidoc", tooldir="wafhelpers/") class oc(Build.BuildContext): - cmd = 'oc' + cmd = "oc" def exec_command(self, cmd, **kw): - kw['output'] = BOTH + kw["output"] = BOTH try: err, out = self.cmd_and_log(cmd, **kw) except WafError as e: - self.logger.debug('WafError') + self.logger.debug("WafError") return e.returncode - if (len(out) and any(word in out for word - in ['err', 'err:', 'error', 'error:', - 'ignored', 'illegal', 'unknown', - 'unrecognized', 'warning'])): - self.logger.debug('noooo %r' % out) + if len(out) and any( + word in out + for word in [ + "err", + "err:", + "error", + "error:", + "ignored", + "illegal", + "unknown", + "unrecognized", + "warning", + ] + ): + self.logger.debug("noooo %r" % out) return 1 if err: - self.logger.debug('noooo %r' % err) + self.logger.debug("noooo %r" % err) return 1 return 0 @@ -93,10 +108,10 @@ def configure(ctx): srcnode = ctx.srcnode.abspath() bldnode = ctx.bldnode.abspath() - ctx.run_build_cls = 'check' - ctx.load('waf', tooldir='wafhelpers/') - ctx.load('waf_unit_test') - ctx.load('gnu_dirs') + ctx.run_build_cls = "check" + ctx.load("waf", tooldir="wafhelpers/") + ctx.load("waf_unit_test") + ctx.load("gnu_dirs") with open("VERSION", "r") as f: ntpsec_release = f.read().split(" ")[0].strip() @@ -120,41 +135,53 @@ def configure(ctx): opt = flag.replace("--", "").upper() opt_map[opt] = ctx.env.OPT_STORE[flag] - ctx.env['ntpc'] = ctx.options.enable_pylib - ctx.env['ntpcver'] = '1.1.0' + ctx.env["ntpc"] = ctx.options.enable_pylib + ctx.env["ntpcver"] = "1.1.0" msg("--- Configuring host ---") - ctx.setenv('host', ctx.env.derive()) + ctx.setenv("host", ctx.env.derive()) - ctx.load('compiler_c') - ctx.start_msg('Checking compiler version') + ctx.load("compiler_c") + ctx.start_msg("Checking compiler version") ctx.end_msg("%s" % ".".join(ctx.env.CC_VERSION)) # Some distros do not have /sbin in the PATH for non-root users. We honor # the real PATH first, but append the sbin directories. ctx.find_program( - "ldconfig", var="BIN_LDCONFIG", mandatory=False, - path_list=(os.environ.get('PATH','').split(os.pathsep) + - ["/sbin", "/usr/sbin", "/usr/local/sbin"])) + "ldconfig", + var="BIN_LDCONFIG", + mandatory=False, + path_list=( + os.environ.get("PATH", "").split(os.pathsep) + + ["/sbin", "/usr/sbin", "/usr/local/sbin"] + ), + ) # Ensure m4 is present, or bison will fail with SIGPIPE - ctx.find_program('m4') - ctx.load('bison') + ctx.find_program("m4") + ctx.load("bison") for opt in opt_map: ctx.env[opt] = opt_map[opt] if ctx.options.enable_rtems_trace: - ctx.find_program("rtems-tld", var="BIN_RTEMS_TLD", - path_list=[ctx.options.rtems_trace_path, - '${BINDIR}']) + ctx.find_program( + "rtems-tld", + var="BIN_RTEMS_TLD", + path_list=[ctx.options.rtems_trace_path, "${BINDIR}"], + ) ctx.env.RTEMS_TEST_ENABLE = True ctx.env.RTEMS_TEST_FLAGS = [ - "-C", "%s/devel/trace/ntpsec-trace.ini" % srcnode, - "-W", "%s/ntpsec-wrapper" % bldnode, - "-P", "%s/devel/trace/" % srcnode, - "-f", "-I%s" % bldnode, - "-f", "-I%s/include/" % srcnode, + "-C", + "%s/devel/trace/ntpsec-trace.ini" % srcnode, + "-W", + "%s/ntpsec-wrapper" % bldnode, + "-P", + "%s/devel/trace/" % srcnode, + "-f", + "-I%s" % bldnode, + "-f", + "-I%s/include/" % srcnode, ] # Not needed to build. Used by utility scripts. @@ -162,9 +189,12 @@ def configure(ctx): ctx.find_program("sh", var="BIN_SH", mandatory=False) ctx.check_cfg( - package='systemd', variables=['systemdsystemunitdir'], - uselib_store='SYSTEMD', mandatory=False, - msg="Checking for systemd") + package="systemd", + variables=["systemdsystemunitdir"], + uselib_store="SYSTEMD", + mandatory=False, + msg="Checking for systemd", + ) if ctx.env.SYSTEMD_systemdsystemunitdir: ctx.start_msg("systemd unit directory:") ctx.end_msg(ctx.env.SYSTEMD_systemdsystemunitdir) @@ -175,7 +205,7 @@ def configure(ctx): build_desc = ctx.options.build_desc.strip() if build_desc: - build_desc = ' ' + build_desc + build_desc = " " + build_desc if ctx.env.BIN_GIT: # 'tag', '7', and 'deadbeef' are fill ins for # a previous tag (always dropped), commits since that tag, @@ -189,19 +219,19 @@ def configure(ctx): # 3-4 gets the first token dropped and the rest added # I have never seen 5+ tokens, we should be safe cmd = ctx.env.BIN_GIT + shlex.split("describe --tags --dirty --always") - git_short_hash = ctx.cmd_and_log(cmd).strip().split('-') + git_short_hash = ctx.cmd_and_log(cmd).strip().split("-") clip = 1 if len(git_short_hash) > 2 else 0 - git_short_hash = '-'.join(git_short_hash[clip:]) + git_short_hash = "-".join(git_short_hash[clip:]) ctx.env.NTPSEC_VERSION = "%s+" % ntpsec_release - ctx.env.NTPSEC_VERSION_EXTENDED = ("%s+%s%s" % - (ntpsec_release, - git_short_hash, - build_desc)) + ctx.env.NTPSEC_VERSION_EXTENDED = "%s+%s%s" % ( + ntpsec_release, + git_short_hash, + build_desc, + ) else: ctx.env.NTPSEC_VERSION = "%s" % ntpsec_release - ctx.env.NTPSEC_VERSION_EXTENDED = ("%s%s" % (ntpsec_release, - build_desc)) + ctx.env.NTPSEC_VERSION_EXTENDED = "%s%s" % (ntpsec_release, build_desc) ctx.define("NTPSEC_VERSION", ctx.env.NTPSEC_VERSION) ctx.define("NTPSEC_VERSION_EXTENDED", ctx.env.NTPSEC_VERSION_EXTENDED) @@ -239,7 +269,7 @@ def configure(ctx): ctx.env.ENABLE_CROSS = True ctx.start_msg("Using Cross compiler CC:") -# ctx.get_cc_version(ctx.env.CC, gcc=True) + # ctx.get_cc_version(ctx.env.CC, gcc=True) ctx.end_msg(ctx.options.cross_compiler) ctx.env.CC = shlex.split(ctx.options.cross_compiler) @@ -257,6 +287,7 @@ def configure(ctx): if ctx.options.list: from wafhelpers.refclock import refclock_map + print("ID Description") print("~~ ~~~~~~~~~~~") for id in refclock_map: @@ -270,39 +301,38 @@ def configure(ctx): ctx.define("WORDS_BIGENDIAN", 1) if ctx.options.enable_leap_testing: - ctx.define("ENABLE_LEAP_TESTING", 1, - comment="Enable leap seconds on other than 1st of month.") + ctx.define( + "ENABLE_LEAP_TESTING", + 1, + comment="Enable leap seconds on other than 1st of month.", + ) # check for some libs first. some options, like stack protector, # may depend on some libs, like -lssp ctx.check_cc(lib="m", comment="Math library") ctx.check_cc(lib="rt", mandatory=False, comment="realtime library") ctx.check_cc(lib="pthread", mandatory=False, comment="threads library") - ctx.check_cc(lib="execinfo", mandatory=False, - comment="BSD backtrace library") - ret = ctx.check_cc(lib="bsd", mandatory=False, - comment="BSD compatibility library") + ctx.check_cc(lib="execinfo", mandatory=False, comment="BSD backtrace library") + ret = ctx.check_cc(lib="bsd", mandatory=False, comment="BSD compatibility library") if ret: ctx.env.LDFLAGS += ["-lbsd"] # -lssp and -lssp_nonshared may be needed by older gcc to # support "-fstack-protector-all" - ret = ctx.check_cc(lib="ssp", mandatory=False, - comment="libssp") + ret = ctx.check_cc(lib="ssp", mandatory=False, comment="libssp") if ret: ctx.env.LDFLAGS += ["-lssp"] - ret = ctx.check_cc(lib="ssp_nonshared", mandatory=False, - comment="libssp_nonshared") + ret = ctx.check_cc(lib="ssp_nonshared", mandatory=False, comment="libssp_nonshared") if ret: ctx.env.LDFLAGS += ["-lssp_nonshared"] cc_test_flags = [ - ('f_stack_protector_all', '-fstack-protector-all'), - ('PIC', '-fPIC'), - ('PIE', '-pie -fPIE'), + ("f_stack_protector_all", "-fstack-protector-all"), + ("PIC", "-fPIC"), + ("PIE", "-pie -fPIE"), # this quiets most of macOS warnings on -fpie - ('unused', '-Qunused-arguments'), + ("unused", "-Qunused-arguments"), # This is a useless warning on any architecture with a barrel # shifter, which includes Intel and ARM and basically # everything nowadays. Even so, we'd enable it out of @@ -310,29 +340,29 @@ def configure(ctx): # useful for forcing structure alignment in order to suppress # it locally don't seem to be working quite right. # ('w_cast_align', "-Wcast-align"), - ('w_cast_qual', "-Wcast-qual"), - ('w_disabled_optimization', "-Wdisabled-optimization"), - ('w_float_equal', "-Wfloat-equal"), - ('w_format', '-Wformat'), - ('w_format_security', '-Wformat-security'), + ("w_cast_qual", "-Wcast-qual"), + ("w_disabled_optimization", "-Wdisabled-optimization"), + ("w_float_equal", "-Wfloat-equal"), + ("w_format", "-Wformat"), + ("w_format_security", "-Wformat-security"), # fails on OpenBSD 6 - ('w_format_signedness', '-Wformat-signedness'), - ('w_implicit_function_declaration', "-Wimplicit-function-declaration"), - ('w_init_self', '-Winit-self'), - ('w_invalid_pch', '-Winvalid-pch'), - ('w_missing_declarations', '-Wmissing-declarations'), - ('w_multichar', '-Wmultichar'), - ('w_packed', '-Wpacked'), - ('w_pointer_arith', '-Wpointer-arith'), - ('w_shadow', '-Wshadow'), + ("w_format_signedness", "-Wformat-signedness"), + ("w_implicit_function_declaration", "-Wimplicit-function-declaration"), + ("w_init_self", "-Winit-self"), + ("w_invalid_pch", "-Winvalid-pch"), + ("w_missing_declarations", "-Wmissing-declarations"), + ("w_multichar", "-Wmultichar"), + ("w_packed", "-Wpacked"), + ("w_pointer_arith", "-Wpointer-arith"), + ("w_shadow", "-Wshadow"), # fails on clang - ('w_suggest_attribute_noreturn', "-Wsuggest-attribute=noreturn"), - ('w_write_strings', '-Wwrite-strings'), - ] + ("w_suggest_attribute_noreturn", "-Wsuggest-attribute=noreturn"), + ("w_write_strings", "-Wwrite-strings"), + ] # Check which linker flags are supported ld_hardening_flags = [ - ("z_now", "-Wl,-z,now"), # no deferred symbol resolution + ("z_now", "-Wl,-z,now"), # no deferred symbol resolution ] # we prepend our options to CFLAGS, this allows user provided @@ -343,11 +373,11 @@ def configure(ctx): else: # not gdb debugging cc_test_flags += [ - ('LTO', '-flto'), # link time optimization - ] + ("LTO", "-flto"), # link time optimization + ] ld_hardening_flags += [ - ('stripall', "-Wl,--strip-all"), # Strip binaries - ] + ("stripall", "-Wl,--strip-all"), # Strip binaries + ] if ctx.options.enable_debug: ctx.define("DEBUG", 1, comment="Enable debug mode") @@ -361,15 +391,15 @@ def configure(ctx): # "-Wcast-align", # fails on RasPi, needs fixing. # "-Wbad-function-cast", # ntpd casts long<->double a lot # "-Wformat-nonliteral", # complains about a used feature - "-Winline", # some OS have inline issues. + "-Winline", # some OS have inline issues. # "-Wmissing-format-attribute", # false positives # "-Wnested-externs", # incompatible w/ Unity... # "-Wpadded", # duck... over 3k warnings # "-Wredundant-decls", # incompatible w/ Unity - "-Wswitch-default", # warns on Bison bug + "-Wswitch-default", # warns on Bison bug ] + ctx.env.CFLAGS cc_test_flags += [ - ('w_implicit_fallthru', "-Wimplicit-fallthrough=3"), + ("w_implicit_fallthru", "-Wimplicit-fallthrough=3"), # Fails on Solaris, OpenBSD 6, and RasPi # Complains about a Bison bug # Cannot be suppressed @@ -378,7 +408,7 @@ def configure(ctx): # ('w_suggest_attribute_const', "-Wsuggest-attribute=const"), # fails on clang, lot's of false positives and Unity complaints # ('w_suggest_attribute_pure', "-Wsuggest-attribute=pure"), - ] + ] ctx.env.CFLAGS = [ # -O1 will turn on -D_FORTIFY_SOURCE=2 for us @@ -389,28 +419,30 @@ def configure(ctx): "-Wstrict-prototypes", "-Wundef", "-Wunused", - ] + ctx.env.CFLAGS + ] + ctx.env.CFLAGS # gotta be tricky to test for -Wsuggest-attribute=const - FRAGMENT = ''' + FRAGMENT = """ int tmp; int main(int argc, char **argv) { (void)argc; (void)argv; tmp = argc; return argc; } -''' +""" # check if C compiler supports some flags old_run_build_cls = ctx.run_build_cls - ctx.run_build_cls = 'oc' + ctx.run_build_cls = "oc" for (name, ccflag) in cc_test_flags: - ctx.check(cflags=ccflag, - define_name='HAS_' + name, - fragment=FRAGMENT, - mandatory=False, - msg='Checking if C compiler supports ' + ccflag, - run_build_cls='oc') + ctx.check( + cflags=ccflag, + define_name="HAS_" + name, + fragment=FRAGMENT, + mandatory=False, + msg="Checking if C compiler supports " + ccflag, + run_build_cls="oc", + ) ctx.run_build_cls = old_run_build_cls @@ -420,14 +452,14 @@ int main(int argc, char **argv) { if ctx.env.HAS_PIE: ctx.env.LINKFLAGS_NTPD += [ "-pie", - ] + ] ctx.env.CFLAGS_bin = ["-fPIE", "-pie"] + ctx.env.CFLAGS ld_hardening_flags += [ - ('relro', "-Wl,-z,relro"), # hardening, marks some read only, - ] + ("relro", "-Wl,-z,relro"), # hardening, marks some read only, + ] if ctx.env.HAS_unused: - ctx.env.CFLAGS = ['-Qunused-arguments'] + ctx.env.CFLAGS + ctx.env.CFLAGS = ["-Qunused-arguments"] + ctx.env.CFLAGS # XXX: -flto currently breaks link of ntpd if ctx.env.HAS_LTO and False: @@ -435,61 +467,63 @@ int main(int argc, char **argv) { # debug warnings that are not available with all compilers if ctx.env.HAS_w_implicit_fallthru: - ctx.env.CFLAGS = ['-Wimplicit-fallthrough=3'] + ctx.env.CFLAGS + ctx.env.CFLAGS = ["-Wimplicit-fallthrough=3"] + ctx.env.CFLAGS if ctx.env.HAS_w_suggest_attribute_const: - ctx.env.CFLAGS = ['-Wsuggest-attribute=const'] + ctx.env.CFLAGS + ctx.env.CFLAGS = ["-Wsuggest-attribute=const"] + ctx.env.CFLAGS if ctx.env.HAS_w_suggest_attribute_noreturn: - ctx.env.CFLAGS = ['-Wsuggest-attribute=noreturn'] + ctx.env.CFLAGS + ctx.env.CFLAGS = ["-Wsuggest-attribute=noreturn"] + ctx.env.CFLAGS if ctx.env.HAS_w_suggest_attribute_pure: - ctx.env.CFLAGS = ['-Wsuggest-attribute=pure'] + ctx.env.CFLAGS + ctx.env.CFLAGS = ["-Wsuggest-attribute=pure"] + ctx.env.CFLAGS if ctx.env.HAS_w_format_security: - ctx.env.CFLAGS = ['-Wformat-security'] + ctx.env.CFLAGS + ctx.env.CFLAGS = ["-Wformat-security"] + ctx.env.CFLAGS if ctx.env.HAS_w_format_signedness: - ctx.env.CFLAGS = ['-Wformat-signedness'] + ctx.env.CFLAGS + ctx.env.CFLAGS = ["-Wformat-signedness"] + ctx.env.CFLAGS # should be before other -Wformat-* in CFLAGS if ctx.env.HAS_w_format: - ctx.env.CFLAGS = ['-Wformat'] + ctx.env.CFLAGS + ctx.env.CFLAGS = ["-Wformat"] + ctx.env.CFLAGS if ctx.env.HAS_w_float_equal: - ctx.env.CFLAGS = ['-Wfloat-equal'] + ctx.env.CFLAGS + ctx.env.CFLAGS = ["-Wfloat-equal"] + ctx.env.CFLAGS if ctx.env.HAS_w_init_self: - ctx.env.CFLAGS = ['-Winit-self'] + ctx.env.CFLAGS + ctx.env.CFLAGS = ["-Winit-self"] + ctx.env.CFLAGS if ctx.env.HAS_w_write_strings: - ctx.env.CFLAGS = ['-Wwrite-strings'] + ctx.env.CFLAGS + ctx.env.CFLAGS = ["-Wwrite-strings"] + ctx.env.CFLAGS if ctx.env.HAS_w_pointer_arith: - ctx.env.CFLAGS = ['-Wpointer-arith'] + ctx.env.CFLAGS + ctx.env.CFLAGS = ["-Wpointer-arith"] + ctx.env.CFLAGS if ctx.env.HAS_w_invalid_pch: - ctx.env.CFLAGS = ['-Winvalid-pch'] + ctx.env.CFLAGS + ctx.env.CFLAGS = ["-Winvalid-pch"] + ctx.env.CFLAGS if ctx.env.HAS_w_implicit_function_declaration: - ctx.env.CFLAGS = ['-Wimplicit-function-declaration'] + ctx.env.CFLAGS + ctx.env.CFLAGS = ["-Wimplicit-function-declaration"] + ctx.env.CFLAGS if ctx.env.HAS_w_disabled_optimization: - ctx.env.CFLAGS = ['-Wdisabled-optimization'] + ctx.env.CFLAGS + ctx.env.CFLAGS = ["-Wdisabled-optimization"] + ctx.env.CFLAGS # if ctx.env.HAS_w_cast_align: # ctx.env.CFLAGS = ['-Wcast-align'] + ctx.env.CFLAGS if ctx.env.HAS_w_missing_declarations: - ctx.env.CFLAGS = ['-Wmissing-declarations'] + ctx.env.CFLAGS + ctx.env.CFLAGS = ["-Wmissing-declarations"] + ctx.env.CFLAGS if ctx.env.HAS_w_cast_qual: - ctx.env.CFLAGS = ['-Wcast-qual'] + ctx.env.CFLAGS + ctx.env.CFLAGS = ["-Wcast-qual"] + ctx.env.CFLAGS if ctx.env.HAS_w_packed: - ctx.env.CFLAGS = ['-Wpacked'] + ctx.env.CFLAGS + ctx.env.CFLAGS = ["-Wpacked"] + ctx.env.CFLAGS if ctx.env.HAS_w_shadow: - ctx.env.CFLAGS = ['-Wshadow'] + ctx.env.CFLAGS + ctx.env.CFLAGS = ["-Wshadow"] + ctx.env.CFLAGS # if ctx.env.HAS_w_sign_conversion: # ctx.env.CFLAGS = ['-Wsign-conversion'] + ctx.env.CFLAGS if ctx.env.HAS_f_stack_protector_all: - ctx.env.CFLAGS = ['-fstack-protector-all'] + ctx.env.CFLAGS + ctx.env.CFLAGS = ["-fstack-protector-all"] + ctx.env.CFLAGS # old gcc takes -z,relro, but then barfs if -fPIE available and used. # ("relro", "-Wl,-z,relro"), # marks some sections read only old_run_build_cls = ctx.run_build_cls - ctx.run_build_cls = 'oc' + ctx.run_build_cls = "oc" for (name, ldflag) in ld_hardening_flags: - ctx.check(define_name='HAS_' + name, - fragment=FRAGMENT, - ldflags=ldflag, - mandatory=False, - msg='Checking if linker supports ' + ldflag, - run_build_cls='oc') - if ctx.env['HAS_' + name]: + ctx.check( + define_name="HAS_" + name, + fragment=FRAGMENT, + ldflags=ldflag, + mandatory=False, + msg="Checking if linker supports " + ldflag, + run_build_cls="oc", + ) + if ctx.env["HAS_" + name]: ctx.env.LDFLAGS += [ldflag] ctx.run_build_cls = old_run_build_cls @@ -509,30 +543,30 @@ int main(int argc, char **argv) { # ] + ctx.env.CFLAGS ctx.env.LDFLAGS += [ "-Wl,-z,relro", # hardening, marks some section read only, - ] + ] # else: # gcc, probably # Exclude Unity's support for printing floating point numbers # since it triggers warnings # with -Wfloat-equal - ctx.env.CFLAGS = ['-DUNITY_EXCLUDE_FLOAT_PRINT'] + ctx.env.CFLAGS + ctx.env.CFLAGS = ["-DUNITY_EXCLUDE_FLOAT_PRINT"] + ctx.env.CFLAGS # XXX: hack if ctx.env.DEST_OS in ["freebsd"]: ctx.env.INCLUDES = ["/usr/local/include"] ctx.env.LIBPATH = ["/usr/local/lib"] if os.path.isdir("/usr/local/ssl/"): - # This assumes OpenSSL is the only thing that was in /usr/local/ - ctx.env.INCLUDES = ["/usr/local/ssl/include"] - ctx.env.LIBPATH = ["/usr/local/ssl/lib"] + # This assumes OpenSSL is the only thing that was in /usr/local/ + ctx.env.INCLUDES = ["/usr/local/ssl/include"] + ctx.env.LIBPATH = ["/usr/local/ssl/lib"] elif ctx.env.DEST_OS == "netbsd" and os.path.isdir("/usr/pkg/include"): ctx.env.INCLUDES = ["/usr/pkg/include"] ctx.env.LIBPATH = ["/usr/pkg/lib"] ctx.env.LDFLAGS += ["-rpath=/usr/pkg/lib"] if os.path.isdir("/usr/local/ssl/"): - # This assumes OpenSSL is the only thing that was in /usr/pkg/ - ctx.env.INCLUDES = ["/usr/local/ssl/include"] - ctx.env.LIBPATH = ["/usr/local/ssl/lib"] + # This assumes OpenSSL is the only thing that was in /usr/pkg/ + ctx.env.INCLUDES = ["/usr/local/ssl/include"] + ctx.env.LIBPATH = ["/usr/local/ssl/lib"] elif ctx.env.DEST_OS == "linux" and os.path.isdir("/usr/local/ssl/"): # This supports building OpenSSL from source # That allows using OpenSSL 1.1.1 on older CentOS @@ -540,9 +574,9 @@ int main(int argc, char **argv) { # see HOWTO-OpenSSL ctx.env.INCLUDES = ["/usr/local/ssl/include"] if os.path.isdir("/usr/local/ssl/lib64/"): - ctx.env.LIBPATH = ["/usr/local/ssl/lib64"] + ctx.env.LIBPATH = ["/usr/local/ssl/lib64"] else: - ctx.env.LIBPATH = ["/usr/local/ssl/lib"] + ctx.env.LIBPATH = ["/usr/local/ssl/lib"] elif ctx.env.DEST_OS == "darwin": # macports location if os.path.isdir("/opt/local/include"): @@ -550,8 +584,7 @@ int main(int argc, char **argv) { if os.path.isdir("/opt/local/lib"): ctx.env.LIBPATH = ["/opt/local/lib"] # OS X needs this for IPv6 - ctx.define("__APPLE_USE_RFC_3542", 1, - comment="Needed for IPv6 support") + ctx.define("__APPLE_USE_RFC_3542", 1, comment="Needed for IPv6 support") elif ctx.env.DEST_OS == "sunos": # Declare compatibility with the POSIX.1-2001 standard, and any # headers/interfaces not in conflict with that standard @@ -559,16 +592,16 @@ int main(int argc, char **argv) { ctx.define("__EXTENSIONS__", "1", quote=False) # Borrowed from waf-1.9, when type_name and field_name were valid keywords - SNIP_TYPE = ''' + SNIP_TYPE = """ int main(int argc, char **argv) { (void)argc; (void)argv; if ((%(type_name)s *) 0) return 0; if (sizeof (%(type_name)s)) return 0; return 1; } - ''' + """ - SNIP_FIELD = ''' + SNIP_FIELD = """ #include int main(int argc, char **argv) { char *off; @@ -576,11 +609,10 @@ int main(int argc, char **argv) { off = (char*) &((%(type_name)s*)0)->%(field_name)s; return (size_t) off < sizeof(%(type_name)s); } - ''' + """ def to_header(header_name): - return ''.join(['#include <%s>\n' % - x for x in Utils.to_list(header_name)]) + return "".join(["#include <%s>\n" % x for x in Utils.to_list(header_name)]) structures = ( ("struct if_laddrconf", ["sys/types.h", "net/if6.h"], False), @@ -590,8 +622,8 @@ int main(int argc, char **argv) { ) for (s, h, r) in structures: ctx.check_cc( - fragment=to_header(h) + SNIP_TYPE % {'type_name': s}, - msg='Checking for type %s' % s, + fragment=to_header(h) + SNIP_TYPE % {"type_name": s}, + msg="Checking for type %s" % s, define_name=ctx.have_define(s.upper()), mandatory=r, ) @@ -605,17 +637,16 @@ int main(int argc, char **argv) { ) for (s, f, h) in structure_fields: ctx.check_cc( - fragment=(to_header(h) + SNIP_FIELD % - {'type_name': s, 'field_name': f}), - msg='Checking for field %s in %s' % (f, s), - define_name=ctx.have_define((s + '_' + f).upper()), + fragment=(to_header(h) + SNIP_FIELD % {"type_name": s, "field_name": f}), + msg="Checking for field %s in %s" % (f, s), + define_name=ctx.have_define((s + "_" + f).upper()), mandatory=False, ) # mostly used by timetoa.h and timespecops.h sizeofs = [ - ("time.h", "time_t"), - (None, "long"), + ("time.h", "time_t"), + (None, "long"), ] for header, sizeof in sorted(sizeofs, key=lambda x: x[1:]): @@ -624,38 +655,44 @@ int main(int argc, char **argv) { if not ctx.options.disable_nts: # Check via pkg-config first, then fall back to a direct search if not ctx.check_cfg( - package='libssl', uselib_store='SSL', - args=['--cflags', '--libs'], + package="libssl", + uselib_store="SSL", + args=["--cflags", "--libs"], msg="Checking for OpenSSL/libssl (via pkg-config)", - define_name='', mandatory=False, + define_name="", + mandatory=False, ): - ctx.check_cc(msg="Checking for OpenSSL's ssl library", - lib="ssl", mandatory=True) + ctx.check_cc( + msg="Checking for OpenSSL's ssl library", lib="ssl", mandatory=True + ) # Check via pkg-config first, then fall back to a direct search if not ctx.check_cfg( - package='libcrypto', uselib_store='CRYPTO', - args=['--cflags', '--libs'], + package="libcrypto", + uselib_store="CRYPTO", + args=["--cflags", "--libs"], msg="Checking for OpenSSL/libcrypto (via pkg-config)", - define_name='', mandatory=False, + define_name="", + mandatory=False, ): - ctx.check_cc(msg="Checking for OpenSSL's crypto library", - lib="crypto", mandatory=True) + ctx.check_cc( + msg="Checking for OpenSSL's crypto library", lib="crypto", mandatory=True + ) # Optional functions. Do all function checks here, otherwise # we're likely to duplicate them. optional_functions = ( - ('_Unwind_Backtrace', ["unwind.h"]), - ('adjtimex', ["sys/time.h", "sys/timex.h"]), - ('backtrace_symbols_fd', ["execinfo.h"]), - ('ntp_adjtime', ["sys/time.h", "sys/timex.h"]), # BSD - ('ntp_gettime', ["sys/time.h", "sys/timex.h"]), # BSD - ('res_init', ["netinet/in.h", "arpa/nameser.h", "resolv.h"]), - ('strlcpy', ["string.h"]), - ('strlcat', ["string.h"]), - ('timegm', ["time.h"]), + ("_Unwind_Backtrace", ["unwind.h"]), + ("adjtimex", ["sys/time.h", "sys/timex.h"]), + ("backtrace_symbols_fd", ["execinfo.h"]), + ("ntp_adjtime", ["sys/time.h", "sys/timex.h"]), # BSD + ("ntp_gettime", ["sys/time.h", "sys/timex.h"]), # BSD + ("res_init", ["netinet/in.h", "arpa/nameser.h", "resolv.h"]), + ("strlcpy", ["string.h"]), + ("strlcat", ["string.h"]), + ("timegm", ["time.h"]), # Hack. It's not a function, but this works. - ('PRIV_NTP_ADJTIME', ["sys/priv.h"]) # FreeBSD + ("PRIV_NTP_ADJTIME", ["sys/priv.h"]), # FreeBSD ) for ft in optional_functions: probe_function(ctx, function=ft[0], prerequisites=ft[1]) @@ -667,35 +704,33 @@ int main(int argc, char **argv) { # Sanity checks to give a sensible error message required_functions = ( # MacOS doesn't have timer_create ?? - ('timer_create', ["signal.h", "time.h"], "RT", False), + ("timer_create", ["signal.h", "time.h"], "RT", False), # Very old versions of OpenSSL don't have cmac.h # We could add ifdefs, but old crypto is deprecated in favor of CMAC # and so far, all the systems that we want to support are new enough. - ('CMAC_CTX_new', ["openssl/cmac.h"], "CRYPTO", True), - # Next should be above, but it needs a library - # EVP_PKEY_new_CMAC_key added in OpenSSL 1.1.1 - ('EVP_PKEY_new_CMAC_key', ["openssl/cmac.h"], "CRYPTO", False)) + ("CMAC_CTX_new", ["openssl/cmac.h"], "CRYPTO", True), + # Next should be above, but it needs a library + # EVP_PKEY_new_CMAC_key added in OpenSSL 1.1.1 + ("EVP_PKEY_new_CMAC_key", ["openssl/cmac.h"], "CRYPTO", False), + ) for ft in required_functions: - probe_function(ctx, function=ft[0], - prerequisites=ft[1], use=ft[2], - mandatory=ft[3]) + probe_function( + ctx, function=ft[0], prerequisites=ft[1], use=ft[2], mandatory=ft[3] + ) # check for BSD versions outside of libc if not ctx.get_define("HAVE_STRLCAT"): - ret = probe_function(ctx, function='strlcat', - prerequisites=['bsd/string.h']) + ret = probe_function(ctx, function="strlcat", prerequisites=["bsd/string.h"]) if ret: ctx.define("HAVE_STRLCAT", 1, comment="Using bsd/strlcat") if not ctx.get_define("HAVE_STRLCPY"): - ret = probe_function(ctx, function='strlcpy', - prerequisites=['bsd/string.h']) + ret = probe_function(ctx, function="strlcpy", prerequisites=["bsd/string.h"]) if ret: ctx.define("HAVE_STRLCPY", 1, comment="Using bsd/strlcpy") # Nobody uses the symbol, but this seems like a good sanity check. - ctx.check_cc(header_name="stdbool.h", mandatory=True, - comment="Sanity check.") + ctx.check_cc(header_name="stdbool.h", mandatory=True, comment="Sanity check.") # This is a list of every optional include header in the # codebase that is guarded by a directly corresponding HAVE_*_H symbol. @@ -711,18 +746,18 @@ int main(int argc, char **argv) { optional_headers = ( "alloca.h", ("arpa/nameser.h", ["sys/types.h"]), - "bsd/string.h", # bsd emulation + "bsd/string.h", # bsd emulation ("ifaddrs.h", ["sys/types.h"]), ("linux/if_addr.h", ["sys/socket.h"]), ("linux/rtnetlink.h", ["sys/socket.h"]), "linux/serial.h", "net/if6.h", ("net/route.h", ["sys/types.h", "sys/socket.h", "net/if.h"]), - "priv.h", # Solaris + "priv.h", # Solaris "stdatomic.h", - "sys/clockctl.h", # NetBSD + "sys/clockctl.h", # NetBSD "sys/ioctl.h", - "sys/modem.h", # Apple + "sys/modem.h", # Apple "sys/sockio.h", ("sys/sysctl.h", ["sys/types.h"]), ("timepps.h", ["inttypes.h"]), @@ -731,8 +766,9 @@ int main(int argc, char **argv) { ) for hdr in optional_headers: if isinstance(hdr, str): - if ctx.check_cc(header_name=hdr, mandatory=False, - comment="<%s> header" % hdr): + if ctx.check_cc( + header_name=hdr, mandatory=False, comment="<%s> header" % hdr + ): continue else: (hdr, prereqs) = hdr @@ -742,24 +778,25 @@ int main(int argc, char **argv) { # Sanity check... print("Compilation check failed but include exists %s" % hdr) - if ((ctx.get_define("HAVE_TIMEPPS_H") or - ctx.get_define("HAVE_SYS_TIMEPPS_H"))): + if ctx.get_define("HAVE_TIMEPPS_H") or ctx.get_define("HAVE_SYS_TIMEPPS_H"): ctx.define("HAVE_PPSAPI", 1, comment="Enable the PPS API") # Check for Solaris capabilities if ctx.get_define("HAVE_PRIV_H") and ctx.env.DEST_OS == "sunos": - ctx.define("HAVE_SOLARIS_PRIVS", 1, - comment="Enable Solaris Privileges (Solaris only)") + ctx.define( + "HAVE_SOLARIS_PRIVS", 1, comment="Enable Solaris Privileges (Solaris only)" + ) from wafhelpers.check_sockaddr import check_sockaddr + check_sockaddr(ctx) from wafhelpers.check_strerror import check_strerror + check_strerror(ctx) # Check for Solaris's service configuration facility library - ctx.check_cc(header_name="libscf.h", lib="scf", mandatory=False, - uselib_store="SCF") + ctx.check_cc(header_name="libscf.h", lib="scf", mandatory=False, uselib_store="SCF") # Some systems don't have sys/timex.h eg OS X, OpenBSD... if ctx.get_define("HAVE_SYS_TIMEX_H"): @@ -767,6 +804,7 @@ int main(int argc, char **argv) { if ctx.options.refclocks: from wafhelpers.refclock import refclock_config + refclock_config(ctx) # timegm needed by refclock_nmea, it's not in POSIX # It's in Linux, FreeBSD, and NetBSD @@ -782,41 +820,44 @@ int main(int argc, char **argv) { # ctx.define("OS_MISSES_SPECIFIC_ROUTE_UPDATES", 1) if ctx.options.enable_leap_smear: - ctx.define("ENABLE_LEAP_SMEAR", 1, - comment="Enable experimental leap smearing code") + ctx.define( + "ENABLE_LEAP_SMEAR", 1, comment="Enable experimental leap smearing code" + ) if ctx.options.enable_mssntp: - ctx.define("ENABLE_MSSNTP", 1, - comment="Enable MS-SNTP extensions " - " https://msdn.microsoft.com/en-us/library/cc212930.aspx") + ctx.define( + "ENABLE_MSSNTP", + 1, + comment="Enable MS-SNTP extensions " + " https://msdn.microsoft.com/en-us/library/cc212930.aspx", + ) if ctx.options.enable_attic: ctx.env.ENABLE_ATTIC = True if ctx.options.disable_nts: ctx.env.DISABLE_NTS = True - ctx.define("DISABLE_NTS", 1, - comment="Disable NTS") + ctx.define("DISABLE_NTS", 1, comment="Disable NTS") if not ctx.options.disable_droproot: - ctx.define("ENABLE_DROPROOT", 1, - comment="Drop root after initialising") + ctx.define("ENABLE_DROPROOT", 1, comment="Drop root after initialising") if ctx.options.enable_early_droproot: - ctx.define("ENABLE_EARLY_DROPROOT", 1, - comment="Enable early drop root") + ctx.define("ENABLE_EARLY_DROPROOT", 1, comment="Enable early drop root") if not ctx.options.disable_fuzz: - ctx.define("ENABLE_FUZZ", 1, - comment="Enable fuzzing low bits of time") + ctx.define("ENABLE_FUZZ", 1, comment="Enable fuzzing low bits of time") # SO_REUSEADDR socket option is needed to open a socket on an # interface when the port number is already in use on another # interface. Linux needs this, NetBSD does not, status on # other platforms is unknown. It is probably harmless to # have it on everywhere. - ctx.define("NEED_REUSEADDR_FOR_IFADDRBIND", 1, - comment="Whether SO_REUSEADDR is needed to open " - "same sockets on alternate interfaces, required " - "by Linux at least") + ctx.define( + "NEED_REUSEADDR_FOR_IFADDRBIND", + 1, + comment="Whether SO_REUSEADDR is needed to open " + "same sockets on alternate interfaces, required " + "by Linux at least", + ) # Check for directory separator if ctx.env.DEST_OS == "win32": @@ -824,12 +865,10 @@ int main(int argc, char **argv) { else: sep = "/" - ctx.define("DIR_SEP", "'%s'" % sep, quote=False, - comment="Directory separator used") + ctx.define("DIR_SEP", "'%s'" % sep, quote=False, comment="Directory separator used") if ctx.get_define("HAVE_SYS_SYSCTL_H"): - ctx.define("HAVE_IFLIST_SYSCTL", 1, - comment="Whether sysctl interface exists") + ctx.define("HAVE_IFLIST_SYSCTL", 1, comment="Whether sysctl interface exists") # Header/library checks @@ -838,8 +877,11 @@ int main(int argc, char **argv) { ctx.check_cc(header_name="sys/capability.h", mandatory=False) ctx.check_cc(lib="cap", comment="Capability library", mandatory=False) - if ((ctx.get_define("HAVE_SYS_CAPABILITY_H") and - ctx.get_define("HAVE_SYS_PRCTL_H") and ctx.env.LIB_CAP)): + if ( + ctx.get_define("HAVE_SYS_CAPABILITY_H") + and ctx.get_define("HAVE_SYS_PRCTL_H") + and ctx.env.LIB_CAP + ): ctx.define("HAVE_LINUX_CAPABILITY", 1) if ctx.options.enable_seccomp: @@ -848,16 +890,19 @@ int main(int argc, char **argv) { # Check via pkg-config first, then fall back to a direct search if not ctx.check_cfg( - package='libseccomp', args=['--libs', '--cflags'], - uselib_store='SECCOMP', define_name='HAVE_SECCOMP_H', - mandatory=False + package="libseccomp", + args=["--libs", "--cflags"], + uselib_store="SECCOMP", + define_name="HAVE_SECCOMP_H", + mandatory=False, ): ctx.check_cc(header_name="seccomp.h") ctx.check_cc(lib="seccomp") if not ctx.options.disable_mdns_registration: - ctx.check_cc(header_name="dns_sd.h", lib="dns_sd", mandatory=False, - uselib_store="DNS_SD") + ctx.check_cc( + header_name="dns_sd.h", lib="dns_sd", mandatory=False, uselib_store="DNS_SD" + ) # Solaris needs -lsocket and -lnsl for socket code if ctx.env.DEST_OS == "sunos": @@ -880,6 +925,7 @@ int main(int argc, char **argv) { if not ctx.env.DISABLE_NTS: from wafhelpers.openssl import check_libssl_tls13 from wafhelpers.openssl import check_openssl_bad_version + check_libssl_tls13(ctx) check_openssl_bad_version(ctx) @@ -919,6 +965,8 @@ int main(int argc, char **argv) { msg_setting("Build Docs", yesno(ctx.env.BUILD_DOC)) msg_setting("Build Manpages", yesno(ctx.env.BUILD_MAN)) + if ctx.env["ntpc"] == "none": + return ctx.recurse("pylib") ctx.env.PYSHEBANG = ctx.options.pyshebang msg_setting("PYSHEBANG", ctx.env.PYSHEBANG) @@ -931,19 +979,21 @@ int main(int argc, char **argv) { class check(BuildContext): - cmd = 'check' + cmd = "check" variant = "main" def bin_test(ctx): """Run binary check, use after tests.""" from wafhelpers.bin_test import cmd_bin_test + cmd_bin_test(ctx) def bin_test_summary(ctx): """Display results of binary check, use after tests.""" from wafhelpers.bin_test import bin_test_summary + bin_test_summary(ctx) @@ -960,6 +1010,7 @@ variant_cmd = ( for v in ["host", "main"]: # the reason for creating these subclasses is just for __doc__ below... for cmd, cls in variant_cmd: + class tmp(cls): __doc__ = "%s %s" % (cmd, v) cmd = "%s_%s" % (cmd, v) @@ -968,14 +1019,14 @@ for v in ["host", "main"]: def init_handler(ctx): cmd = ctx.cmd - if cmd == 'init_handler': - cmd = 'build' + if cmd == "init_handler": + cmd = "build" def make_context(name): for x in Context.classes: - if x.cmd == name and x.fun != 'init_handler': + if x.cmd == name and x.fun != "init_handler": return x() - ctx.fatal('No class for %r' % cmd) + ctx.fatal("No class for %r" % cmd) # By default we want to iterate over each variant. for v in ["host", "main"]: @@ -996,15 +1047,16 @@ commands = ( for command, func, descr in commands: + class tmp1(Context.Context): if descr: __doc__ = descr cmd = command fun = func - if ((command in - 'install uninstall build clean list step' - )): + if command in "install uninstall build clean list step": execute = Scripting.autoconfigure(Context.Context.execute) + + # end borrowed code @@ -1018,15 +1070,21 @@ def afterparty(ctx): # Note that this setup is applied to the build tree, not the # source tree. Only the build-tree copies of the programs are # expected to work. - for x in ("ntpclients", "tests/pylib",): + if "none" == ctx.env["ntpc"]: + return + for x in ( + "ntpclients", + "tests/pylib", + ): # List used to be longer... path_build = ctx.bldnode.make_node("pylib") path_source = ctx.bldnode.make_node(x + "/ntp") - relpath = (("../" * (x.count("/")+1)) + - path_build.path_from(ctx.bldnode)) - if ctx.cmd in ('install', 'build'): - if ((not path_source.exists() or - os.readlink(path_source.abspath()) != relpath)): + relpath = ("../" * (x.count("/") + 1)) + path_build.path_from(ctx.bldnode) + if ctx.cmd in ("install", "build"): + if ( + not path_source.exists() + or os.readlink(path_source.abspath()) != relpath + ): try: os.remove(path_source.abspath()) except OSError: @@ -1046,10 +1104,12 @@ python_scripts = { def build(ctx): + global python_scripts from waflib.Logs import verbose - ctx.load('waf', tooldir='wafhelpers/') - ctx.load('asciidoc', tooldir='wafhelpers/') - ctx.load('rtems_trace', tooldir='wafhelpers/') + + ctx.load("waf", tooldir="wafhelpers/") + ctx.load("asciidoc", tooldir="wafhelpers/") + ctx.load("rtems_trace", tooldir="wafhelpers/") if ctx.variant == "host": ctx.recurse("ntpd") @@ -1062,9 +1122,9 @@ def build(ctx): ctx.add_pre_fun(lambda ctx: ctx.exec_command("rm -f pylib/*.py[co]")) # Start purging ntp.ntpc files from build dir # so old extension won't clobber FFI or reverse - bldnode = ctx.bldnode.make_node('pylib') + bldnode = ctx.bldnode.make_node("pylib") bldnode.mkdir() - target3 = bldnode.ant_glob('*ntpc*') + target3 = bldnode.ant_glob("*ntpc*") for _ in target3: ctx.exec_command("rm -f %s" % _.abspath()) # Finish purging ntp.ntpc @@ -1075,51 +1135,53 @@ def build(ctx): ctx.recurse("libparse") ctx.recurse("libntp") if not ctx.env.DISABLE_NTS: - ctx.recurse("libaes_siv") + ctx.recurse("libaes_siv") ctx.recurse("ntpd") ctx.recurse("ntpfrob") ctx.recurse("ntptime") ctx.recurse("pylib") if ctx.env.ENABLE_ATTIC: - ctx.recurse("attic") + ctx.recurse("attic") ctx.recurse("etc") ctx.recurse("tests") - if ctx.env['PYTHON_ARGPARSE']: + if ctx.env["PYTHON_ARGPARSE"]: python_scripts.add("ntpclients/ntplogtemp.py") python_scripts.add("ntpclients/ntpviz.py") - if ctx.env['PYTHON_ARGPARSE'] and ctx.env['PYTHON_GPS']: + if ctx.env["PYTHON_ARGPARSE"] and ctx.env["PYTHON_GPS"]: python_scripts.add("ntpclients/ntploggps.py") - if ctx.env['PYTHON_CURSES']: + if ctx.env["PYTHON_CURSES"]: python_scripts.add("ntpclients/ntpmon.py") - - # Make sure the python scripts compile, but don't install them - ctx( - features="py", - source=python_scripts, - install_path=None, - ) + if "none" == ctx.env["ntpc"]: + python_scripts = [] + else: + # Make sure the python scripts compile, but don't install them + ctx( + features="py", + source=python_scripts, + install_path=None, + ) scripts = ["ntpclients/ntpleapfetch"] + list(python_scripts) ctx( features="subst", source=scripts, - target=[x.replace('.py', '') for x in scripts], + target=[x.replace(".py", "") for x in scripts], chmod=Utils.O755, - install_path='${BINDIR}', + install_path="${BINDIR}", ) ctx.add_post_fun(afterparty) - if ctx.cmd == 'clean': + if ctx.cmd == "clean": afterparty(ctx) - if ctx.env['PYTHON_ARGPARSE']: + 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']: + if ctx.env["PYTHON_ARGPARSE"] and ctx.env["PYTHON_GPS"]: ctx.manpage(1, "ntpclients/ntploggps-man.adoc") - if ctx.env['PYTHON_CURSES']: + 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") @@ -1132,6 +1194,7 @@ def build(ctx): # Skip running unit tests on a cross compile build from waflib import Options + if not ctx.env.ENABLE_CROSS: # Force re-running of tests. Same as 'waf --alltests' if ctx.cmd == "check": @@ -1159,11 +1222,16 @@ def build(ctx): if ctx.cmd == "build": if "PYTHONPATH" not in os.environ: - print("--- PYTHONPATH is not set, " - "loading the Python ntp library may be troublesome ---") + print( + "--- PYTHONPATH is not set, " + "loading the Python ntp library may be troublesome ---" + ) elif ctx.env.PYTHONARCHDIR not in os.environ["PYTHONPATH"]: - print("--- PYTHONARCHDIR not in PYTHONPATH, " - "loading the Python ntp library may be troublesome ---") + print( + "--- PYTHONARCHDIR not in PYTHONPATH, " + "loading the Python ntp library may be troublesome ---" + ) + # # Miscellaneous utility productions @@ -1183,14 +1251,16 @@ def loccount(ctx): def cxfreeze(ctx): "Create standalone binaries from Python scripts." - ctx.exec_command("for prog in " + " ".join(python_scripts) + - "; do cxfreeze $prog; done") + ctx.exec_command( + "for prog in " + " ".join(python_scripts) + "; do cxfreeze $prog; done" + ) def linkcheck(ctx): "Report references without anchors in the documentation." ctx.exec_command("devel/linkcheck docs/") + # The following sets edit modes for GNU EMACS # Local Variables: # mode:python -- 2.34.1