def write_pyproject(self, show_message: bool = True) -> None: with atomic_open_for_write(self.pyproject_file.as_posix(), encoding="utf-8") as f: f.write(tomlkit.dumps(self.pyproject)) if show_message: stream.echo("Changes are written to pyproject.toml.") self._pyproject = None
def write_pyproject(self, show_message: bool = True) -> None: with atomic_open_for_write(self.pyproject_file.as_posix(), encoding="utf-8") as f: atoml.dump(self.pyproject, f) if show_message: self.core.ui.echo( f"Changes are written to {termui.green('pyproject.toml')}.") self._pyproject = None
def write_lockfile(self, toml_data: Container, show_message: bool = True) -> None: toml_data["metadata"].update(self.get_lock_metadata()) with atomic_open_for_write(self.lockfile_file) as fp: fp.write(tomlkit.dumps(toml_data)) if show_message: self.core.ui.echo(f"Changes are written to {termui.green('pdm.lock')}.") self._lockfile = None
def write_lockfile(self, toml_data: Container, show_message: bool = True) -> None: toml_data.update({"root": self.get_project_metadata()}) with atomic_open_for_write(self.lockfile_file) as fp: fp.write(tomlkit.dumps(toml_data)) if show_message: stream.echo("Changes are written to pdm.lock.") self._lockfile = None
def write_lockfile( self, toml_data: dict, show_message: bool = True, write: bool = True ) -> None: toml_data["metadata"].update(self.get_lock_metadata()) if write: with atomic_open_for_write(self.lockfile_file) as fp: tomlkit.dump(toml_data, fp) # type: ignore if show_message: self.core.ui.echo(f"Changes are written to {termui.green('pdm.lock')}.") self._lockfile = None else: self._lockfile = toml_data