diff options
| author | David Robillard <d@drobilla.net> | 2012-02-12 00:41:44 +0000 | 
|---|---|---|
| committer | David Robillard <d@drobilla.net> | 2012-02-12 00:41:44 +0000 | 
| commit | 640e1474db9cb614cc1c669e5c950682c9e8493d (patch) | |
| tree | 98d441ee7d23e3e2b4e433946ad06f6b69c50e00 | |
| parent | 44c2f0d9d3e72007ca378117dae0cea1276aae15 (diff) | |
| download | lv2-640e1474db9cb614cc1c669e5c950682c9e8493d.tar.xz | |
Make top-level 'waf dist' generate necessary files so rdflib is not a build requirement.
| -rw-r--r-- | ext.wscript | 64 | ||||
| -rw-r--r-- | lv2/lv2plug.in/ns/lv2core/wscript | 42 | ||||
| -rw-r--r-- | wscript | 6 | 
3 files changed, 70 insertions, 42 deletions
| 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 diff --git a/lv2/lv2plug.in/ns/lv2core/wscript b/lv2/lv2plug.in/ns/lv2core/wscript index e0bab75..b485d7d 100644 --- a/lv2/lv2plug.in/ns/lv2core/wscript +++ b/lv2/lv2plug.in/ns/lv2core/wscript @@ -3,6 +3,7 @@ import os  from waflib.extras import autowaf as autowaf  import waflib.Options as Options +import waflib.Context as Context  import waflib.Scripting as Scripting  import glob @@ -72,29 +73,38 @@ def build(bld):                             os.path.relpath(bundle_dir, include_dir))  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()) +class DistCheck(Dist, Scripting.DistCheck): +    def execute(self): +        Dist.execute(self) +        self.check() +          def archive(self): -        # Write NEWS file -        news(self) +        Dist.archive(self) -        # Build distribution -        Scripting.Dist.archive(self) +def pre_dist(ctx): +    # Write NEWS file in source directory +    news(ctx) -        # Delete generated NEWS file -        try: -            os.remove('NEWS') -        except: -            pass +def dist(ctx): +    pre_dist(ctx) +    ctx.archive() +    post_dist(ctx) -class DistCheck(Dist, Scripting.DistCheck): -    fun = 'distcheck' -    cmd = 'distcheck' +def distcheck(ctx): +    dist(ctx) + +def post_dist(ctx): +    # Delete generated NEWS file +    try: +        os.remove(os.path.join(ctx.path.abspath(), 'NEWS')) +    except: +        pass -    def archive(self): -        Dist.archive(self) @@ -10,6 +10,7 @@ import sys  from waflib.extras import autowaf as autowaf  import waflib.Logs as Logs  import waflib.Options as Options +import waflib.Scripting as Scripting  # Version of this package (even if built as a child)  LV2EXT_VERSION = datetime.date.isoformat(datetime.datetime.now()).replace('-', '.') @@ -312,6 +313,11 @@ def release(ctx):  def news(ctx):      ctx.recurse(get_subdirs(False)) +def dist(ctx): +    ctx.recurse(get_subdirs(False), name='pre_dist') +    ctx.archive() +    ctx.recurse(get_subdirs(False), name='post_dist') +  def lint(ctx):      for i in (['lv2/lv2plug.in/ns/lv2core/lv2.h']                + glob.glob('lv2/lv2plug.in/ns/ext/*/*.h') |