resolve_date_updated#
- technote.metadata.builddate.resolve_date_updated(declared, source_dir, *, date_created=None)#
Resolve the
date_updatedfor a technote build.- Parameters:
declared (
datetime|None) – Thedate_updateddeclared intechnote.toml, orNoneif it is not declared.source_dir (
Path) – The technote’s source directory, used to look up the git commit.date_created (
datetime|None, default:None) – Thedate_createddeclared intechnote.toml, orNoneif it is not declared. A deriveddate_updatedis never earlier than this date; a declareddate_updatedis left alone.
- Returns:
The first available of, in order:
The declared
date_updated.The
SOURCE_DATE_EPOCHenvironment variable.The committer date of the checked-out git commit.
The current time, when the commit date cannot be read: the source directory is not inside a git repository, the repository has no commits yet, or reading the commit date failed. Only the last of those emits a Sphinx warning; see
get_git_head_committer_date.
A derived date (2, 3 or 4) is clamped to
date_createdwhen it would otherwise be earlier: a baredate_createdintechnote.tomlis anchored to midnight UTC, so a commit made earlier the same local day in a timezone ahead of UTC precedes it, and a technote must not report being modified before it was created.- Return type: