summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-09-15 15:39:11 (GMT)
committerGuido van Rossum <guido@python.org>1997-09-15 15:39:11 (GMT)
commita2f626ff5826b420a306b341df52f9546d1f71f4 (patch)
treee06677504dfd6842759b988c2c7ec42ca93bbaba
parent7883e1dfbda28cf23085fa01e9e40d4bef9ee19b (diff)
downloadcpython-a2f626ff5826b420a306b341df52f9546d1f71f4.zip
cpython-a2f626ff5826b420a306b341df52f9546d1f71f4.tar.gz
cpython-a2f626ff5826b420a306b341df52f9546d1f71f4.tar.bz2
Patch by Case Roole <cjr@bound.xs4all.nl> to fail with a more
explanatory message when the manual directories aren't found. (I have to say I'm surprised that it actually still works!)
-rwxr-xr-xDemo/tkinter/guido/tkman.py42
1 files changed, 35 insertions, 7 deletions
diff --git a/Demo/tkinter/guido/tkman.py b/Demo/tkinter/guido/tkman.py
index 70aaae3..84672fc 100755
--- a/Demo/tkinter/guido/tkman.py
+++ b/Demo/tkinter/guido/tkman.py
@@ -7,15 +7,43 @@ import os
import string
import regex
from Tkinter import *
-
-import addpack
-addpack.addpack('/ufs/guido/src/python/Demo/guido/tkinter')
from ManPage import ManPage
-MANNDIR = '/usr/local/man/mann'
-MAN3DIR = '/usr/local/man/man3'
-MANNDIR = '/depot/sundry/man/mann'
-MAN3DIR = '/depot/sundry/man/man3'
+MANNDIRLIST = ['/depot/sundry/man/mann','/usr/local/man/mann']
+MAN3DIRLIST = ['/depot/sundry/man/man3','/usr/local/man/man3']
+
+foundmanndir = 0
+for dir in MANNDIRLIST:
+ if os.path.exists(dir):
+ MANNDIR = dir
+ foundmanndir = 1
+
+foundman3dir = 0
+for dir in MAN3DIRLIST:
+ if os.path.exists(dir):
+ MAN3DIR = dir
+ foundman3dir = 1
+
+if not foundmanndir or not foundman3dir:
+ sys.stderr.write('\n')
+ if not foundmanndir:
+ msg = """\
+Failed to find mann directory.
+Please add the correct entry to the MANNDIRLIST
+at the top of %s script.""" % \
+sys.argv[0]
+ sys.stderr.write("%s\n\n" % msg)
+ if not foundman3dir:
+ msg = """\
+Failed to find man3 directory.
+Please add the correct entry to the MAN3DIRLIST
+at the top of %s script.""" % \
+sys.argv[0]
+ sys.stderr.write("%s\n\n" % msg)
+ sys.exit(1)
+
+del foundmanndir
+del foundman3dir
def listmanpages(mandir):
files = os.listdir(mandir)