Build documentation with sphinx and breathe from system

This commit is contained in:
Dave Johansen 2016-12-29 22:14:32 -07:00
parent 508772ed60
commit d4aee5a0ef
3 changed files with 60 additions and 16 deletions

View File

@ -6,8 +6,8 @@ Summary: Small, safe and fast formatting library for C++
License: BSD License: BSD
URL: https://github.com/fmtlib/fmt URL: https://github.com/fmtlib/fmt
Source0: https://github.com/fmtlib/fmt/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz Source0: https://github.com/fmtlib/fmt/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
# See https://github.com/fmtlib/fmt/issues/443 # See https://github.com/fmtlib/fmt/issues/443 and https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/LVKYLDLJVWAVJE4MQVKDO6PYZRD5MCP6/
Patch0: fmt_build_github.patch Patch0: fmt_build_doc_system.patch
%if 0%{?rhel} %if 0%{?rhel}
BuildRequires: cmake3 BuildRequires: cmake3
@ -16,10 +16,9 @@ BuildRequires: cmake
%endif %endif
# For building documentation # For building documentation
BuildRequires: doxygen BuildRequires: doxygen
BuildRequires: git
BuildRequires: nodejs-less BuildRequires: nodejs-less
BuildRequires: python2-pip BuildRequires: python2-sphinx
BuildRequires: python2-virtualenv BuildRequires: python2-breathe
%description %description
C++ Format is an open-source formatting library for C++. It can be used as a C++ Format is an open-source formatting library for C++. It can be used as a

View File

@ -0,0 +1,56 @@
--- a/doc/build.py
+++ b/doc/build.py
@@ -4,53 +4,9 @@
from __future__ import print_function
import errno, os, shutil, sys, tempfile
from subprocess import check_call, check_output, CalledProcessError, Popen, PIPE
-from distutils.version import LooseVersion
-
-def pip_install(package, commit=None, **kwargs):
- "Install package using pip."
- if commit:
- check_version = kwargs.get('check_version', '')
- #output = check_output(['pip', 'show', package.split('/')[1]])
- #if check_version in output:
- # print('{} already installed'.format(package))
- # return
- package = 'git+git://github.com/{0}.git@{1}'.format(package, commit)
- print('Installing {}'.format(package))
- check_call(['pip', 'install', package])
def build_docs(version='dev'):
- # Create virtualenv.
doc_dir = os.path.dirname(os.path.realpath(__file__))
- virtualenv_dir = 'virtualenv'
- check_call(['virtualenv', virtualenv_dir])
- import sysconfig
- scripts_dir = os.path.basename(sysconfig.get_path('scripts'))
- activate_this_file = os.path.join(virtualenv_dir, scripts_dir,
- 'activate_this.py')
- with open(activate_this_file) as f:
- exec(f.read(), dict(__file__=activate_this_file))
- # Upgrade pip because installation of sphinx with pip 1.1 available on Travis
- # is broken (see #207) and it doesn't support the show command.
- from pkg_resources import get_distribution, DistributionNotFound
- pip_version = get_distribution('pip').version
- if LooseVersion(pip_version) < LooseVersion('1.5.4'):
- print("Updating pip")
- check_call(['pip', 'install', '--upgrade', 'pip'])
- # Upgrade distribute because installation of sphinx with distribute 0.6.24
- # available on Travis is broken (see #207).
- try:
- distribute_version = get_distribution('distribute').version
- if LooseVersion(distribute_version) <= LooseVersion('0.6.24'):
- print("Updating distribute")
- check_call(['pip', 'install', '--upgrade', 'distribute'])
- except DistributionNotFound:
- pass
- # Install Sphinx and Breathe.
- pip_install('sphinx-doc/sphinx',
- '12b83372ac9316e8cbe86e7fed889296a4cc29ee',
- check_version='1.4.1.dev20160525')
- pip_install('michaeljones/breathe',
- '1c9d7f80378a92cffa755084823a78bb38ee4acc')
# Build docs.
cmd = ['doxygen', '-']
p = Popen(cmd, stdin=PIPE)

View File

@ -1,11 +0,0 @@
--- a/doc/build.py
+++ b/doc/build.py
@@ -14,7 +14,7 @@
#if check_version in output:
# print('{} already installed'.format(package))
# return
- package = 'git+git://github.com/{0}.git@{1}'.format(package, commit)
+ package = 'git+https://github.com/{0}.git@{1}'.format(package, commit)
print('Installing {}'.format(package))
check_call(['pip', 'install', package])