From 640e1474db9cb614cc1c669e5c950682c9e8493d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 12 Feb 2012 00:41:44 +0000 Subject: Make top-level 'waf dist' generate necessary files so rdflib is not a build requirement. --- ext.wscript | 64 ++++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 26 deletions(-) (limited to 'ext.wscript') diff --git a/ext.wscript b/ext.wscript index 1313c61..efc4035 100644 --- a/ext.wscript +++ b/ext.wscript @@ -185,37 +185,49 @@ def news(ctx): os.path.join(path, 'NEWS')) class Dist(Scripting.Dist): - fun = 'dist' - cmd = 'dist' + def execute(self): + "Execute but do not call archive() since dist() has already done so." + self.recurse([os.path.dirname(Context.g_module.root_path)]) def get_tar_path(self, node): "Resolve symbolic links to avoid broken links in tarball." return os.path.realpath(node.abspath()) - def archive(self): - # Generate lv2extinfo.py in source tree - lv2extinfo_py = open('lv2extinfo.py', 'w') - for i in info.__dict__: - if i.isupper(): - lv2extinfo_py.write("%s = %s\n" % (i, repr(info.__dict__[i]))) - lv2extinfo_py.close() - - # Write NEWS file - news(self) - - # Build distribution - Scripting.Dist.archive(self) - - # Delete generated files from source tree - for i in ['NEWS', 'lv2extinfo.py', 'lv2extinfo.pyc']: - try: - os.remove(i) - except: - pass - class DistCheck(Dist, Scripting.DistCheck): - fun = 'distcheck' - cmd = 'distcheck' - + def execute(self): + Dist.execute(self) + self.check() + def archive(self): Dist.archive(self) + +def pre_dist(ctx): + # Write lv2extinfo.py in source directory + path = ctx.path.abspath() + lv2extinfo_py = open(os.path.join(path, 'lv2extinfo.py'), 'w') + for i in info.__dict__: + if i.isupper(): + lv2extinfo_py.write("%s = %s\n" % (i, repr(info.__dict__[i]))) + lv2extinfo_py.close() + + # Write NEWS file in source directory + news(ctx) + +def dist(ctx): + pre_dist(ctx) + ctx.archive() + post_dist(ctx) + +def distcheck(ctx): + dist(ctx) + +def post_dist(ctx): + # Delete generated files from source tree + path = ctx.path.abspath() + for i in [os.path.join(path, 'NEWS'), + os.path.join(path, 'lv2extinfo.py'), + os.path.join(path, 'lv2extinfo.pyc')]: + try: + os.remove(i) + except: + pass -- cgit v1.2.1