[PATCH] doc: Allow rst2man.py as an alternative to rst2man

2015-01-03 Thread Tomi Ollila
On Sat, Jan 03 2015, "W. Trevor King"  wrote:

> On Sat, Jan 03, 2015 at 04:49:27PM +0100, David Bremner wrote:
>> At the risk of bike-shedding, rewrite the configure check to be more
>> "obvious". This is pretty subjective, but in particular I'm not a
>> big fan of resetting RST2MAN at the bottom of every iteration of the
>> for loop.  Also conform a bit more to the convention of using a
>> lower case variable in configure and assigning it in Makefile.
>
> I'm fine with all of these changes.

I am also -- and I'd prefer lower-case variables -- however the convention
of using lower case variables is not so clear here (or weren't until
David's ${python} path ;) -- we have mixup of upper & lower case variables
there, and otoh, other (auto)configure scripts seems to use *_RST2MAN.

But, instead of working this further we could also consider Jani's irc comment
of dropping rs2man support altogether... or just keep the status quo and
instruct users just install (recent enough) sphinx to their systems to get
man pages created...

Tomi

PS: In one Scientific Linux 6.2 system I build and run notmuch I have

  # Whether there's a sphinx-build binary available for building documentation
  HAVE_SPHINX=0

  # Whether there's a rst2man binary available for building documentation
  HAVE_RST2MAN=1

because sphinx-build is not recent enough -- sphinx-1.0-build would be but
as it cannot be used by default and as rst2man (w/o .py) works I have not 
bothered.
I'd presume anyone else using such an old system will have bigger problems
getting their notmuch compiled (recent enough zlib being one of those), so
this makes me wonder whether there is actually anyone needing rst2man there
(besides me, of course :)



[PATCH] doc: Allow rst2man.py as an alternative to rst2man

2015-01-03 Thread David Bremner
Tomi Ollila  writes:

> I'd presume anyone else using such an old system will have bigger
> problems getting their notmuch compiled (recent enough zlib being one
> of those), so this makes me wonder whether there is actually anyone
> needing rst2man there (besides me, of course :)

I guess the original reasoning was that rst2man was part of
python/docutils and so more likely to already be available.  

d


[PATCH] doc: Allow rst2man.py as an alternative to rst2man

2015-01-03 Thread David Bremner
From: "W. Trevor King" 

Gentoo's dev-python/docutils-0.10 installs Docutils scripts with a
*.py extension, so I have /usr/bin/rst2man.py and no rst2man script.
This patch supports users with both types of systems by checking for
rst2man, falling back on rst2man.py, and giving up only if neither is
found.  Users can also set the new RST2MAN path variable explicitly
when they call Make:

  make RST2MAN=/my/custom/rst_to_man_converter build-man

We pass the configured RST2MAN path through to prerst2man.py to use in
its system call.

We can use a non-empty RST2MAN to check for the availability of an
rst2man program, so there's no need for a separate HAVE_RST2MAN.
However, we keep the existing HAVE_RST2MAN for consistency with
HAVE_SPHINX.
---

At the risk of bike-shedding, rewrite the configure check to be more
"obvious". This is pretty subjective, but in particular I'm not a big
fan of resetting RST2MAN at the bottom of every iteration of the for
loop.  Also conform a bit more to the convention of using a lower case variable 
in configure and assigning it in Makefile.

For some reason it bugs me a bit to pass RST2MAN as an extra command line 
argument, but I guess taking some arguments by command line and some by 
environment variables would also be icky.

configure  | 23 ---
 doc/Makefile.local |  2 +-
 doc/prerst2man.py  |  9 +
 3 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/configure b/configure
index 137acea..fdf5bad 100755
--- a/configure
+++ b/configure
@@ -444,21 +444,27 @@ else
 fi

 printf "Checking if sphinx is available and supports nroff output... "
+have_sphinx=0
+have_rst2man=0
+
 if hash sphinx-build > /dev/null 2>&1 && ${python} -m sphinx.writers.manpage > 
/dev/null 2>&1 ; then
 printf "Yes.\n"
 have_sphinx=1
-have_rst2man=0
 else
 printf "No (falling back to rst2man).\n"
-have_sphinx=0

+rst2man=
 printf "Checking if rst2man is available... "
-if rst2man -V > /dev/null 2>&1; then
-   printf "Yes.\n"
-   have_rst2man=1
-else
+for name in rst2man rst2man.py; do
+   if "${name}" -V > /dev/null 2>&1; then
+   printf "Yes (${name}).\n"
+   have_rst2man=1
+   rst2man=$name
+   break
+   fi
+done
+if [ $have_rst2man -eq 0 ]; then
printf "No (so will not install man pages).\n"
-   have_rst2man=0
 fi
 fi

@@ -854,6 +860,9 @@ HAVE_RST2MAN=${have_rst2man}
 # Whether there's a doxygen binary available for building api documentation
 HAVE_DOXYGEN=${have_doxygen}

+# The path to the rst2man program for building documentation.
+RST2MAN = ${rst2man}
+
 # The directory to which desktop files should be installed
 desktop_dir = \$(prefix)/share/applications

diff --git a/doc/Makefile.local b/doc/Makefile.local
index e7d0bac..a13cb37 100644
--- a/doc/Makefile.local
+++ b/doc/Makefile.local
@@ -51,7 +51,7 @@ ifeq ($(HAVE_SPHINX),1)
mv $(DOCBUILDDIR)/man/*.$${section} 
$(DOCBUILDDIR)/man/man$${section}; \
done
 else ifeq ($(HAVE_RST2MAN),1)
-   $(prerst2man) $(srcdir)/doc $(DOCBUILDDIR)/man
+   $(prerst2man) "$(RST2MAN)" $(srcdir)/doc $(DOCBUILDDIR)/man
 else
@echo "Fatal: build dependency fail."
@false
diff --git a/doc/prerst2man.py b/doc/prerst2man.py
index 968722a..2e87976 100644
--- a/doc/prerst2man.py
+++ b/doc/prerst2man.py
@@ -4,8 +4,9 @@ from os.path import dirname, isdir
 from os import makedirs, system
 import re

-sourcedir = argv[1]
-outdir = argv[2]
+rst2man = argv[1]
+sourcedir = argv[2]
+outdir = argv[3]

 if not isdir(outdir):
 makedirs(outdir, 0o755)
@@ -60,5 +61,5 @@ for page in man_pages:
 outfile.write("".join(lines))
 outfile.close()

-system('set -x; rst2man {0} {1}/{2}.{3}'
-   .format(filename, outdir, page[0], page[4]))
+system('set -x; {0} {1} {2}/{3}.{4}'
+   .format(rst2man, filename, outdir, page[0], page[4]))
-- 
2.1.3



[PATCH] doc: Allow rst2man.py as an alternative to rst2man

2015-01-03 Thread Tomi Ollila
From: W. Trevor King 

Gentoo's dev-python/docutils-0.10 installs Docutils scripts with a
*.py extension, so I have /usr/bin/rst2man.py and no rst2man script.
This patch supports users with both types of systems by checking for
rst2man, falling back on rst2man.py, and giving up only if neither is
found.  Users can also set the new RST2MAN path variable explicitly
when they call Make:

  make RST2MAN=/my/custom/rst_to_man_converter build-man

We pass the configured RST2MAN path through to prerst2man.py to use in
its system call.

We can use a non-empty RST2MAN to check for the availability of an
rst2man program, so there's no need for a separate HAVE_RST2MAN.
However, we keep the existing HAVE_RST2MAN for consistency with
HAVE_SPHINX.
---

rebased original
id:2621721db05068dffb65b88cd50d2a5b49e967f5.1405220724.git.wking at tremily.us

rebased by simply doing patch -p1 < patchfile and then creating commit.


 configure  | 20 +++-
 doc/Makefile.local |  2 +-
 doc/prerst2man.py  |  9 +
 3 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index 9c98040c4531..8a4305f8bde3 100755
--- a/configure
+++ b/configure
@@ -455,17 +455,23 @@ if hash sphinx-build > /dev/null 2>&1 && python -m 
sphinx.writers.manpage > /dev
 printf "Yes.\n"
 have_sphinx=1
 have_rst2man=0
+RST2MAN=
 else
 printf "No (falling back to rst2man).\n"
 have_sphinx=0

 printf "Checking if rst2man is available... "
-if rst2man -V > /dev/null 2>&1; then
-   printf "Yes.\n"
-   have_rst2man=1
-else
-   printf "No (so will not install man pages).\n"
+for RST2MAN in rst2man rst2man.py; do
+   if "${RST2MAN}" -V > /dev/null 2>&1; then
+   have_rst2man=1
+   printf "Yes (${RST2MAN}).\n"
+   break
+   fi
+   RST2MAN=
+done
+if [ -z "${RST2MAN}" ]; then
have_rst2man=0
+   printf "No (so will not install man pages).\n"
 fi
 fi

@@ -861,6 +867,10 @@ HAVE_RST2MAN=${have_rst2man}
 # Whether there's a doxygen binary available for building api documentation
 HAVE_DOXYGEN=${have_doxygen}

+# The path to the rst2man program for building documentation.  Set to
+# an empty string if no such program is available.
+RST2MAN=${RST2MAN}
+
 # The directory to which desktop files should be installed
 desktop_dir = \$(prefix)/share/applications

diff --git a/doc/Makefile.local b/doc/Makefile.local
index e7d0bac8f3fb..a13cb3731664 100644
--- a/doc/Makefile.local
+++ b/doc/Makefile.local
@@ -51,7 +51,7 @@ ifeq ($(HAVE_SPHINX),1)
mv $(DOCBUILDDIR)/man/*.$${section} 
$(DOCBUILDDIR)/man/man$${section}; \
done
 else ifeq ($(HAVE_RST2MAN),1)
-   $(prerst2man) $(srcdir)/doc $(DOCBUILDDIR)/man
+   $(prerst2man) "$(RST2MAN)" $(srcdir)/doc $(DOCBUILDDIR)/man
 else
@echo "Fatal: build dependency fail."
@false
diff --git a/doc/prerst2man.py b/doc/prerst2man.py
index 968722a1c750..2e87976c5d96 100644
--- a/doc/prerst2man.py
+++ b/doc/prerst2man.py
@@ -4,8 +4,9 @@ from os.path import dirname, isdir
 from os import makedirs, system
 import re

-sourcedir = argv[1]
-outdir = argv[2]
+rst2man = argv[1]
+sourcedir = argv[2]
+outdir = argv[3]

 if not isdir(outdir):
 makedirs(outdir, 0o755)
@@ -60,5 +61,5 @@ for page in man_pages:
 outfile.write("".join(lines))
 outfile.close()

-system('set -x; rst2man {0} {1}/{2}.{3}'
-   .format(filename, outdir, page[0], page[4]))
+system('set -x; {0} {1} {2}/{3}.{4}'
+   .format(rst2man, filename, outdir, page[0], page[4]))
-- 
2.0.0



[PATCH] build: eliminate use of python execfile command

2015-01-03 Thread Tomi Ollila
On Sat, Jan 03 2015, David Bremner  wrote:

> As discussed in
> id:8cc9dd580ad672527e12f43706f9803b2c8e99d8.1405220724.git.wking at 
> tremily.us,
> execfile is unavailable in python3.
>
> The approach of this commit avoids modifying the python module path,
> which is arguably preferable since it avoids potentially accidentally 
> importing a module from the wrong place.

Looks good, tests pass -- you could amend the commit message by adding one lost 
newline.

Tomi



> ---
>  devel/release-checks.sh | 2 +-
>  doc/prerst2man.py   | 3 ++-
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/devel/release-checks.sh b/devel/release-checks.sh
> index 797d62a..ae02f55 100755
> --- a/devel/release-checks.sh
> +++ b/devel/release-checks.sh
> @@ -130,7 +130,7 @@ else
>  fi
>  
>  echo -n "Checking that python bindings version is $VERSION... "
> -py_version=`python -c "execfile('$PV_FILE'); print __VERSION__"`
> +py_version=`python -c "with open('$PV_FILE') as vf: exec(vf.read()); print 
> __VERSION__"`
>  if [ "$py_version" = "$VERSION" ]
>  then
>   echo Yes.
> diff --git a/doc/prerst2man.py b/doc/prerst2man.py
> index 437dea9..968722a 100644
> --- a/doc/prerst2man.py
> +++ b/doc/prerst2man.py
> @@ -10,7 +10,8 @@ outdir = argv[2]
>  if not isdir(outdir):
>  makedirs(outdir, 0o755)
>  
> -execfile(sourcedir + "/conf.py")
> +with open(sourcedir + "/conf.py") as cf:
> +exec(cf.read())
>  
>  
>  def header(file, startdocname, command, description, authors, section):
> -- 
> 2.1.3
>
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 2/2] completion: generate notmuch-completion.zsh using doc/conf.py

2015-01-03 Thread Tomi Ollila
On Sat, Jan 03 2015, David Bremner  wrote:

> David Bremner  writes:
>
>> I noticed that the (out of date) list of subcommands was simply
>> repeating the summary lines from the manpage. Since those summary
>> lines are already kept in machine readable form in doc/conf.py,
>> it's easy to compute that part of the completion file.
>
> I meant to annotate this, but lost a fight with git-send-email.  I'm not
> sure if the change to notmuch-completions.zsh is worth the trouble (how
> often will we add subcommands?), but the configuration change should
> probably go in anyway, at least one person already mentioned this in a
> bug report.

I agree that 2/2 may be left out (I rather skip checking it for now ;)

The changes in 1/2 looks good, but you could have included the new python
definition in line ~454 in (new) configure, which originally is:

if hash sphinx-build > /dev/null 2>&1 && python -m sphinx.writers.manpage 
>/dev/null 2>&1 ; then

(actually, this could be like:

if command -v sphinx-build >/dev/null && "$python" -m 
sphinx.writers.manpage >/dev/null 2>&1 ; then

(add that 2>&1 to be consistent with other code, I did not include it
as I think it is wrong to do so ;))


Tomi


BUG: Using pointer that points to a destructed string's content

2015-01-03 Thread David Bremner
Tamas Szakaly  writes:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Dear notmuch developers,
>
> The following line is from _notmuch_message_add_directory_terms in
> lib/message.cc (line 652 in HEAD):
>
> direntry = (*i).c_str ();
>

This should be fixed in commit 3d978a0d

d


[PATCH 2/2] completion: generate notmuch-completion.zsh using doc/conf.py

2015-01-03 Thread David Bremner
David Bremner  writes:

> I noticed that the (out of date) list of subcommands was simply
> repeating the summary lines from the manpage. Since those summary
> lines are already kept in machine readable form in doc/conf.py,
> it's easy to compute that part of the completion file.

I meant to annotate this, but lost a fight with git-send-email.  I'm not
sure if the change to notmuch-completions.zsh is worth the trouble (how
often will we add subcommands?), but the configuration change should
probably go in anyway, at least one person already mentioned this in a
bug report.


[PATCH] build: eliminate use of python execfile command

2015-01-03 Thread David Bremner
As discussed in
id:8cc9dd580ad672527e12f43706f9803b2c8e99d8.1405220724.git.wking at tremily.us,
execfile is unavailable in python3.

The approach of this commit avoids modifying the python module path,
which is arguably preferable since it avoids potentially accidentally importing 
a module from the wrong place.
---
 devel/release-checks.sh | 2 +-
 doc/prerst2man.py   | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/devel/release-checks.sh b/devel/release-checks.sh
index 797d62a..ae02f55 100755
--- a/devel/release-checks.sh
+++ b/devel/release-checks.sh
@@ -130,7 +130,7 @@ else
 fi

 echo -n "Checking that python bindings version is $VERSION... "
-py_version=`python -c "execfile('$PV_FILE'); print __VERSION__"`
+py_version=`python -c "with open('$PV_FILE') as vf: exec(vf.read()); print 
__VERSION__"`
 if [ "$py_version" = "$VERSION" ]
 then
echo Yes.
diff --git a/doc/prerst2man.py b/doc/prerst2man.py
index 437dea9..968722a 100644
--- a/doc/prerst2man.py
+++ b/doc/prerst2man.py
@@ -10,7 +10,8 @@ outdir = argv[2]
 if not isdir(outdir):
 makedirs(outdir, 0o755)

-execfile(sourcedir + "/conf.py")
+with open(sourcedir + "/conf.py") as cf:
+exec(cf.read())


 def header(file, startdocname, command, description, authors, section):
-- 
2.1.3



[PATCH 2/2] completion: generate notmuch-completion.zsh using doc/conf.py

2015-01-03 Thread David Bremner
I noticed that the (out of date) list of subcommands was simply
repeating the summary lines from the manpage. Since those summary
lines are already kept in machine readable form in doc/conf.py,
it's easy to compute that part of the completion file.
---
 completion/Makefile.local |  12 -
 completion/gen-zsh-completion.py  | 108 ++
 completion/notmuch-completion.zsh |  96 -
 3 files changed, 119 insertions(+), 97 deletions(-)
 create mode 100644 completion/gen-zsh-completion.py
 delete mode 100644 completion/notmuch-completion.zsh

diff --git a/completion/Makefile.local b/completion/Makefile.local
index dfc1271..616afa4 100644
--- a/completion/Makefile.local
+++ b/completion/Makefile.local
@@ -6,7 +6,15 @@ dir := completion
 # directly in any shell commands. Instead we save its value in other,
 # private variables that we can use in the commands.
 bash_script := $(srcdir)/$(dir)/notmuch-completion.bash
-zsh_script := $(srcdir)/$(dir)/notmuch-completion.zsh
+gen_zsh_script := $(srcdir)/$(dir)/gen-zsh-completion.py
+conf_file := $(srcdir)/$(dir)/../doc/conf.py
+
+$(dir)/notmuch-completion.zsh: $(dir)/gen-zsh-completion.py
+   $(PYTHON) $(gen_zsh_script)  $(conf_file) > $@
+
+ifeq ($(WITH_ZSH),1)
+all: $(dir)/notmuch-completion.zsh
+endif

 install: install-$(dir)

@@ -20,3 +28,5 @@ ifeq ($(WITH_ZSH),1)
mkdir -p "$(DESTDIR)$(zsh_completion_dir)"
install -m0644 $(zsh_script) "$(DESTDIR)$(zsh_completion_dir)/_notmuch"
 endif
+
+CLEAN += $(dir)/notmuch-completion.zsh
diff --git a/completion/gen-zsh-completion.py b/completion/gen-zsh-completion.py
new file mode 100644
index 000..26cd13e
--- /dev/null
+++ b/completion/gen-zsh-completion.py
@@ -0,0 +1,108 @@
+# Copyright 2014 David Bremner 
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see http://www.gnu.org/licenses/ .
+#
+# This script is based on notmuch-completion.zsh, by
+#   Ingmar Vanhassel 
+
+from sys import argv
+
+conffile = argv[1]
+
+with open(conffile) as cf:
+exec(cf.read())
+
+print(r'''#compdef notmuch
+
+# This file was generated from gen-zsh-completion.py in the notmuch source.
+# You should probably not edit it directly
+_notmuch_commands()
+{
+  local -a notmuch_commands
+  notmuch_commands=(
+'help:display documentation for a subcommand'
+'setup:interactively configure notmuch'
+''')
+
+for command in man_pages:
+parts=command[1].split('-')
+if len(parts) == 1 or command[4] != 1:
+continue
+print ('\'{0:s}:{1:s}\''.format(parts[1],command[2]))
+
+print (
+r'''  )
+
+  _describe -t command 'command' notmuch_commands
+}
+
+_notmuch_dump()
+{
+  _files
+}
+
+_notmuch_help_topics()
+{
+  local -a notmuch_help_topics
+  notmuch_help_topics=(
+'search-terms:show common search-terms syntax'
+  )
+  _describe -t notmuch-help-topics 'topic' notmuch_help_topics
+}
+
+_notmuch_help()
+{
+  _alternative \
+_notmuch_commands \
+_notmuch_help_topics
+}
+
+_notmuch_restore()
+{
+  _files
+}
+
+_notmuch_search()
+{
+  _arguments -s : \
+'--max-threads=[display only the first x threads from the search 
results]:number of threads to show: ' \
+'--first=[omit the first x threads from the search results]:number of 
threads to omit: ' \
+'--sort=[sort results]:sorting:((newest-first\:"reverse chronological 
order" oldest-first\:"chronological order"))' \
+'--output=[select what to output]:output:((summary threads messages files 
tags))'
+}
+
+_notmuch_address()
+{
+  _arguments -s : \
+'--sort=[sort results]:sorting:((newest-first\:"reverse chronological 
order" oldest-first\:"chronological order"))' \
+'--output=[select what to output]:output:((sender recipients count))'
+}
+
+_notmuch()
+{
+  if (( CURRENT > 2 )) ; then
+local cmd=${words[2]}
+curcontext="${curcontext%:*:*}:notmuch-$cmd"
+(( CURRENT-- ))
+shift words
+_call_function ret _notmuch_$cmd
+return ret
+  else
+_notmuch_commands
+  fi
+}
+
+_notmuch "$@"
+
+''')
diff --git a/completion/notmuch-completion.zsh 
b/completion/notmuch-completion.zsh
deleted file mode 100644
index 46b33d1..000
--- a/completion/notmuch-completion.zsh
+++ /dev/null
@@ -1,96 +0,0 @@
-#compdef notmuch
-
-# ZSH completion for `notmuch`
-# Copyright ? 2009 Ingmar Vanhassel 
-#
-# This program is free software: you can redistribute it and/or modify
-# it under 

[PATCH 1/2] configure: add check for python interepreter name

2015-01-03 Thread David Bremner
Currently we hardcode "python" in several places. This makes things
hard for people who have only commands called python3 and/or
python2. We also add the name to sh.config to eventually replace the
current workaround in the test suite.
---
 configure | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/configure b/configure
index d14e7d1..5a02de4 100755
--- a/configure
+++ b/configure
@@ -374,6 +374,23 @@ else
 errors=$((errors + 1))
 fi

+printf "Checking for python... "
+have_python=0
+
+for name in python python2 python3; do
+if command -v $name > /dev/null 2>&1; then
+   have_python=1
+   python=$name
+   printf "Yes: $name.\n"
+   break
+fi
+done
+
+if [ $have_python -eq 0 ]; then
+printf "No.\n"
+errors=$((errors + 1))
+fi
+
 printf "Checking for valgrind development files... "
 if pkg-config --exists valgrind; then
 printf "Yes.\n"
@@ -522,6 +539,9 @@ need to install the following packages before being able to 
compile
 notmuch:

 EOF
+if [ $have_python -eq 0 ]; then
+   echo "  python interpreter"
+fi
 if [ $have_xapian -eq 0 ]; then
echo "  Xapian library (including development files such as headers)"
echo "  http://xapian.org/;
@@ -787,6 +807,9 @@ WARN_CXXFLAGS=${WARN_CXXFLAGS}
 # Flags to enable warnings when using the C compiler
 WARN_CFLAGS=${WARN_CFLAGS}

+# Name of python interpreter
+PYTHON = ${python}
+
 # The prefix to which notmuch should be installed
 # Note: If you change this value here, be sure to ensure that the
 # LIBDIR_IN_LDCONFIG value below is still set correctly.
@@ -958,6 +981,9 @@ NOTMUCH_HAVE_XAPIAN_COMPACT=${have_xapian_compact}
 # Whether there's either sphinx or rst2man available for building
 # documentation
 NOTMUCH_HAVE_MAN=$((have_sphinx || have_rst2man))
+
+# Name of python interpreter
+NOTMUCH_PYTHON=${python}
 EOF

 # Finally, after everything configured, inform the user how to continue.
-- 
2.1.3



[PATCH] doc: Allow rst2man.py as an alternative to rst2man

2015-01-03 Thread W. Trevor King
On Sat, Jan 03, 2015 at 07:12:13PM +0200, Tomi Ollila wrote:
> ? so this makes me wonder whether there is actually anyone needing
> rst2man there?

Requiring Sphinx >= 1.0 (2010-07-23 [1]) to build man pages is fine
with me.

Cheers,
Trevor

[1]: https://pypi.python.org/pypi/Sphinx/1.0

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20150103/a9333c23/attachment.pgp>


[PATCH] lib: convert two "iterator copy strings" into references.

2015-01-03 Thread David Bremner
David Bremner  writes:

> Apparently this is a supported and even idiomatic way of keeping a
> temporary object (e.g. like that returned from an operator
> dereference) alive.

pushed.

d


[PATCH] completion: remove the broken notmuch-completion.tcsh

2015-01-03 Thread David Bremner
Jani Nikula  writes:

> The tcsh completion is minimal yet doesn't work at all. We're better
> off without it, it's more embarrassing than useful.

pushed

d


[PATCH] doc: Allow rst2man.py as an alternative to rst2man

2015-01-03 Thread W. Trevor King
On Sat, Jan 03, 2015 at 04:49:27PM +0100, David Bremner wrote:
> At the risk of bike-shedding, rewrite the configure check to be more
> "obvious". This is pretty subjective, but in particular I'm not a
> big fan of resetting RST2MAN at the bottom of every iteration of the
> for loop.  Also conform a bit more to the convention of using a
> lower case variable in configure and assigning it in Makefile.

I'm fine with all of these changes.

> @@ -854,6 +860,9 @@ HAVE_RST2MAN=${have_rst2man}
>  # Whether there's a doxygen binary available for building api documentation
>  HAVE_DOXYGEN=${have_doxygen}
>  
> +# The path to the rst2man program for building documentation.
> +RST2MAN = ${rst2man}
> +
>  # The directory to which desktop files should be installed
>  desktop_dir = \$(prefix)/share/applications
>  

I'd keep the RST2MAN entry right after HAVE_RST2MAN, instead of having
HAVE_DOXYGEN between them.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20150103/99d1a698/attachment.pgp>


[PATCH 1/2] configure: add check for python interepreter name

2015-01-03 Thread David Bremner
Currently we hardcode python in several places. This makes things
hard for people who have only commands called python3 and/or
python2. We also add the name to sh.config to eventually replace the
current workaround in the test suite.
---
 configure | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/configure b/configure
index d14e7d1..5a02de4 100755
--- a/configure
+++ b/configure
@@ -374,6 +374,23 @@ else
 errors=$((errors + 1))
 fi
 
+printf Checking for python... 
+have_python=0
+
+for name in python python2 python3; do
+if command -v $name  /dev/null 21; then
+   have_python=1
+   python=$name
+   printf Yes: $name.\n
+   break
+fi
+done
+
+if [ $have_python -eq 0 ]; then
+printf No.\n
+errors=$((errors + 1))
+fi
+
 printf Checking for valgrind development files... 
 if pkg-config --exists valgrind; then
 printf Yes.\n
@@ -522,6 +539,9 @@ need to install the following packages before being able to 
compile
 notmuch:
 
 EOF
+if [ $have_python -eq 0 ]; then
+   echo   python interpreter
+fi
 if [ $have_xapian -eq 0 ]; then
echo   Xapian library (including development files such as headers)
echo   http://xapian.org/;
@@ -787,6 +807,9 @@ WARN_CXXFLAGS=${WARN_CXXFLAGS}
 # Flags to enable warnings when using the C compiler
 WARN_CFLAGS=${WARN_CFLAGS}
 
+# Name of python interpreter
+PYTHON = ${python}
+
 # The prefix to which notmuch should be installed
 # Note: If you change this value here, be sure to ensure that the
 # LIBDIR_IN_LDCONFIG value below is still set correctly.
@@ -958,6 +981,9 @@ NOTMUCH_HAVE_XAPIAN_COMPACT=${have_xapian_compact}
 # Whether there's either sphinx or rst2man available for building
 # documentation
 NOTMUCH_HAVE_MAN=$((have_sphinx || have_rst2man))
+
+# Name of python interpreter
+NOTMUCH_PYTHON=${python}
 EOF
 
 # Finally, after everything configured, inform the user how to continue.
-- 
2.1.3

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 2/2] completion: generate notmuch-completion.zsh using doc/conf.py

2015-01-03 Thread David Bremner
I noticed that the (out of date) list of subcommands was simply
repeating the summary lines from the manpage. Since those summary
lines are already kept in machine readable form in doc/conf.py,
it's easy to compute that part of the completion file.
---
 completion/Makefile.local |  12 -
 completion/gen-zsh-completion.py  | 108 ++
 completion/notmuch-completion.zsh |  96 -
 3 files changed, 119 insertions(+), 97 deletions(-)
 create mode 100644 completion/gen-zsh-completion.py
 delete mode 100644 completion/notmuch-completion.zsh

diff --git a/completion/Makefile.local b/completion/Makefile.local
index dfc1271..616afa4 100644
--- a/completion/Makefile.local
+++ b/completion/Makefile.local
@@ -6,7 +6,15 @@ dir := completion
 # directly in any shell commands. Instead we save its value in other,
 # private variables that we can use in the commands.
 bash_script := $(srcdir)/$(dir)/notmuch-completion.bash
-zsh_script := $(srcdir)/$(dir)/notmuch-completion.zsh
+gen_zsh_script := $(srcdir)/$(dir)/gen-zsh-completion.py
+conf_file := $(srcdir)/$(dir)/../doc/conf.py
+
+$(dir)/notmuch-completion.zsh: $(dir)/gen-zsh-completion.py
+   $(PYTHON) $(gen_zsh_script)  $(conf_file)  $@
+
+ifeq ($(WITH_ZSH),1)
+all: $(dir)/notmuch-completion.zsh
+endif
 
 install: install-$(dir)
 
@@ -20,3 +28,5 @@ ifeq ($(WITH_ZSH),1)
mkdir -p $(DESTDIR)$(zsh_completion_dir)
install -m0644 $(zsh_script) $(DESTDIR)$(zsh_completion_dir)/_notmuch
 endif
+
+CLEAN += $(dir)/notmuch-completion.zsh
diff --git a/completion/gen-zsh-completion.py b/completion/gen-zsh-completion.py
new file mode 100644
index 000..26cd13e
--- /dev/null
+++ b/completion/gen-zsh-completion.py
@@ -0,0 +1,108 @@
+# Copyright 2014 David Bremner da...@tethera.net
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see http://www.gnu.org/licenses/ .
+#
+# This script is based on notmuch-completion.zsh, by
+#   Ingmar Vanhassel ing...@exherbo.org
+
+from sys import argv
+
+conffile = argv[1]
+
+with open(conffile) as cf:
+exec(cf.read())
+
+print(r'''#compdef notmuch
+
+# This file was generated from gen-zsh-completion.py in the notmuch source.
+# You should probably not edit it directly
+_notmuch_commands()
+{
+  local -a notmuch_commands
+  notmuch_commands=(
+'help:display documentation for a subcommand'
+'setup:interactively configure notmuch'
+''')
+
+for command in man_pages:
+parts=command[1].split('-')
+if len(parts) == 1 or command[4] != 1:
+continue
+print ('\'{0:s}:{1:s}\''.format(parts[1],command[2]))
+
+print (
+r'''  )
+
+  _describe -t command 'command' notmuch_commands
+}
+
+_notmuch_dump()
+{
+  _files
+}
+
+_notmuch_help_topics()
+{
+  local -a notmuch_help_topics
+  notmuch_help_topics=(
+'search-terms:show common search-terms syntax'
+  )
+  _describe -t notmuch-help-topics 'topic' notmuch_help_topics
+}
+
+_notmuch_help()
+{
+  _alternative \
+_notmuch_commands \
+_notmuch_help_topics
+}
+
+_notmuch_restore()
+{
+  _files
+}
+
+_notmuch_search()
+{
+  _arguments -s : \
+'--max-threads=[display only the first x threads from the search 
results]:number of threads to show: ' \
+'--first=[omit the first x threads from the search results]:number of 
threads to omit: ' \
+'--sort=[sort results]:sorting:((newest-first\:reverse chronological 
order oldest-first\:chronological order))' \
+'--output=[select what to output]:output:((summary threads messages files 
tags))'
+}
+
+_notmuch_address()
+{
+  _arguments -s : \
+'--sort=[sort results]:sorting:((newest-first\:reverse chronological 
order oldest-first\:chronological order))' \
+'--output=[select what to output]:output:((sender recipients count))'
+}
+
+_notmuch()
+{
+  if (( CURRENT  2 )) ; then
+local cmd=${words[2]}
+curcontext=${curcontext%:*:*}:notmuch-$cmd
+(( CURRENT-- ))
+shift words
+_call_function ret _notmuch_$cmd
+return ret
+  else
+_notmuch_commands
+  fi
+}
+
+_notmuch $@
+
+''')
diff --git a/completion/notmuch-completion.zsh 
b/completion/notmuch-completion.zsh
deleted file mode 100644
index 46b33d1..000
--- a/completion/notmuch-completion.zsh
+++ /dev/null
@@ -1,96 +0,0 @@
-#compdef notmuch
-
-# ZSH completion for `notmuch`
-# Copyright © 2009 Ingmar Vanhassel ing...@exherbo.org
-#
-# This program is free software: you can 

[PATCH] doc: Allow rst2man.py as an alternative to rst2man

2015-01-03 Thread Tomi Ollila
From: W. Trevor King wk...@tremily.us

Gentoo's dev-python/docutils-0.10 installs Docutils scripts with a
*.py extension, so I have /usr/bin/rst2man.py and no rst2man script.
This patch supports users with both types of systems by checking for
rst2man, falling back on rst2man.py, and giving up only if neither is
found.  Users can also set the new RST2MAN path variable explicitly
when they call Make:

  make RST2MAN=/my/custom/rst_to_man_converter build-man

We pass the configured RST2MAN path through to prerst2man.py to use in
its system call.

We can use a non-empty RST2MAN to check for the availability of an
rst2man program, so there's no need for a separate HAVE_RST2MAN.
However, we keep the existing HAVE_RST2MAN for consistency with
HAVE_SPHINX.
---

rebased original
id:2621721db05068dffb65b88cd50d2a5b49e967f5.1405220724.git.wk...@tremily.us

rebased by simply doing patch -p1  patchfile and then creating commit.


 configure  | 20 +++-
 doc/Makefile.local |  2 +-
 doc/prerst2man.py  |  9 +
 3 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index 9c98040c4531..8a4305f8bde3 100755
--- a/configure
+++ b/configure
@@ -455,17 +455,23 @@ if hash sphinx-build  /dev/null 21  python -m 
sphinx.writers.manpage  /dev
 printf Yes.\n
 have_sphinx=1
 have_rst2man=0
+RST2MAN=
 else
 printf No (falling back to rst2man).\n
 have_sphinx=0
 
 printf Checking if rst2man is available... 
-if rst2man -V  /dev/null 21; then
-   printf Yes.\n
-   have_rst2man=1
-else
-   printf No (so will not install man pages).\n
+for RST2MAN in rst2man rst2man.py; do
+   if ${RST2MAN} -V  /dev/null 21; then
+   have_rst2man=1
+   printf Yes (${RST2MAN}).\n
+   break
+   fi
+   RST2MAN=
+done
+if [ -z ${RST2MAN} ]; then
have_rst2man=0
+   printf No (so will not install man pages).\n
 fi
 fi
 
@@ -861,6 +867,10 @@ HAVE_RST2MAN=${have_rst2man}
 # Whether there's a doxygen binary available for building api documentation
 HAVE_DOXYGEN=${have_doxygen}
 
+# The path to the rst2man program for building documentation.  Set to
+# an empty string if no such program is available.
+RST2MAN=${RST2MAN}
+
 # The directory to which desktop files should be installed
 desktop_dir = \$(prefix)/share/applications
 
diff --git a/doc/Makefile.local b/doc/Makefile.local
index e7d0bac8f3fb..a13cb3731664 100644
--- a/doc/Makefile.local
+++ b/doc/Makefile.local
@@ -51,7 +51,7 @@ ifeq ($(HAVE_SPHINX),1)
mv $(DOCBUILDDIR)/man/*.$${section} 
$(DOCBUILDDIR)/man/man$${section}; \
done
 else ifeq ($(HAVE_RST2MAN),1)
-   $(prerst2man) $(srcdir)/doc $(DOCBUILDDIR)/man
+   $(prerst2man) $(RST2MAN) $(srcdir)/doc $(DOCBUILDDIR)/man
 else
@echo Fatal: build dependency fail.
@false
diff --git a/doc/prerst2man.py b/doc/prerst2man.py
index 968722a1c750..2e87976c5d96 100644
--- a/doc/prerst2man.py
+++ b/doc/prerst2man.py
@@ -4,8 +4,9 @@ from os.path import dirname, isdir
 from os import makedirs, system
 import re
 
-sourcedir = argv[1]
-outdir = argv[2]
+rst2man = argv[1]
+sourcedir = argv[2]
+outdir = argv[3]
 
 if not isdir(outdir):
 makedirs(outdir, 0o755)
@@ -60,5 +61,5 @@ for page in man_pages:
 outfile.write(.join(lines))
 outfile.close()
 
-system('set -x; rst2man {0} {1}/{2}.{3}'
-   .format(filename, outdir, page[0], page[4]))
+system('set -x; {0} {1} {2}/{3}.{4}'
+   .format(rst2man, filename, outdir, page[0], page[4]))
-- 
2.0.0

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] build: eliminate use of python execfile command

2015-01-03 Thread Tomi Ollila
On Sat, Jan 03 2015, David Bremner da...@tethera.net wrote:

 As discussed in
 id:8cc9dd580ad672527e12f43706f9803b2c8e99d8.1405220724.git.wk...@tremily.us,
 execfile is unavailable in python3.

 The approach of this commit avoids modifying the python module path,
 which is arguably preferable since it avoids potentially accidentally 
 importing a module from the wrong place.

Looks good, tests pass -- you could amend the commit message by adding one lost 
newline.

Tomi



 ---
  devel/release-checks.sh | 2 +-
  doc/prerst2man.py   | 3 ++-
  2 files changed, 3 insertions(+), 2 deletions(-)

 diff --git a/devel/release-checks.sh b/devel/release-checks.sh
 index 797d62a..ae02f55 100755
 --- a/devel/release-checks.sh
 +++ b/devel/release-checks.sh
 @@ -130,7 +130,7 @@ else
  fi
  
  echo -n Checking that python bindings version is $VERSION... 
 -py_version=`python -c execfile('$PV_FILE'); print __VERSION__`
 +py_version=`python -c with open('$PV_FILE') as vf: exec(vf.read()); print 
 __VERSION__`
  if [ $py_version = $VERSION ]
  then
   echo Yes.
 diff --git a/doc/prerst2man.py b/doc/prerst2man.py
 index 437dea9..968722a 100644
 --- a/doc/prerst2man.py
 +++ b/doc/prerst2man.py
 @@ -10,7 +10,8 @@ outdir = argv[2]
  if not isdir(outdir):
  makedirs(outdir, 0o755)
  
 -execfile(sourcedir + /conf.py)
 +with open(sourcedir + /conf.py) as cf:
 +exec(cf.read())
  
  
  def header(file, startdocname, command, description, authors, section):
 -- 
 2.1.3

 ___
 notmuch mailing list
 notmuch@notmuchmail.org
 http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 2/2] completion: generate notmuch-completion.zsh using doc/conf.py

2015-01-03 Thread Tomi Ollila
On Sat, Jan 03 2015, David Bremner da...@tethera.net wrote:

 David Bremner da...@tethera.net writes:

 I noticed that the (out of date) list of subcommands was simply
 repeating the summary lines from the manpage. Since those summary
 lines are already kept in machine readable form in doc/conf.py,
 it's easy to compute that part of the completion file.

 I meant to annotate this, but lost a fight with git-send-email.  I'm not
 sure if the change to notmuch-completions.zsh is worth the trouble (how
 often will we add subcommands?), but the configuration change should
 probably go in anyway, at least one person already mentioned this in a
 bug report.

I agree that 2/2 may be left out (I rather skip checking it for now ;)

The changes in 1/2 looks good, but you could have included the new python
definition in line ~454 in (new) configure, which originally is:

if hash sphinx-build  /dev/null 21  python -m sphinx.writers.manpage 
/dev/null 21 ; then

(actually, this could be like:

if command -v sphinx-build /dev/null  $python -m 
sphinx.writers.manpage /dev/null 21 ; then

(add that 21 to be consistent with other code, I did not include it
as I think it is wrong to do so ;))


Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] build: eliminate use of python execfile command

2015-01-03 Thread David Bremner
As discussed in
id:8cc9dd580ad672527e12f43706f9803b2c8e99d8.1405220724.git.wk...@tremily.us,
execfile is unavailable in python3.

The approach of this commit avoids modifying the python module path,
which is arguably preferable since it avoids potentially accidentally importing 
a module from the wrong place.
---
 devel/release-checks.sh | 2 +-
 doc/prerst2man.py   | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/devel/release-checks.sh b/devel/release-checks.sh
index 797d62a..ae02f55 100755
--- a/devel/release-checks.sh
+++ b/devel/release-checks.sh
@@ -130,7 +130,7 @@ else
 fi
 
 echo -n Checking that python bindings version is $VERSION... 
-py_version=`python -c execfile('$PV_FILE'); print __VERSION__`
+py_version=`python -c with open('$PV_FILE') as vf: exec(vf.read()); print 
__VERSION__`
 if [ $py_version = $VERSION ]
 then
echo Yes.
diff --git a/doc/prerst2man.py b/doc/prerst2man.py
index 437dea9..968722a 100644
--- a/doc/prerst2man.py
+++ b/doc/prerst2man.py
@@ -10,7 +10,8 @@ outdir = argv[2]
 if not isdir(outdir):
 makedirs(outdir, 0o755)
 
-execfile(sourcedir + /conf.py)
+with open(sourcedir + /conf.py) as cf:
+exec(cf.read())
 
 
 def header(file, startdocname, command, description, authors, section):
-- 
2.1.3

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 2/2] completion: generate notmuch-completion.zsh using doc/conf.py

2015-01-03 Thread David Bremner
David Bremner da...@tethera.net writes:

 I noticed that the (out of date) list of subcommands was simply
 repeating the summary lines from the manpage. Since those summary
 lines are already kept in machine readable form in doc/conf.py,
 it's easy to compute that part of the completion file.

I meant to annotate this, but lost a fight with git-send-email.  I'm not
sure if the change to notmuch-completions.zsh is worth the trouble (how
often will we add subcommands?), but the configuration change should
probably go in anyway, at least one person already mentioned this in a
bug report.
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: BUG: Using pointer that points to a destructed string's content

2015-01-03 Thread David Bremner
Tamas Szakaly sghct...@gmail.com writes:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Dear notmuch developers,

 The following line is from _notmuch_message_add_directory_terms in
 lib/message.cc (line 652 in HEAD):

 direntry = (*i).c_str ();


This should be fixed in commit 3d978a0d

d
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] lib: convert two iterator copy strings into references.

2015-01-03 Thread David Bremner
David Bremner da...@tethera.net writes:

 Apparently this is a supported and even idiomatic way of keeping a
 temporary object (e.g. like that returned from an operator
 dereference) alive.

pushed.

d
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] completion: remove the broken notmuch-completion.tcsh

2015-01-03 Thread David Bremner
Jani Nikula j...@nikula.org writes:

 The tcsh completion is minimal yet doesn't work at all. We're better
 off without it, it's more embarrassing than useful.

pushed

d
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] doc: Allow rst2man.py as an alternative to rst2man

2015-01-03 Thread David Bremner
From: W. Trevor King wk...@tremily.us

Gentoo's dev-python/docutils-0.10 installs Docutils scripts with a
*.py extension, so I have /usr/bin/rst2man.py and no rst2man script.
This patch supports users with both types of systems by checking for
rst2man, falling back on rst2man.py, and giving up only if neither is
found.  Users can also set the new RST2MAN path variable explicitly
when they call Make:

  make RST2MAN=/my/custom/rst_to_man_converter build-man

We pass the configured RST2MAN path through to prerst2man.py to use in
its system call.

We can use a non-empty RST2MAN to check for the availability of an
rst2man program, so there's no need for a separate HAVE_RST2MAN.
However, we keep the existing HAVE_RST2MAN for consistency with
HAVE_SPHINX.
---

At the risk of bike-shedding, rewrite the configure check to be more
obvious. This is pretty subjective, but in particular I'm not a big
fan of resetting RST2MAN at the bottom of every iteration of the for
loop.  Also conform a bit more to the convention of using a lower case variable 
in configure and assigning it in Makefile.

For some reason it bugs me a bit to pass RST2MAN as an extra command line 
argument, but I guess taking some arguments by command line and some by 
environment variables would also be icky.

configure  | 23 ---
 doc/Makefile.local |  2 +-
 doc/prerst2man.py  |  9 +
 3 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/configure b/configure
index 137acea..fdf5bad 100755
--- a/configure
+++ b/configure
@@ -444,21 +444,27 @@ else
 fi
 
 printf Checking if sphinx is available and supports nroff output... 
+have_sphinx=0
+have_rst2man=0
+
 if hash sphinx-build  /dev/null 21  ${python} -m sphinx.writers.manpage  
/dev/null 21 ; then
 printf Yes.\n
 have_sphinx=1
-have_rst2man=0
 else
 printf No (falling back to rst2man).\n
-have_sphinx=0
 
+rst2man=
 printf Checking if rst2man is available... 
-if rst2man -V  /dev/null 21; then
-   printf Yes.\n
-   have_rst2man=1
-else
+for name in rst2man rst2man.py; do
+   if ${name} -V  /dev/null 21; then
+   printf Yes (${name}).\n
+   have_rst2man=1
+   rst2man=$name
+   break
+   fi
+done
+if [ $have_rst2man -eq 0 ]; then
printf No (so will not install man pages).\n
-   have_rst2man=0
 fi
 fi
 
@@ -854,6 +860,9 @@ HAVE_RST2MAN=${have_rst2man}
 # Whether there's a doxygen binary available for building api documentation
 HAVE_DOXYGEN=${have_doxygen}
 
+# The path to the rst2man program for building documentation.
+RST2MAN = ${rst2man}
+
 # The directory to which desktop files should be installed
 desktop_dir = \$(prefix)/share/applications
 
diff --git a/doc/Makefile.local b/doc/Makefile.local
index e7d0bac..a13cb37 100644
--- a/doc/Makefile.local
+++ b/doc/Makefile.local
@@ -51,7 +51,7 @@ ifeq ($(HAVE_SPHINX),1)
mv $(DOCBUILDDIR)/man/*.$${section} 
$(DOCBUILDDIR)/man/man$${section}; \
done
 else ifeq ($(HAVE_RST2MAN),1)
-   $(prerst2man) $(srcdir)/doc $(DOCBUILDDIR)/man
+   $(prerst2man) $(RST2MAN) $(srcdir)/doc $(DOCBUILDDIR)/man
 else
@echo Fatal: build dependency fail.
@false
diff --git a/doc/prerst2man.py b/doc/prerst2man.py
index 968722a..2e87976 100644
--- a/doc/prerst2man.py
+++ b/doc/prerst2man.py
@@ -4,8 +4,9 @@ from os.path import dirname, isdir
 from os import makedirs, system
 import re
 
-sourcedir = argv[1]
-outdir = argv[2]
+rst2man = argv[1]
+sourcedir = argv[2]
+outdir = argv[3]
 
 if not isdir(outdir):
 makedirs(outdir, 0o755)
@@ -60,5 +61,5 @@ for page in man_pages:
 outfile.write(.join(lines))
 outfile.close()
 
-system('set -x; rst2man {0} {1}/{2}.{3}'
-   .format(filename, outdir, page[0], page[4]))
+system('set -x; {0} {1} {2}/{3}.{4}'
+   .format(rst2man, filename, outdir, page[0], page[4]))
-- 
2.1.3

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] doc: Allow rst2man.py as an alternative to rst2man

2015-01-03 Thread W. Trevor King
On Sat, Jan 03, 2015 at 04:49:27PM +0100, David Bremner wrote:
 At the risk of bike-shedding, rewrite the configure check to be more
 obvious. This is pretty subjective, but in particular I'm not a
 big fan of resetting RST2MAN at the bottom of every iteration of the
 for loop.  Also conform a bit more to the convention of using a
 lower case variable in configure and assigning it in Makefile.

I'm fine with all of these changes.

 @@ -854,6 +860,9 @@ HAVE_RST2MAN=${have_rst2man}
  # Whether there's a doxygen binary available for building api documentation
  HAVE_DOXYGEN=${have_doxygen}
  
 +# The path to the rst2man program for building documentation.
 +RST2MAN = ${rst2man}
 +
  # The directory to which desktop files should be installed
  desktop_dir = \$(prefix)/share/applications
  

I'd keep the RST2MAN entry right after HAVE_RST2MAN, instead of having
HAVE_DOXYGEN between them.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] doc: Allow rst2man.py as an alternative to rst2man

2015-01-03 Thread Tomi Ollila
On Sat, Jan 03 2015, W. Trevor King wk...@tremily.us wrote:

 On Sat, Jan 03, 2015 at 04:49:27PM +0100, David Bremner wrote:
 At the risk of bike-shedding, rewrite the configure check to be more
 obvious. This is pretty subjective, but in particular I'm not a
 big fan of resetting RST2MAN at the bottom of every iteration of the
 for loop.  Also conform a bit more to the convention of using a
 lower case variable in configure and assigning it in Makefile.

 I'm fine with all of these changes.

I am also -- and I'd prefer lower-case variables -- however the convention
of using lower case variables is not so clear here (or weren't until
David's ${python} path ;) -- we have mixup of upper  lower case variables
there, and otoh, other (auto)configure scripts seems to use *_RST2MAN.

But, instead of working this further we could also consider Jani's irc comment
of dropping rs2man support altogether... or just keep the status quo and
instruct users just install (recent enough) sphinx to their systems to get
man pages created...

Tomi

PS: In one Scientific Linux 6.2 system I build and run notmuch I have

  # Whether there's a sphinx-build binary available for building documentation
  HAVE_SPHINX=0

  # Whether there's a rst2man binary available for building documentation
  HAVE_RST2MAN=1

because sphinx-build is not recent enough -- sphinx-1.0-build would be but
as it cannot be used by default and as rst2man (w/o .py) works I have not 
bothered.
I'd presume anyone else using such an old system will have bigger problems
getting their notmuch compiled (recent enough zlib being one of those), so
this makes me wonder whether there is actually anyone needing rst2man there
(besides me, of course :)

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] doc: Allow rst2man.py as an alternative to rst2man

2015-01-03 Thread David Bremner
Tomi Ollila tomi.oll...@iki.fi writes:

 I'd presume anyone else using such an old system will have bigger
 problems getting their notmuch compiled (recent enough zlib being one
 of those), so this makes me wonder whether there is actually anyone
 needing rst2man there (besides me, of course :)

I guess the original reasoning was that rst2man was part of
python/docutils and so more likely to already be available.  

d
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch