mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Also accept .so as an extension for module files.
This commit is contained in:
parent
8c011580ff
commit
d977e35dd0
1 changed files with 4 additions and 8 deletions
12
Lib/pydoc.py
12
Lib/pydoc.py
|
@ -127,14 +127,10 @@ def stripid(text):
|
||||||
def modulename(path):
|
def modulename(path):
|
||||||
"""Return the Python module name for a given path, or None."""
|
"""Return the Python module name for a given path, or None."""
|
||||||
filename = os.path.basename(path)
|
filename = os.path.basename(path)
|
||||||
if lower(filename[-3:]) == '.py':
|
for ending in ['.py', '.pyc', '.pyd', '.pyo',
|
||||||
return filename[:-3]
|
'module.so', 'module.so.1', '.so']:
|
||||||
elif lower(filename[-4:]) in ['.pyc', '.pyd', '.pyo']:
|
if len(filename) > len(ending) and filename[-len(ending):] == ending:
|
||||||
return filename[:-4]
|
return filename[:-len(ending)]
|
||||||
elif lower(filename[-11:]) == 'module.so':
|
|
||||||
return filename[:-11]
|
|
||||||
elif lower(filename[-13:]) == 'module.so.1':
|
|
||||||
return filename[:-13]
|
|
||||||
|
|
||||||
class DocImportError(Exception):
|
class DocImportError(Exception):
|
||||||
"""Class for errors while trying to import something to document it."""
|
"""Class for errors while trying to import something to document it."""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue