[Git][NTPsec/ntpsec][master] Improved maginery for making magic in-tree links.
Eric S. Raymond
gitlab at mg.gitlab.com
Sat Nov 12 18:55:34 UTC 2016
Eric S. Raymond pushed to branch master at NTPsec / ntpsec
Commits:
b0a5ab0d by Eric S. Raymond at 2016-11-12T13:55:25-05:00
Improved maginery for making magic in-tree links.
- - - - -
1 changed file:
- wscript
Changes:
=====================================
wscript
=====================================
--- a/wscript
+++ b/wscript
@@ -129,16 +129,22 @@ def linkmaker(ctx):
# can import compiled Python modules from the build directory.
# Also, they need to be able to see the Python extension
# module built in libntp.
- if ctx.cmd == "build":
- print("Making in-tree links...")
- bldnode = ctx.bldnode.abspath()
- srcnode = ctx.srcnode.abspath()
- for d in ("ntpq", "ntpdig", "ntpstats", "ntpsweep", "ntptrace", "ntpwait"):
- os.system("ln -sf %s/pylib %s/%s/ntp" % (bldnode, srcnode, d))
- os.system("ln -sf %s/libntp/ntpc.so %s/pylib/ntpc.so " % (bldnode, bldnode))
- if not "PYTHONPATH" in os.environ:
- print("--- PYTHONPATH is not set, "
- "loading the Python ntp library may be troublesome ---")
+ for x in ("ntpq", "ntpdig", "ntpstats", "ntpsweep", "ntptrace", "ntpwait"):
+ path_build = ctx.bldnode.make_node("pylib")
+ path_source = ctx.srcnode.make_node(x + "/ntp")
+ relpath = "../" + path_build.path_from(ctx.srcnode)
+ 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:
+ pass
+ os.symlink(relpath, path_source.abspath())
+ elif ctx.cmd == 'clean':
+ #print "removing", path_source.abspath()
+ os.remove(path_source.abspath())
+ bldnode = ctx.bldnode.abspath()
+ os.system("ln -sf %s/libntp/ntpc.so %s/pylib/ntpc.so " % (bldnode, bldnode))
def build(ctx):
ctx.load('waf', tooldir='wafhelpers/')
@@ -197,7 +203,7 @@ def build(ctx):
install_path = "${PREFIX}/bin/"
)
- ctx.add_post_fun(linkmaker)
+ linkmaker(ctx)
ctx.manpage(8, "ntpleapfetch/ntpleapfetch-man.txt")
ctx.manpage(1, "ntptrace/ntptrace-man.txt")
@@ -225,6 +231,11 @@ def build(ctx):
from waflib import Options
Options.options.no_tests = True
+ if ctx.cmd == "build":
+ if not "PYTHONPATH" in os.environ:
+ print("--- PYTHONPATH is not set, "
+ "loading the Python ntp library may be troublesome ---")
+
#
# Miscellaneous utility productions
#
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/b0a5ab0d2f440f6bccca7b214eff4af60fbce145
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161112/0d835ecc/attachment.html>
More information about the vc
mailing list