From 70ab11a328f13d41d24818af2dfd919d43297771 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Sun, 8 Jun 2008 19:59:55 +0100 Subject: [PATCH] Cope with locales when finding man-pages Instead of searching for a man-page, search for a 'man' directory and set $MANPATH. Then man itself will apply the normal rules for getting the right translation (suggested by Tuomo Valkonen). --- 0alias | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/0alias b/0alias index c9a5d1b..aa3ca30 100755 --- a/0alias +++ b/0alias @@ -119,13 +119,23 @@ if options.manpage: print >>sys.stderr, "No main program for interface '%s'" % interface_uri sys.exit(1) - # TODO: the feed should say where the man-page is, but for now we'll just search - # the whole implementation for one - prog_name = os.path.basename(main) alias_name = os.path.basename(args[0]) assert impl_path + + # TODO: the feed should say where the man-pages are, but for now we'll accept + # a directory called man in some common locations... + for mandir in ['man', 'share/man', 'usr/man', 'usr/share/man']: + manpath = os.path.join(impl_path, mandir) + if os.path.isdir(manpath): + # Note: unlike "man -M", this also copes with LANG settings... + os.environ['MANPATH'] = manpath + os.execlp('man', 'man', prog_name) + sys.exit(1) + + # No man directory given or found, so try searching for man files + manpages = [] for root, dirs, files in os.walk(impl_path): for f in files: -- 2.11.4.GIT