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)
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), )))
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), )))
def dump(self, path: Path, value: ProjectConfig): path.write_text(dump_json(value.dict()))
def load(self, path: Path) -> ProjectConfig: config = ProjectConfig(**json.loads(path.read_text())) self.fix_paths(config) return config
def beet_default(ctx: Context): config = ProjectConfig(data_pack={"load": ["src"]}).resolve(ctx.directory) ctx.require(ProjectBuilder(Project(config, resolved_cache=ctx.cache)))