rubem.configuration.migrate.migrate_legacy_file
- migrate_legacy_file(source, destination=None, *, force=False, metadata=None)[source]
-
Write the format 1.0 equivalent of a legacy configuration file.
Relative paths of the legacy file are anchored on its directory and rebased onto the directory of the destination, so the migrated file keeps pointing at the same data wherever it is written. The file is written atomically (temporary file plus rename) and an existing destination is not overwritten unless
forceis set.- Parameters:
-
source (
str|PathLike[str] |bytes) – The legacy JSON file.destination (
str|PathLike[str] |bytes|None) – The 1.0 file to write; defaults to<source stem>-v1.jsonnext to the source.force (
bool) – Overwrite an existing destination.metadata (
dict|None) – Optionalmetadatasection for the migrated file.
- Return type:
-
Path - Returns:
-
The path written.
- Raises:
-
FileExistsError – If the destination exists and
forceis false.