2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-19 04:22:16 +00:00

Build docs with faber.

This commit is contained in:
Stefan Seefeld
2018-03-07 11:01:20 -05:00
parent ed3cbf8a60
commit 66dad425aa
4 changed files with 96 additions and 11 deletions

View File

@@ -22,10 +22,10 @@ fi
REPO=`git config remote.origin.url`
SHA=`git rev-parse --verify HEAD`
# bin.SCons happens to contain the "doc/html" tree that we want to push
# build happens to contain the "doc/html" tree that we want to push
# into the gh-pages branch. So we step into that directory, create a new repo,
# set the remote appropriately, then commit and push.
cd bin.SCons
cd build
git init
git config user.name "Travis CI"
git config user.email "travis-ci"

View File

@@ -29,7 +29,7 @@ matrix:
env: CXX=clang++ PYTHON=python3 CXXFLAGS=-std=c++98
- compiler: clang
env: CXX=clang++ PYTHON=python3 CXXFLAGS=-std=c++11
#- env: PYTHON=python DOC=1
- env: PYTHON=python DOC=1
addons:
@@ -37,7 +37,6 @@ addons:
sources:
- ubuntu-toolchain-r-test
packages:
- scons
- gcc-4.8
- g++-4.8
- clang
@@ -80,11 +79,13 @@ install:
rm -rf $HOME/Boost/boost/python*
popd
# Install Faber, the build tool.
date=2017-11-09
#wget https://github.com/stefanseefeld/faber/archive/snapshot/$date.tar.gz
wget https://github.com/stefanseefeld/faber/archive/release/0.2.tar.gz
tar xf 0.2.tar.gz
pushd faber-release-0.2
date=2018-03-07
wget https://github.com/stefanseefeld/faber/archive/snapshot/$date.tar.gz
tar xf $date.tar.gz
pushd faber-snapshot-$date
#wget https://github.com/stefanseefeld/faber/archive/release/0.2.tar.gz
#tar xf 0.2.tar.gz
#pushd faber-release-0.2
sudo python setup.py install
popd
fi
@@ -95,8 +96,8 @@ before_script:
- faber -h
script:
- faber --with-boost-include=$HOME/Boost test.report cxx.name=$CXX cxxflags=$CXXFLAGS
#- if [ "$DOC" ]; then scons doc; else scons && scons test; fi
- faber --with-boost-include=$HOME/Boost --builddir=build test.report cxx.name=$CXX cxxflags=$CXXFLAGS
- if [ "$DOC" ]; then BOOST_ROOT=$HOME/Boost faber --builddir=build doc.html; fi
after_success:
# Upload docs only when building upstream.

83
doc/fabscript Normal file
View File

@@ -0,0 +1,83 @@
# -*- python -*-
#
# Copyright (c) 2016 Stefan Seefeld
# All rights reserved.
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
from faber.tools.xslt import xsltflags
from faber.tools.boost import quickbook, boostbook
from faber.artefacts import html
from glob import glob as G
from os import makedirs
from os.path import relpath, dirname, exists
from shutil import copyfile
def glob(pattern):
prefix = srcdir + '/'
p = len(prefix)+1
return [f[p:] for f in G(prefix + pattern)]
class make_html(action):
def __init__(self):
action.__init__(self, 'make_html', self.process)
def map(self, fs):
return boostbook.html.map(fs)
def process(self, target, source):
boostbook.html(target, source[0:1])
for s in source[1:]:
t = target[0]._filename + relpath(s._filename, srcdir)
d = dirname(t)
if not exists(d):
makedirs(d)
copyfile(s._filename, t)
sphinx_build = action('sphinx-build', 'sphinx-build -b html $(>) $(<)')
rst2html = action('rst2html', 'rst2html --trim-footnote-reference-space --footnote-references=superscript --stylesheet=$(>:D)/rst.css $(>) $(<)')
python_bbk = rule(quickbook.process, 'python.bbk', 'python.qbk',
dependencies=['release_notes.qbk',
'building.qbk',
'configuration.qbk',
'suport.qbk',
'faq.qbk',
'glossary.qbk'])
tutorial_bbk = rule(quickbook.process, 'tutorial.bbk', 'tutorial.qbk')
reference_bbk = rule(quickbook.process, 'reference.bbk', 'reference.qbk')
python_db = rule(boostbook.db, 'python.db', python_bbk)
tutorial_db = rule(boostbook.db, 'tutorial.db', tutorial_bbk)
reference_db = rule(boostbook.db, 'reference.db', reference_bbk)
python = html.dir(make_html(), 'html', [python_db, 'boostbook.css'] + glob('/images/*.*') + glob('/images/callouts/*.*'),
features=xsltflags('--stringparam generate.toc "library nop; chaper toc; section toc;"',
'--stringparam html.stylesheet boostbook.css',
'--stringparam boost.image.src images/bpl.png',
'--stringparam boost.graphics.root images/',
'--stringparam boost.defaults none',
'--param toc.max.depth 3',
'--param toc.section.depth 2',
'--param chunk.section.depth 1'))
tutorial = html.dir(boostbook.html, 'html/tutorial', tutorial_db, dependencies=[python],
features=xsltflags('--stringparam html.stylesheet ../boostbook.css',
'--stringparam boost.image.src ../images/bpl.png',
'--stringparam boost.graphics.root ../images/'))
reference = html.dir(boostbook.html, 'html/reference', reference_db, dependencies=[python],
features=xsltflags('--stringparam html.stylesheet ../boostbook.css',
'--stringparam boost.image.src ../images/bpl.png',
'--stringparam boost.graphics.root ../images/'))
numpy = rule(sphinx_build, 'html/numpy', 'numpy', attrs=always, dependencies=[python])
article = rule(rst2html, 'html/article.html', 'article.rst')
html = alias('html', [python, tutorial, reference, numpy, article])
default = html

View File

@@ -77,5 +77,6 @@ config = report('config', checks)
src = module('src', features=config.use)
test = module('test', features=config.use)
doc = module('doc', features=config.use)
default = src.default