* Run the sphinx command directly instead of going through their batch or Makefile.

* Output the html files to docs/html
* Clean more in clean_sphinx

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@70239 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2012-01-02 22:03:17 +00:00
parent 01965d607b
commit 474de882a8
2 changed files with 32 additions and 25 deletions

View File

@@ -77,9 +77,9 @@ Usage: ./build.py [command(s)] [options]
clean_py Clean the wxPython parts of the build
clean_sphinx Clean the sphinx files
clean Clean wx, wxPython and Sphinx
clean Clean both wx and wxPython
cleanall Clean all and do a little extra scrubbing too
"""
# cleanall Clean both wx and wxPython, and a little extra scrubbing
parser = makeOptionParser()
parser.print_help()
@@ -483,12 +483,13 @@ def sphinx(options, args):
MakeHeadings()
pwd2 = pushDir(sphinxDir)
runcmd('make html')
buildDir = os.path.join(sphinxDir, 'build')
htmlDir = os.path.join(phoenixDir(), 'docs', 'html')
runcmd('sphinx-build -b html -d %s/doctrees . %s' % (buildDir, htmlDir))
del pwd2
buildDir = os.path.join(sphinxDir, 'build')
msg('Postprocesing sphinx...')
PostProcess(buildDir)
msg('Postprocesing sphinx output...')
PostProcess(htmlDir)
@@ -849,32 +850,36 @@ def clean_py(options, args):
options.both = True
def clean_sphinx(options, args, full=True):
def clean_sphinx(options, args):
msg('Running command: clean_sphinx')
assert os.getcwd() == phoenixDir()
sphinxDir = os.path.join(phoenixDir(), 'docs', 'sphinx')
sphinxfiles = []
if full:
sphinxfiles = glob.glob(sphinxDir + '/*.txt')
sphinxfiles += glob.glob(sphinxDir + '/*.inc')
pklfiles = glob.glob(sphinxDir + '/*.pkl')
lstfiles = glob.glob(sphinxDir + '/*.lst')
sphinxDir = opj(phoenixDir(), 'docs', 'sphinx')
globs = [ opj(sphinxDir, '*.txt'),
opj(sphinxDir, '*.inc'),
opj(sphinxDir, '*.pkl'),
opj(sphinxDir, '*.lst'),
opj(sphinxDir, '_templates/gallery.html'),
opj(sphinxDir, 'rest_substitutions/snippets/python/*.py'),
opj(sphinxDir, 'rest_substitutions/snippets/cpp/*.cpp'),
]
for wc in globs:
for f in glob.glob(wc):
os.remove(f)
dirs = [opj(sphinxDir, 'build'),
opj(phoenixDir(), 'docs/html'),
]
for d in dirs:
if os.path.exists(d):
shutil.rmtree(d)
for f in sphinxfiles + pklfiles + lstfiles:
os.remove(f)
buildDir = os.path.join(sphinxDir, 'build')
if os.path.exists(buildDir):
shutil.rmtree(buildDir)
def clean(options, args):
clean_wx(options, args)
clean_py(options, args)
clean_sphinx(options, args)
def cleanall(options, args):
@@ -882,6 +887,8 @@ def cleanall(options, args):
# compilation part of build
clean_wx(options, args)
clean_py(options, args)
# Clean all the intermediate and generated files from the sphinx command
clean_sphinx(options, args)
# Now also scrub out all of the SIP and C++ source files that are

View File

@@ -476,14 +476,14 @@ def ClassToFile(line):
def PostProcess(folder):
fileNames = glob.glob(folder + "/html/*.html")
fileNames = glob.glob(folder + "/*.html")
phoenix_image = '<div class="floatcenter" style="background-color: white; text-align: middle; align: middle; padding: 40px 10px 15px 15px">\n' \
'<img src="_static/phoenix_top.png" alt="Phoenix Logo" align="middle" />\n' \
'</div>'
enum_files = glob.glob(folder + '/html/*.enumeration.html')
enum_files = glob.glob(folder + '/*.enumeration.html')
enum_base = [os.path.split(os.path.splitext(enum)[0])[1] for enum in enum_files]
enum_base = [enum.replace('.enumeration', '') for enum in enum_base]