supporting Quixote PTL files in pydoc
I have this slight change to pydoc.py which allows it to grok Quixote's PTL-based modules: % cvs diff -u pydoc.py Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.90 diff -c -u -r1.90 pydoc.py cvs diff: conflicting specifications of output style --- pydoc.py 29 Jan 2004 06:37:49 -0000 1.90 +++ pydoc.py 7 Feb 2004 20:07:43 -0000 @@ -2125,10 +2125,15 @@ sys.path.insert(0, '.') try: - opts, args = getopt.getopt(sys.argv[1:], 'gk:p:w') + opts, args = getopt.getopt(sys.argv[1:], 'gk:p:wq') writing = 0 for opt, val in opts: + if opt == '-q': + # support Quixote's PTL + import quixote + quixote.enable_ptl() + continue if opt == '-g': gui() return I realize this may seem a bit like the tail wagging the dog, but PTL functions are so close syntactically and semantically to Python that it seems like a fairly modest change to allow them to be supported. I wonder if something like this could reasonably be slipped into the repository without much fuss? I have a change for pychecker which allows it to check PTL modules as well. For those unfamiliar with it, Quixote's PTL is described here: http://www.mems-exchange.org/software/quixote/doc/PTL.html Skip
At 02:16 PM 2/7/04 -0600, Skip Montanaro wrote:
I have this slight change to pydoc.py which allows it to grok Quixote's PTL-based modules:
% cvs diff -u pydoc.py Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.90 diff -c -u -r1.90 pydoc.py cvs diff: conflicting specifications of output style --- pydoc.py 29 Jan 2004 06:37:49 -0000 1.90 +++ pydoc.py 7 Feb 2004 20:07:43 -0000 @@ -2125,10 +2125,15 @@ sys.path.insert(0, '.')
try: - opts, args = getopt.getopt(sys.argv[1:], 'gk:p:w') + opts, args = getopt.getopt(sys.argv[1:], 'gk:p:wq') writing = 0
for opt, val in opts: + if opt == '-q': + # support Quixote's PTL + import quixote + quixote.enable_ptl() + continue if opt == '-g': gui() return
Couldn't this be accomplished by simply placing an enable_ptl() call in the __init__.py of packages that contain .ptl files?
... >> + # support Quixote's PTL >> + import quixote >> + quixote.enable_ptl() ... Phillip> Couldn't this be accomplished by simply placing an enable_ptl() Phillip> call in the __init__.py of packages that contain .ptl files? In theory, I guess it could, but it would require that all .ptl files reside in packages. Unless I'm mistaken, that's not currently a requirement. Skip
participants (2)
-
Phillip J. Eby
-
Skip Montanaro