diff --git a/build.py b/build.py index 7f361062..2db25d74 100755 --- a/build.py +++ b/build.py @@ -30,7 +30,7 @@ import datetime from distutils.dep_util import newer, newer_group from buildtools.config import Config, msg, opj, posixjoin, loadETG, etg2sip, findCmd, \ phoenixDir, wxDir, copyIfNewer, copyFile, \ - macFixDependencyInstallName, macSetLoaderNames, \ + macSetLoaderNames, \ getVcsRev, runcmd, textfile_open, getSipFiles, \ getVisCVersion, getToolsPlatformName @@ -960,7 +960,7 @@ def cmd_sphinx(options, args): del pwd2 msg('Postprocessing sphinx output...') - postProcess(htmlDir) + postProcess(htmlDir, options) def cmd_wxlib(options, args): diff --git a/docs/sphinx/_templates/main.html b/docs/sphinx/_templates/main.html index b9a03a53..74199999 100644 --- a/docs/sphinx/_templates/main.html +++ b/docs/sphinx/_templates/main.html @@ -3,10 +3,7 @@ {% block body %}

wxPython Phoenix API Documentation

-

- Welcome! This is the API documentation for wxPython Phoenix {{ release }}, - last updated |TODAY| from git revision |VCSREV|. -

+

|WELCOME|

If you are porting your code from Classic wxPython, be sure to read the diff --git a/sphinxtools/postprocess.py b/sphinxtools/postprocess.py index d55695ce..c0476707 100644 --- a/sphinxtools/postprocess.py +++ b/sphinxtools/postprocess.py @@ -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 {version} + release 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 + pre-release snapshot build {version}, last updated {today} + from git revision: + {revhash}. + """.format(version=cfg.VERSION, today=TODAY, revhash=revhash) + text = text.replace('|WELCOME|', welcomeText) return text + + def tooltipsOnInheritance(text, class_summary): graphviz = re.findall(r'

(.*?)

', text, re.DOTALL)