Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjusted FileFinder import to work with Python 3.6 #318

Merged
merged 1 commit into from
Dec 1, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions pex/finders.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import pkg_resources

if sys.version_info >= (3, 3) and sys.implementation.name == "cpython":
import importlib._bootstrap as importlib_bootstrap
import importlib.machinery as importlib_machinery
else:
importlib_bootstrap = None
importlib_machinery = None


class ChainedFinder(object):
Expand Down Expand Up @@ -214,8 +214,8 @@ def register_finders():
# append the wheel finder
_add_finder(pkgutil.ImpImporter, find_wheels_on_path)

if importlib_bootstrap is not None:
_add_finder(importlib_bootstrap.FileFinder, find_wheels_on_path)
if importlib_machinery is not None:
_add_finder(importlib_machinery.FileFinder, find_wheels_on_path)

__PREVIOUS_FINDER = previous_finder

Expand All @@ -230,8 +230,8 @@ def unregister_finders():
pkg_resources.register_finder(zipimport.zipimporter, __PREVIOUS_FINDER)
_remove_finder(pkgutil.ImpImporter, find_wheels_on_path)

if importlib_bootstrap is not None:
_remove_finder(importlib_bootstrap.FileFinder, find_wheels_on_path)
if importlib_machinery is not None:
_remove_finder(importlib_machinery.FileFinder, find_wheels_on_path)

__PREVIOUS_FINDER = None

Expand Down