コード例 #1
0
    def fix_paths(self, config: ProjectConfig):
        if config.directory:
            config.directory = str(Path(config.directory))
        if config.output:
            config.output = str(Path(config.output))

        config.data_pack.load = [str(Path(p)) for p in config.data_pack.load]
        config.resource_pack.load = [str(Path(p)) for p in config.resource_pack.load]
        config.templates = [str(Path(p)) for p in config.templates]

        for entry in config.pipeline:
            if isinstance(entry, ProjectConfig):
                self.fix_paths(entry)
コード例 #2
0
def beet_default(ctx: Context):
    config = ProjectConfig(data_pack={"load": ["src"]}).resolve(ctx.directory)
    ctx.require(
        ProjectBuilder(
            Project(
                config,
                resolved_cache=ctx.cache,
                resolved_worker_pool=WorkerPool(resolved_handle=ctx.worker),
            )))
コード例 #3
0
def beet_default(ctx: Context):
    if ctx.worker.long_lived:
        raise ErrorMessage(
            f'The "{__name__}" plugin should only be used for one-shot builds.'
        )

    with config_error_handler("(stdin)"):
        data = json.load(sys.stdin)
        config = ProjectConfig.parse_obj(data).resolve(ctx.directory)

    ctx.require(
        ProjectBuilder(
            Project(
                resolved_config=config,
                resolved_cache=ctx.cache,
                resolved_worker_pool=WorkerPool(resolved_handle=ctx.worker),
            )))
コード例 #4
0
 def dump(self, path: Path, value: ProjectConfig):
     path.write_text(dump_json(value.dict()))
コード例 #5
0
 def load(self, path: Path) -> ProjectConfig:
     config = ProjectConfig(**json.loads(path.read_text()))
     self.fix_paths(config)
     return config
コード例 #6
0
ファイル: demo.py プロジェクト: misode/beet
def beet_default(ctx: Context):
    config = ProjectConfig(data_pack={"load": ["src"]}).resolve(ctx.directory)
    ctx.require(ProjectBuilder(Project(config, resolved_cache=ctx.cache)))