Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ENH: create __config__.py file.

  • Loading branch information...
commit 4c6fa4c7cd8c43e0b6ca1a40778dfc4c59d8cb69 1 parent 4cf2a89
@cournape cournape authored
Showing with 48 additions and 0 deletions.
  1. +48 −0 bscript
View
48 bscript
@@ -1,4 +1,5 @@
import sys
+import os.path as op
from numpy.distutils.misc_util \
import \
@@ -11,6 +12,9 @@ from bento.commands import hooks
from bento.commands.extras.waf \
import \
ConfigureWafContext, BuildWafContext, register_options
+from bento.installed_package_description \
+ import \
+ InstalledSection
import waflib
from waflib import Options
@@ -110,3 +114,47 @@ def post_configure(context):
conf.env["MACOSX_DEPLOYMENT_TARGET"] = "10.4"
conf.env.MACOSX_DEPLOYMENT_TARGET = "10.4"
+
+# FIXME: abstract those module gen tasks...
+class write_module(waflib.Task.Task):
+ color = "CYAN"
+ vars = ["CONTENT"]
+ def run(self):
+ # FIXME: put actual data here
+ self.outputs[0].write(self.env.CONTENT)
+
+@waflib.TaskGen.feature("gen_pymodule")
+def process_write_config(self):
+ if not hasattr(self, "content"):
+ raise ValueError("task gen %r expects a 'content' argument" % self.name)
+ else:
+ self.env.CONTENT = self.content
+ output = self.path.find_or_declare(self.target)
+ name = getattr(self, "name", None) or self.target
+
+ bento_context = self.bld.bento_context
+ b_output = bento_context.build_node.make_node(output.bldpath())
+ bento_context.outputs_registry.register_outputs(
+ "gen_pymodule", name, [b_output], bento_context.build_node, "$sitedir")
+
+ tsk = self.create_task("write_module")
+ tsk.set_outputs(output)
+ return tsk
+
+@hooks.pre_build()
+def pre_build(context):
+ bld = context.waf_context
+
+ def iregistrer(category, name, nodes, from_node, target_dir):
+ source_dir = op.join("$_srcrootdir", from_node.bldpath())
+ files = [n.path_from(from_node) for n in nodes]
+ return InstalledSection.from_source_target_directories(category, name, source_dir, target_dir, files)
+ context.isection_registry.register_category("gen_pymodule", iregistrer)
+ context.outputs_registry.register_category("gen_pymodule", "pythonfiles")
+ bld(features="gen_pymodule",
+ target="scipy/__config__.py",
+ content="""\
+def show():
+ pass
+""",
+ always=True)
Please sign in to comment.
Something went wrong with that request. Please try again.