[Git][NTPsec/ntpsec][master] Consoldate all configure() code in pylib/configure.py

Amar Takhar gitlab at mg.gitlab.com
Wed Mar 23 13:45:46 UTC 2016


Amar Takhar pushed to branch master at NTPsec / ntpsec


Commits:
52064758 by Amar Takhar at 2016-03-23T09:44:48-04:00
Consoldate all configure() code in pylib/configure.py

- - - - -


2 changed files:

- pylib/configure.py
- wscript


Changes:

=====================================
pylib/configure.py
=====================================
--- a/pylib/configure.py
+++ b/pylib/configure.py
@@ -4,10 +4,28 @@ from probes import *
 import sys, os
 from util import parse_version
 
-def cmd_configure(ctx):
+def cmd_configure(ctx, config):
 	srcnode = ctx.srcnode.abspath()
 	bldnode = ctx.bldnode.abspath()
 
+	ctx.load('waf', tooldir='pylib/')
+	ctx.load('waf_unit_test')
+
+	from pylib.util import parse_version
+	parse_version(config)
+
+	ctx.env.NTPS_RELEASE = config["NTPS_RELEASE"]
+	ctx.env.NTPS_VERSION_MAJOR = config["NTPS_VERSION_MAJOR"]
+	ctx.env.NTPS_VERSION_MINOR = config["NTPS_VERSION_MINOR"]
+	ctx.env.NTPS_VERSION_REV = config["NTPS_VERSION_REV"]
+
+	ctx.env.NTPS_VERSION = "%s.%s.%s" % (ctx.env.NTPS_VERSION_MAJOR, ctx.env.NTPS_VERSION_MINOR, ctx.env.NTPS_VERSION_REV)
+	ctx.define("NTPS_VERSION_MAJOR", ctx.env.NTPS_VERSION_MAJOR)
+	ctx.define("NTPS_VERSION_MINOR", ctx.env.NTPS_VERSION_MINOR)
+	ctx.define("NTPS_VERSION_REV", ctx.env.NTPS_VERSION_REV)
+
+	ctx.env.OPT_STORE = config["OPT_STORE"]
+
 	opt_map = {}
 	# Wipe out and override flags with those from the commandline
 	for flag in ctx.env.OPT_STORE:


=====================================
wscript
=====================================
--- a/wscript
+++ b/wscript
@@ -14,7 +14,8 @@ OPT_STORE = {} # Storage for options to pass into configure
 
 config = {
 	"NTPS_RELEASE": True,
-	"out": out
+	"out": out,
+	"OPT_STORE": {}
 }
 
 # Release procedure:
@@ -39,7 +40,7 @@ def options(ctx):
 	ctx.load('waf_unit_test')
 
 	def callback_flags(option, opt, value, parser):
-		OPT_STORE.setdefault(opt, []).append(value)
+		config["OPT_STORE"].setdefault(opt, []).append(value)
 
 	grp = ctx.add_option_group("NTP configure options")
 	grp.add_option('--enable-debug', action='store_true', default=False, help="(ignored)")
@@ -88,26 +89,8 @@ def options(ctx):
 
 
 def configure(ctx):
-	from pylib.util import parse_version
-	parse_version(config)
-
-	ctx.env.NTPS_RELEASE = config["NTPS_RELEASE"]
-	ctx.env.NTPS_VERSION_MAJOR = config["NTPS_VERSION_MAJOR"]
-	ctx.env.NTPS_VERSION_MINOR = config["NTPS_VERSION_MINOR"]
-	ctx.env.NTPS_VERSION_REV = config["NTPS_VERSION_REV"]
-
-	ctx.env.NTPS_VERSION = "%s.%s.%s" % (ctx.env.NTPS_VERSION_MAJOR, ctx.env.NTPS_VERSION_MINOR, ctx.env.NTPS_VERSION_REV)
-	ctx.define("NTPS_VERSION_MAJOR", ctx.env.NTPS_VERSION_MAJOR)
-	ctx.define("NTPS_VERSION_MINOR", ctx.env.NTPS_VERSION_MINOR)
-	ctx.define("NTPS_VERSION_REV", ctx.env.NTPS_VERSION_REV)
-
-
-	ctx.load('waf', tooldir='pylib/')
-	ctx.load('waf_unit_test')
-
-	ctx.env.OPT_STORE = OPT_STORE
-
-	cmd_configure(ctx)
+	from pylib.configure import cmd_configure
+	cmd_configure(ctx, config)
 
 
 from waflib.Build import BuildContext



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/520647584ddc24f264e97f028cecc1e17443b911
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160323/6713b063/attachment.html>


More information about the vc mailing list