[Git][NTPsec/ntpsec][master] Eliminate parse_version() function

Matt Selsky gitlab at mg.gitlab.com
Tue Apr 25 05:13:14 UTC 2017


Matt Selsky pushed to branch master at NTPsec / ntpsec


Commits:
a5bcd155 by Matt Selsky at 2017-04-25T01:07:20-04:00
Eliminate parse_version() function

The intermediate storage is never reused

- - - - -


1 changed file:

- wscript


Changes:

=====================================
wscript
=====================================
--- a/wscript
+++ b/wscript
@@ -75,18 +75,6 @@ def configure(ctx):
         pprint("NORMAL", "  %-30s: " % name, sep="")
         pprint("YELLOW", val)
 
-    def parse_version(config):
-        with open("VERSION", "r") as f:
-            version_string = f.read().split(" ")[0].strip()
-            [major, minor, rev] = version_string.split(".")
-            # "NTPS" for NTPSec
-            # this avoids any naming collisions
-            map = {"NTPSEC_VERSION_MAJOR": int(major),
-                   "NTPSEC_VERSION_MINOR": int(minor),
-                   "NTPSEC_VERSION_REV": int(rev)}
-
-        config.update(map)
-
     srcnode = ctx.srcnode.abspath()
     bldnode = ctx.bldnode.abspath()
 
@@ -95,11 +83,12 @@ def configure(ctx):
     ctx.load('waf_unit_test')
     ctx.load('gnu_dirs')
 
-    parse_version(config)
-
-    ctx.env.NTPSEC_VERSION_MAJOR = config["NTPSEC_VERSION_MAJOR"]
-    ctx.env.NTPSEC_VERSION_MINOR = config["NTPSEC_VERSION_MINOR"]
-    ctx.env.NTPSEC_VERSION_REV = config["NTPSEC_VERSION_REV"]
+    with open("VERSION", "r") as f:
+        version_string = f.read().split(" ")[0].strip()
+        [major, minor, rev] = version_string.split(".")
+        ctx.env.NTPSEC_VERSION_MAJOR = int(major)
+        ctx.env.NTPSEC_VERSION_MINOR = int(minor)
+        ctx.env.NTPSEC_VERSION_REV = int(rev)
 
     ctx.env.NTPSEC_VERSION = "%s.%s.%s" % (ctx.env.NTPSEC_VERSION_MAJOR,
                                            ctx.env.NTPSEC_VERSION_MINOR,



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/a5bcd155bbc5fe8e87365b83221e30c6a40b1baf

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/a5bcd155bbc5fe8e87365b83221e30c6a40b1baf
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/20170425/1f6ed6ca/attachment.html>


More information about the vc mailing list