Relocate importlib._case_ok to importlib._bootstrap.

This required updating the code to use posix instead of os. This is
all being done to make bootstrapping easier to removing dependencies
that are kept in importlib.__init__ and thus outside of the single
file to bootstrap from.
This commit is contained in:
Brett Cannon 2012-01-26 19:03:52 -05:00
parent e9cd900585
commit 51d14f8e56
2 changed files with 27 additions and 19 deletions

View file

@ -33,25 +33,6 @@ _r_long = _bootstrap._r_long
# Bootstrap help #####################################################
# TODO: Expose from import.c, else handle encode/decode as _os.environ returns
# bytes.
def _case_ok(directory, check):
"""Check if the directory contains something matching 'check'.
No check is done if the file/directory exists or not.
"""
if 'PYTHONCASEOK' in os.environ:
return True
if not directory:
directory = os.getcwd()
if check in os.listdir(directory):
return True
return False
_bootstrap._case_ok = _case_ok
# Required built-in modules.
try:
import posix as _os