mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #5437: autodoc: crashed on modules importing eggs
This commit is contained in:
parent
914d93a9e1
commit
e7811f0292
1
CHANGES
1
CHANGES
@ -20,6 +20,7 @@ Bugs fixed
|
|||||||
* #5421: autodoc emits deprecation warning for :confval:`autodoc_default_flags`
|
* #5421: autodoc emits deprecation warning for :confval:`autodoc_default_flags`
|
||||||
* #5422: lambda object causes PicklingError on storing environment
|
* #5422: lambda object causes PicklingError on storing environment
|
||||||
* #5417: Sphinx fails to build with syntax error in Python 2.7.5
|
* #5417: Sphinx fails to build with syntax error in Python 2.7.5
|
||||||
|
* #5437: autodoc: crashed on modules importing eggs
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
--------
|
--------
|
||||||
|
@ -314,8 +314,9 @@ def get_module_source(modname):
|
|||||||
filename += 'w'
|
filename += 'w'
|
||||||
elif not (lfilename.endswith('.py') or lfilename.endswith('.pyw')):
|
elif not (lfilename.endswith('.py') or lfilename.endswith('.pyw')):
|
||||||
raise PycodeError('source is not a .py file: %r' % filename)
|
raise PycodeError('source is not a .py file: %r' % filename)
|
||||||
elif '.egg' in filename:
|
elif ('.egg' + os.path.sep) in filename:
|
||||||
eggpath, _ = re.split('(?<=\\.egg)/', filename)
|
pat = '(?<=\\.egg)' + re.escape(os.path.sep)
|
||||||
|
eggpath, _ = re.split(pat, filename, 1)
|
||||||
if path.isfile(eggpath):
|
if path.isfile(eggpath):
|
||||||
return 'file', filename
|
return 'file', filename
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user