[Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.20,1.21
Ka-Ping Yee
ping@users.sourceforge.net
Tue, 27 Mar 2001 00:13:45 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv20585/Lib
Modified Files:
pydoc.py
Log Message:
Fix some reloading problems (still more work needed).
Add hyperlinks to PEPs at http://www.python.org/peps/pep-%04d.html
Remove script directory (dirname of sys.argv[0]) from sys.path.
Index: pydoc.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** pydoc.py 2001/03/23 14:05:53 1.20
--- pydoc.py 2001/03/27 08:13:42 1.21
***************
*** 367,370 ****
--- 367,371 ----
pattern = re.compile(r'\b((http|ftp)://\S+[\w/]|'
r'RFC[- ]?(\d+)|'
+ r'PEP[- ]?(\d+)|'
r'(self\.)?(\w+))\b')
while 1:
***************
*** 374,383 ****
results.append(escape(text[here:start]))
! all, scheme, rfc, selfdot, name = match.groups()
if scheme:
results.append('<a href="%s">%s</a>' % (all, escape(all)))
elif rfc:
! url = 'http://www.rfc-editor.org/rfc/rfc%s.txt' % rfc
results.append('<a href="%s">%s</a>' % (url, escape(all)))
elif text[end:end+1] == '(':
results.append(self.namelink(name, methods, funcs, classes))
--- 375,387 ----
results.append(escape(text[here:start]))
! all, scheme, rfc, pep, selfdot, name = match.groups()
if scheme:
results.append('<a href="%s">%s</a>' % (all, escape(all)))
elif rfc:
! url = 'http://www.rfc-editor.org/rfc/rfc%d.txt' % int(rfc)
results.append('<a href="%s">%s</a>' % (url, escape(all)))
+ elif pep:
+ url = 'http://www.python.org/peps/pep-%04d.html' % int(pep)
+ results.append('<a href="%s">%s</a>' % (url, escape(all)))
elif text[end:end+1] == '(':
results.append(self.namelink(name, methods, funcs, classes))
***************
*** 1032,1037 ****
if os.path.exists(file):
info = (file, os.path.getmtime(file), os.path.getsize(file))
! if cache.has_key(path) and cache[path] != info:
! module = reload(module)
file = module.__file__
if os.path.exists(file):
--- 1036,1042 ----
if os.path.exists(file):
info = (file, os.path.getmtime(file), os.path.getsize(file))
! if cache.get(path) == info:
! continue
! module = reload(module)
file = module.__file__
if os.path.exists(file):
***************
*** 1139,1145 ****
class Helper:
def __repr__(self):
! return '''To get help on a Python object, call help(object).
To get help on a module or package, either import it before calling
! help(module) or call help('modulename').'''
def __call__(self, *args):
--- 1144,1152 ----
class Helper:
def __repr__(self):
! return '''Welcome to Python %s!
!
! To get help on a Python object, call help(object).
To get help on a module or package, either import it before calling
! help(module) or call help('modulename').''' % sys.version[:3]
def __call__(self, *args):
***************
*** 1517,1520 ****
--- 1524,1530 ----
# Scripts don't get the current directory in their path by default.
+ scriptdir = os.path.dirname(sys.argv[0])
+ if scriptdir in sys.path:
+ sys.path.remove(scriptdir)
sys.path.insert(0, '.')