[issue1715] Make pydoc list submodules

2008-01-21 Thread Georg Brandl

Georg Brandl added the comment:

The patch only amends TextDoc -- what about HtmlDoc?

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1715
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1715] Make pydoc list submodules

2008-01-21 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Actually, HtmlDoc already lists all module members in the inspected
module (regardless of whether they are modules imported from outside or
submodules defined inline). You can try it with the updated pydocfodder:

 import pydoc
 from test import pydocfodder
 pydoc.writedoc(pydocfodder)
wrote test.pydocfodder.html

... and check that test.pydocfodder.html contains a reference to
test.pydocfodder.submodule.

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1715
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1715] Make pydoc list submodules

2008-01-21 Thread Georg Brandl

Georg Brandl added the comment:

Well, I believe you. :)

Committed r60178.

--
resolution:  - accepted
status: open - closed

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1715
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1715] Make pydoc list submodules

2008-01-20 Thread Antoine Pitrou

Antoine Pitrou added the comment:

This should be a better patch, although it only applies to the text
formatter of pydoc, not the HTML one (I'm too lazy for this :-)).

--
nosy: +pitrou
Added file: http://bugs.python.org/file9246/pydocsubmodules.patch

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1715
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1715] Make pydoc list submodules

2008-01-06 Thread Georg Brandl

Georg Brandl added the comment:

This patch duplicates entries for package contents and submodules;
this is not good. (E.g. for help(email):

NAME
email - A package for parsing, handling, and generating email messages.

FILE
/home/gbr/devel/python/Lib/email/__init__.py

PACKAGE CONTENTS
_parseaddr
base64mime
charset
encoders
errors
feedparser
generator
header
iterators
message
mime (package)
parser
quoprimime
test (package)
utils

SUBMODULES
_parseaddr
base64mime
charset
email
encoders
errors
feedparser
generator
header
iterators
message
mime
parser
quoprimime
sys
utils
)

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1715
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1715] Make pydoc list submodules

2008-01-01 Thread Christian Heimes

Changes by Christian Heimes:


--
assignee:  - georg.brandl
keywords: +patch
nosy: +georg.brandl
priority:  - normal

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1715
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1715] Make pydoc list submodules

2007-12-31 Thread Gustavo J. A. M. Carneiro

New submission from Gustavo J. A. M. Carneiro:

Often python extension modules define submodules like this:

static PyObject *
initfoo_xpto(void)
{
PyObject *m;
m = Py_InitModule3(foo.xpto, foo_xpto_functions, NULL);
[...]
return m;
}

PyMODINIT_FUNC
initfoo(void)
{
PyObject *m;
PyObject *submodule;
m = Py_InitModule3(foo, foo_functions, NULL);
[...]
submodule = initfoo_xpto();
Py_INCREF(submodule);
PyModule_AddObject(m, xpto, submodule);
}

Unfortunately pydoc does not list these submodules.  Attached patch
fixes it.

--
components: Demos and Tools
files: pydoc-submodules.diff
messages: 59067
nosy: gustavo
severity: normal
status: open
title: Make pydoc list submodules
type: rfe
versions: Python 2.6
Added file: http://bugs.python.org/file9038/pydoc-submodules.diff

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1715
__Index: Lib/pydoc.py
===
--- Lib/pydoc.py	(revision 59634)
+++ Lib/pydoc.py	(working copy)
@@ -1064,6 +1064,14 @@
 result = result + self.section(
 'PACKAGE CONTENTS', join(modpkgs, '\n'))
 
+submodules = []
+for key, value in inspect.getmembers(object, inspect.ismodule):
+submodules.append(key)
+if submodules:
+submodules.sort()
+result = result + self.section(
+'SUBMODULES', join(submodules, '\n'))
+
 if classes:
 classlist = map(lambda (key, value): value, classes)
 contents = [self.formattree(
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com