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 force is 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.json next to the source.

  • force (bool) – Overwrite an existing destination.

  • metadata (dict | None) – Optional metadata section for the migrated file.

Return type:

Path

Returns:

The path written.

Raises:

FileExistsError – If the destination exists and force is false.