Skip to content
Permalink
Browse files Browse the repository at this point in the history
Fix date on the front page of verilator.pdf (#3956) (#3957)
  • Loading branch information
ldoolitt committed Feb 13, 2023
1 parent 5064ec2 commit bc6a778
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions docs/guide/conf.py
Expand Up @@ -10,7 +10,6 @@
# ----------------------------------------------------------------------
# -- Path setup

from datetime import datetime
import os
import re
import sys
Expand All @@ -24,10 +23,17 @@ def get_vlt_version():
filename = "../../Makefile"
with open(filename, "r", encoding="utf8") as fh:
for line in fh:
match = re.search(r"PACKAGE_VERSION_NUMBER *= *([a-z0-9.]+)", line)
match = re.search(r"PACKAGE_VERSION *= *([a-z0-9.]+) +([-0-9]+)", line)
if match:
return match.group(1)
return "unknown"
return match.group(1), match.group(2)
match = re.search(r"PACKAGE_VERSION *= *([a-z0-9.]+) +devel", line)
if match:
try:
data = os.popen('git log -n 1 --pretty=%cs').read()
except Exception:
data = "" # fallback, and Sphinx will fill in today's date
return "Devel " + match.group(1), data
return "unknown", "unknown"


def setup(app):
Expand All @@ -44,8 +50,8 @@ def setup(app):
# The master toctree document.
master_doc = "index"

version = get_vlt_version()
release = get_vlt_version()
version, today_fmt = get_vlt_version()
release = version

rst_prolog = """
.. role:: vlopt(option)
Expand Down Expand Up @@ -89,15 +95,6 @@ def setup(app):
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

try:
# https://reproducible-builds.org/specs/source-date-epoch/
doc_now = datetime.fromtimestamp(int(os.environ["SOURCE_DATE_EPOCH"]))
print("Using SOURCE_DATE_EPOCH")
except Exception:
doc_now = datetime.now()
# Date format to ISO
today_fmt = doc_now.strftime("%F")

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True

Expand Down

0 comments on commit bc6a778

Please sign in to comment.