From d4aee5a0efd23707c5ed7c448cdf13042c1bb2f1 Mon Sep 17 00:00:00 2001 From: Dave Johansen Date: Thu, 29 Dec 2016 22:14:32 -0700 Subject: [PATCH] Build documentation with sphinx and breathe from system --- fmt.spec | 9 +++--- fmt_build_doc_system.patch | 56 ++++++++++++++++++++++++++++++++++++++ fmt_build_github.patch | 11 -------- 3 files changed, 60 insertions(+), 16 deletions(-) create mode 100644 fmt_build_doc_system.patch delete mode 100644 fmt_build_github.patch diff --git a/fmt.spec b/fmt.spec index 1fe028d..fabc4ed 100644 --- a/fmt.spec +++ b/fmt.spec @@ -6,8 +6,8 @@ Summary: Small, safe and fast formatting library for C++ License: BSD URL: https://github.com/fmtlib/fmt Source0: https://github.com/fmtlib/fmt/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz -# See https://github.com/fmtlib/fmt/issues/443 -Patch0: fmt_build_github.patch +# See https://github.com/fmtlib/fmt/issues/443 and https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/LVKYLDLJVWAVJE4MQVKDO6PYZRD5MCP6/ +Patch0: fmt_build_doc_system.patch %if 0%{?rhel} BuildRequires: cmake3 @@ -16,10 +16,9 @@ BuildRequires: cmake %endif # For building documentation BuildRequires: doxygen -BuildRequires: git BuildRequires: nodejs-less -BuildRequires: python2-pip -BuildRequires: python2-virtualenv +BuildRequires: python2-sphinx +BuildRequires: python2-breathe %description C++ Format is an open-source formatting library for C++. It can be used as a diff --git a/fmt_build_doc_system.patch b/fmt_build_doc_system.patch new file mode 100644 index 0000000..581ff4b --- /dev/null +++ b/fmt_build_doc_system.patch @@ -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) diff --git a/fmt_build_github.patch b/fmt_build_github.patch deleted file mode 100644 index 4695718..0000000 --- a/fmt_build_github.patch +++ /dev/null @@ -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]) -