Esempio n. 1
0
File: tasks.py Progetto: paramv/mesh
    def run(self, runtime):
        from mesh.binding.python import BindingGenerator
        generator = BindingGenerator(binding_module=self['binding_module'],
            mixin_modules=self['mixin_modules'])
        filename, source = generator.generate(self['bundle'])

        root = self['path']
        if not (root.exists() and root.isdir()):
            raise TaskError('path is not an existing directory')

        (root / filename).write_bytes(source)
Esempio n. 2
0
    def run(self, runtime):
        from mesh.binding.python import BindingGenerator
        generator = BindingGenerator(binding_module=self['binding_module'],
                                     mixin_modules=self['mixin_modules'])
        filename, source = generator.generate(self['bundle'])

        root = self['path']
        if not (root.exists() and root.isdir()):
            raise TaskError('path is not an existing directory')

        (root / filename).write_bytes(source)
Esempio n. 3
0
    def run(self, runtime):
        from mesh.binding.python import BindingGenerator

        generator = BindingGenerator(module_path=self["package"], separate_models=self["separate"])
        files = generator.generate(self["bundle"], self["version"])

        root = self["path"]
        if not root.isdir():
            raise TaskError("...")

        bundle = self["bundle"]
        if root.basename() != bundle.name:
            root /= bundle.name
            root.mkdir_p()

        for token, (filename, content) in files.iteritems():
            filepath = root / filename
            if token in ("__init__", "__spec__") or not filepath.exists():
                filepath.write_bytes(content)