Skip to content

Commit

Permalink
Make build reproducible by reading envvar SOURCE_DATE_EPOCH if set (#…
Browse files Browse the repository at this point in the history
…3430)

Co-authored-by: Justin Mayer <[email protected]>
  • Loading branch information
Vincent-C and justinmayer authored Jan 15, 2025
1 parent 64be147 commit 5be013d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import datetime
import os
import sys
import time

if sys.version_info >= (3, 11):
import tomllib
Expand Down Expand Up @@ -30,7 +31,9 @@
source_suffix = ".rst"
master_doc = "index"
project = project_data.get("name").upper()
year = datetime.datetime.now().date().year
year = datetime.datetime.fromtimestamp(
int(os.environ.get("SOURCE_DATE_EPOCH", time.time())), datetime.timezone.utc
).year
copyright = f"2010–{year}" # noqa: RUF001
exclude_patterns = ["_build"]
release = project_data.get("version")
Expand Down

0 comments on commit 5be013d

Please sign in to comment.