Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

Commit

Permalink
#61: compatibility with newer version of python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
hugbug committed Aug 6, 2020
1 parent 2226670 commit b678623
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions lib/pkg_resources.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -1337,8 +1337,9 @@ def _get(self, path):

register_loader_type(type(None), DefaultProvider)

if importlib_bootstrap is not None:
register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
#PY3:
#if importlib_bootstrap is not None:
# register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)


class EmptyProvider(NullProvider):
Expand Down Expand Up @@ -1746,7 +1747,12 @@ def StringIO(*args, **kw):
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
try:
from StringIO import StringIO
except ImportError:
#PY3:
from io import BytesIO
return BytesIO(*args,**kw)
return StringIO(*args,**kw)

def find_nothing(importer, path_item, only=False):
Expand Down Expand Up @@ -1795,8 +1801,9 @@ def find_on_path(importer, path_item, only=False):
break
register_finder(ImpWrapper,find_on_path)

if importlib_bootstrap is not None:
register_finder(importlib_bootstrap.FileFinder, find_on_path)
#PY3:
#if importlib_bootstrap is not None:
# register_finder(importlib_bootstrap.FileFinder, find_on_path)

_declare_state('dict', _namespace_handlers={})
_declare_state('dict', _namespace_packages={})
Expand Down Expand Up @@ -1897,8 +1904,9 @@ def file_ns_handler(importer, path_item, packageName, module):
register_namespace_handler(ImpWrapper,file_ns_handler)
register_namespace_handler(zipimport.zipimporter,file_ns_handler)

if importlib_bootstrap is not None:
register_namespace_handler(importlib_bootstrap.FileFinder, file_ns_handler)
#PY3:
#if importlib_bootstrap is not None:
# register_namespace_handler(importlib_bootstrap.FileFinder, file_ns_handler)


def null_ns_handler(importer, path_item, packageName, module):
Expand Down

0 comments on commit b678623

Please sign in to comment.