Merge branch '1.8'

This commit is contained in:
Takeshi KOMIYA 2019-01-13 15:48:29 +09:00
commit 7fea402a98
2 changed files with 9 additions and 1 deletions

View File

@ -209,6 +209,7 @@ Bugs fixed
* #5755: C++, fix duplicate declaration error on function templates with constraints * #5755: C++, fix duplicate declaration error on function templates with constraints
in the return type. in the return type.
* C++, parse unary right fold expressions and binary fold expressions. * C++, parse unary right fold expressions and binary fold expressions.
* pycode could not handle egg files on windows
* #5928: KeyError: 'DOCUTILSCONFIG' when running build * #5928: KeyError: 'DOCUTILSCONFIG' when running build
Testing Testing

View File

@ -10,6 +10,7 @@
import re import re
from io import StringIO from io import StringIO
from os import path
from zipfile import ZipFile from zipfile import ZipFile
from sphinx.errors import PycodeError from sphinx.errors import PycodeError
@ -40,7 +41,7 @@ class ModuleAnalyzer:
obj = cls(f, modname, filename) obj = cls(f, modname, filename)
cls.cache['file', filename] = obj cls.cache['file', filename] = obj
except Exception as err: except Exception as err:
if '.egg/' in filename: if '.egg' + path.sep in filename:
obj = cls.cache['file', filename] = cls.for_egg(filename, modname) obj = cls.cache['file', filename] = cls.for_egg(filename, modname)
else: else:
raise PycodeError('error opening %r' % filename, err) raise PycodeError('error opening %r' % filename, err)
@ -48,8 +49,14 @@ class ModuleAnalyzer:
@classmethod @classmethod
def for_egg(cls, filename, modname): def for_egg(cls, filename, modname):
<<<<<<< HEAD
# type: (str, str) -> ModuleAnalyzer # type: (str, str) -> ModuleAnalyzer
eggpath, relpath = re.split('(?<=\\.egg)/', filename) eggpath, relpath = re.split('(?<=\\.egg)/', filename)
=======
# type: (unicode, unicode) -> ModuleAnalyzer
SEP = re.escape(path.sep)
eggpath, relpath = re.split('(?<=\\.egg)' + SEP, filename)
>>>>>>> 1.8
try: try:
with ZipFile(eggpath) as egg: with ZipFile(eggpath) as egg:
code = egg.read(relpath).decode() code = egg.read(relpath).decode()