[jhbuild] environment: Add the default search path to MANPATH on *BSD
- From: Ting-Wei Lan <lantw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [jhbuild] environment: Add the default search path to MANPATH on *BSD
- Date: Sun, 14 Jun 2015 06:53:52 +0000 (UTC)
commit 248cd696bd800a00f60677fe6ef1b4586965e877
Author: Ting-Wei Lan <lantw src gnome org>
Date: Sun Mar 22 15:11:06 2015 +0800
environment: Add the default search path to MANPATH on *BSD
Setting MANPATH on *BSD causes man to ignore its default search path,
so we cannot running man inside a JHBuild prefix to read manuals installed
outside the prefix. We can solve this problem by adding its default search
path to MANPATH.
https://bugzilla.gnome.org/show_bug.cgi?id=746600
jhbuild/environment.py | 25 +++++++++++++++++++++++--
1 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/jhbuild/environment.py b/jhbuild/environment.py
index 808609e..02ab939 100644
--- a/jhbuild/environment.py
+++ b/jhbuild/environment.py
@@ -28,7 +28,7 @@ from jhbuild.utils.cmds import get_output
if sys.platform.startswith('win'):
from jhbuild.utils import subprocess_win32
-def addpath(envvar, path):
+def addpath(envvar, path, prepend=True):
'''Adds a path to an environment variable.'''
if envvar in [ 'LDFLAGS', 'CFLAGS', 'CXXFLAGS' ]:
if sys.platform.startswith('win'):
@@ -62,7 +62,10 @@ def addpath(envvar, path):
envval = os.environ.get(envvar, path)
parts = envval.split(pathsep)
- parts.insert(0, path)
+ if prepend:
+ parts.insert(0, path)
+ else:
+ parts.append(path)
# remove duplicate entries:
i = 1
while i < len(parts):
@@ -151,6 +154,24 @@ def setup_env(prefix):
manpathdir = os.path.join(prefix, 'share', 'man')
addpath('MANPATH', '')
addpath('MANPATH', manpathdir)
+ # Setting MANPATH on *BSD causes man to ignore its default search path,
+ # so we need to add the default search path to MANPATH.
+ if sys.platform.startswith('freebsd') or sys.platform.startswith('dragonfly'):
+ systemmanpath = get_output('manpath -q', extra_env={'MANPATH': ''})
+ systemmanpath = systemmanpath.strip().split(':')
+ elif sys.platform.startswith('netbsd'):
+ # Running 'man -p' without specifying a manual page name causes it to
+ # exit with status 1.
+ systemmanpath = get_output('man -p || true', extra_env={'MANPATH': ''})
+ systemmanpath = map(os.path.dirname, systemmanpath.strip().split('\n'))
+ elif sys.platform.startswith('openbsd'):
+ # I cannot find a command that prints the default search path on
+ # OpenBSD, so I add paths found in the default /etc/man.conf here.
+ systemmanpath = [ '/usr/share/man', '/usr/X11R6/man', '/usr/local/man' ]
+ else:
+ systemmanpath = []
+ for systemmanpathdir in systemmanpath:
+ addpath('MANPATH', systemmanpathdir, prepend=False)
# INFOPATH
infopathdir = os.path.join(prefix, 'share', 'info')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]