Re: [PATCH v3] nmbug: Translate to Python
[notmuch-archives.git] / 67 / c3a7986eb73fa13346b9e11b7bc34f8e038313
1 Return-Path: <bremner@tethera.net>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 4C1C2431FDE\r
6         for <notmuch@notmuchmail.org>; Wed, 12 Mar 2014 20:21:55 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id u1x7qiIwqXTP for <notmuch@notmuchmail.org>;\r
16         Wed, 12 Mar 2014 20:21:51 -0700 (PDT)\r
17 Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])\r
18         (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 68022431E64\r
21         for <notmuch@notmuchmail.org>; Wed, 12 Mar 2014 20:21:43 -0700 (PDT)\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
23         (envelope-from <bremner@tethera.net>)\r
24         id 1WNwDH-0000D0-0q; Thu, 13 Mar 2014 00:21:43 -0300\r
25 Received: (nullmailer pid 25681 invoked by uid 1000); Thu, 13 Mar 2014\r
26         03:21:29 -0000\r
27 From: David Bremner <david@tethera.net>\r
28 To: notmuch@notmuchmail.org\r
29 Subject: [Patch v3 3/4] doc: configure detection of sphinx and rst2man\r
30 Date: Thu, 13 Mar 2014 00:21:16 -0300\r
31 Message-Id: <1394680877-25572-4-git-send-email-david@tethera.net>\r
32 X-Mailer: git-send-email 1.8.5.3\r
33 In-Reply-To: <1394680877-25572-1-git-send-email-david@tethera.net>\r
34 References: <m238iozjmc.fsf@guru.guru-group.fi>\r
35         <1394680877-25572-1-git-send-email-david@tethera.net>\r
36 X-BeenThere: notmuch@notmuchmail.org\r
37 X-Mailman-Version: 2.1.13\r
38 Precedence: list\r
39 List-Id: "Use and development of the notmuch mail system."\r
40         <notmuch.notmuchmail.org>\r
41 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
42         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
43 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
44 List-Post: <mailto:notmuch@notmuchmail.org>\r
45 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
46 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
48 X-List-Received-Date: Thu, 13 Mar 2014 03:21:56 -0000\r
49 \r
50 Because sphinx-build does not provide a convenient way of listing\r
51 which builders exist, and some people actually have pre 1.0 sphinx, we\r
52 try loading a relevant python module.\r
53 \r
54 Currently the assumption is that no python in path -> no sphinx-build\r
55 in path.\r
56 ---\r
57  configure          | 25 +++++++++++++++++++++++++\r
58  doc/Makefile.local | 21 ++++++++++++++-------\r
59  2 files changed, 39 insertions(+), 7 deletions(-)\r
60 \r
61 diff --git a/configure b/configure\r
62 index 2eaed4a..fb276f1 100755\r
63 --- a/configure\r
64 +++ b/configure\r
65 @@ -393,6 +393,25 @@ else\r
66      have_emacs=0\r
67  fi\r
68  \r
69 +printf "Checking if sphinx is available and supports nroff output... "\r
70 +if hash sphinx-build > /dev/null 2>&1 && python -m sphinx.writers.manpage > /dev/null 2>&1 ; then\r
71 +    printf "Yes.\n"\r
72 +    have_sphinx=1\r
73 +    have_rst2man=0\r
74 +else\r
75 +    printf "No (falling back to rst2man).\n"\r
76 +    have_sphinx=0\r
77 +\r
78 +    printf "Checking if rst2man is available... "\r
79 +    if rst2man -V > /dev/null 2>&1; then\r
80 +       printf "Yes.\n"\r
81 +       have_rst2man=1\r
82 +    else\r
83 +       printf "No (so will not install man pages).\n"\r
84 +       have_rst2man=0\r
85 +    fi\r
86 +fi\r
87 +\r
88  libdir_in_ldconfig=0\r
89  \r
90  printf "Checking which platform we are on... "\r
91 @@ -759,6 +778,12 @@ emacsetcdir=${EMACSETCDIR}\r
92  # Whether there's an emacs binary available for byte-compiling\r
93  HAVE_EMACS = ${have_emacs}\r
94  \r
95 +# Whether there's a sphinx-build binary available for building documentation\r
96 +HAVE_SPHINX=${have_sphinx}\r
97 +\r
98 +# Whether there's a rst2man binary available for building documentation\r
99 +HAVE_RST2MAN=${have_rst2man}\r
100 +\r
101  # The directory to which desktop files should be installed\r
102  desktop_dir = \$(prefix)/share/applications\r
103  \r
104 diff --git a/doc/Makefile.local b/doc/Makefile.local\r
105 index fab6d48..9c31c24 100644\r
106 --- a/doc/Makefile.local\r
107 +++ b/doc/Makefile.local\r
108 @@ -33,11 +33,9 @@ sphinx-info: sphinx-texinfo\r
109  \r
110  MAN_GZIP_FILES := $(addsuffix .gz,${MAN_ROFF_FILES})\r
111  \r
112 -build-man: ${MAN_GZIP_FILES}\r
113 -\r
114 -${MAN_ROFF_FILES}: ${dir}/man.stamp\r
115 -\r
116 -$(dir)/man.stamp: ${MAN_RST_FILES}\r
117 +# Use the man page converter that is available. We should never depend\r
118 +# on MAN_ROFF_FILES if a converter is not available.\r
119 +${MAN_ROFF_FILES}: ${MAN_RST_FILES}\r
120  ifeq ($(HAVE_SPHINX),1)\r
121         $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(DOCBUILDDIR)/man\r
122         for section in 1 5 7; do \\r
123 @@ -46,11 +44,19 @@ ifeq ($(HAVE_SPHINX),1)\r
124         done\r
125  else ifeq ($(HAVE_RST2MAN),1)\r
126         $(prerst2man) $(DOCBUILDDIR)/.. $(DOCBUILDDIR)/man\r
127 -       touch $@\r
128  else\r
129 -       @echo "No sphinx or rst2man, will not install man pages."\r
130 +       @echo "Fatal: build dependency fail."\r
131 +       @false\r
132  endif\r
133  \r
134 +# Do not try to build or install man pages if a man page converter is\r
135 +# not available.\r
136 +ifeq ($(HAVE_SPHINX)$(HAVE_RST2MAN),00)\r
137 +build-man:\r
138 +install-man:\r
139 +       @echo "No sphinx or rst2man, will not install man pages."\r
140 +else\r
141 +build-man: ${MAN_GZIP_FILES}\r
142  install-man: ${MAN_GZIP_FILES}\r
143         mkdir -p "$(DESTDIR)$(mandir)/man1"\r
144         mkdir -p "$(DESTDIR)$(mandir)/man5"\r
145 @@ -59,6 +65,7 @@ install-man: ${MAN_GZIP_FILES}\r
146         install -m0644 $(DOCBUILDDIR)/man/man5/*.5.gz $(DESTDIR)/$(mandir)/man5\r
147         install -m0644 $(DOCBUILDDIR)/man/man7/*.7.gz $(DESTDIR)/$(mandir)/man7\r
148         cd $(DESTDIR)/$(mandir)/man1 && ln -sf notmuch.1.gz notmuch-setup.1.gz\r
149 +endif\r
150  \r
151  $(dir)/docdeps.mk: $(dir)/conf.py $(dir)/mkdocdeps.py\r
152         $(mkdocdeps) $< $(DOCBUILDDIR) $@\r
153 -- \r
154 1.8.5.3\r
155 \r