From 334a67db16b993a24e1d0267442f4a147bad5922 Mon Sep 17 00:00:00 2001 From: Claudiu Popa Date: Thu, 11 Jul 2019 09:26:09 +0200 Subject: Allow importing wheel files. Close #541 --- ChangeLog | 2 ++ astroid/manager.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 50dd1e21..cf4893ac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,8 @@ What's New in astroid 2.3.0? ============================ Release Date: TBA +* Allow importing wheel files. Close #541 + * Annotated AST follows PEP8 coding style when converted to string. * Fix a bug where defining a class using type() could cause a DuplicateBasesError. diff --git a/astroid/manager.py b/astroid/manager.py index 4388514a..75115980 100644 --- a/astroid/manager.py +++ b/astroid/manager.py @@ -26,6 +26,9 @@ from astroid import modutils from astroid import transforms +ZIP_IMPORT_EXTS = (".zip", ".egg", ".whl") + + def safe_repr(obj): try: return repr(obj) @@ -185,7 +188,7 @@ class AstroidManager: from astroid.builder import AstroidBuilder builder = AstroidBuilder(self) - for ext in (".zip", ".egg"): + for ext in ZIP_IMPORT_EXTS: try: eggpath, resource = filepath.rsplit(ext + os.path.sep, 1) except ValueError: -- cgit v1.2.1