mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #5442 from tk0miya/5437_autodoc_crashed_for_egg_packages
Fix #5437: autodoc: crashed on modules importing eggs
This commit is contained in:
commit
5d509d69ed
1
CHANGES
1
CHANGES
@ -22,6 +22,7 @@ Bugs fixed
|
||||
* #5417: Sphinx fails to build with syntax error in Python 2.7.5
|
||||
* #4911: add latexpdf to make.bat for non make-mode
|
||||
* #5436: Autodoc does not work with enum subclasses with properties/methods
|
||||
* #5437: autodoc: crashed on modules importing eggs
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
@ -314,8 +314,9 @@ def get_module_source(modname):
|
||||
filename += 'w'
|
||||
elif not (lfilename.endswith('.py') or lfilename.endswith('.pyw')):
|
||||
raise PycodeError('source is not a .py file: %r' % filename)
|
||||
elif '.egg' in filename:
|
||||
eggpath, _ = re.split('(?<=\\.egg)/', filename)
|
||||
elif ('.egg' + os.path.sep) in filename:
|
||||
pat = '(?<=\\.egg)' + re.escape(os.path.sep)
|
||||
eggpath, _ = re.split(pat, filename, 1)
|
||||
if path.isfile(eggpath):
|
||||
return 'file', filename
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user