Generate a different welcome paragraph on main.html dependent on whether this is a release build or a snapshot build.

This commit is contained in:
Robin Dunn
2017-05-10 12:42:48 -07:00
parent ad46014aeb
commit 37d67272b0
3 changed files with 27 additions and 14 deletions

View File

@@ -15,7 +15,7 @@ import glob
import random
# Phoenix-specific imports
from buildtools.config import copyIfNewer, writeIfChanged, newer, getVcsRev, textfile_open
from buildtools.config import Config, writeIfChanged, newer, textfile_open, runcmd
from etgtools.item_module_map import ItemModuleMap
from . import templates
@@ -647,7 +647,7 @@ def addJavaScript(text):
# ----------------------------------------------------------------------- #
def postProcess(folder):
def postProcess(folder, options):
fileNames = glob.glob(folder + "/*.html")
@@ -678,8 +678,8 @@ def postProcess(folder):
split = os.path.split(files)[1]
if split in ['index.html', 'main.html']:
text = changeSVNRevision(text)
if split == 'main.html':
text = changeWelcomeText(text, options)
else:
text = text.replace('class="headerimage"', 'class="headerimage-noshow"')
@@ -734,13 +734,29 @@ def postProcess(folder):
# ----------------------------------------------------------------------- #
def changeSVNRevision(text):
REVISION = getVcsRev()
text = text.replace('|TODAY|', TODAY)
text = text.replace('|VCSREV|', REVISION)
def changeWelcomeText(text, options):
cfg = Config(noWxConfig=True)
if options.release:
welcomeText = """
Welcome! This is the API reference documentation for the <b>{version}
release</b> of wxPython Phoenix, built on {today}.
""".format(version=cfg.VERSION, today=TODAY)
else:
revhash = runcmd('git rev-parse --short HEAD', getOutput=True, echoCmd=False)
welcomeText = """
Welcome! This is the API documentation for the wxPython Phoenix
<b>pre-release snapshot</b> build <b>{version}</b>, last updated {today}
from git revision:
<a href="https://github.com/wxWidgets/Phoenix/commit/{revhash}">{revhash}</a>.
""".format(version=cfg.VERSION, today=TODAY, revhash=revhash)
text = text.replace('|WELCOME|', welcomeText)
return text
def tooltipsOnInheritance(text, class_summary):
graphviz = re.findall(r'<p class="graphviz">(.*?)</p>', text, re.DOTALL)