From 7bf8d4ed4da5555dcf72652926bfb29276f7a6bc Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Sat, 7 Feb 2009 02:33:52 +0000 Subject: [PATCH] Add the missing importlib.test.extension.util. --- Lib/importlib/test/extension/util.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Lib/importlib/test/extension/util.py diff --git a/Lib/importlib/test/extension/util.py b/Lib/importlib/test/extension/util.py new file mode 100644 index 00000000000..d1491697483 --- /dev/null +++ b/Lib/importlib/test/extension/util.py @@ -0,0 +1,21 @@ +import imp +import os +import sys + +PATH = None +EXT = None +FILENAME = None +NAME = '_testcapi' +_file_exts = [x[0] for x in imp.get_suffixes() if x[2] == imp.C_EXTENSION] +try: + for PATH in sys.path: + for EXT in _file_exts: + FILENAME = NAME + EXT + FILEPATH = os.path.join(PATH, FILENAME) + if os.path.exists(os.path.join(PATH, FILENAME)): + raise StopIteration + else: + PATH = EXT = FILENAME = FILEPATH = None +except StopIteration: + pass +del _file_exts