diff options
author | Brett Cannon <bcannon@gmail.com> | 2009-02-07 02:33:52 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2009-02-07 02:33:52 (GMT) |
commit | 7bf8d4ed4da5555dcf72652926bfb29276f7a6bc (patch) | |
tree | 4dac1cf1e0d20a736346e9117a59d8641056e7e6 /Lib | |
parent | fa8fba96a6af233d36cbe9b3d42832d6f071e50b (diff) | |
download | cpython-7bf8d4ed4da5555dcf72652926bfb29276f7a6bc.zip cpython-7bf8d4ed4da5555dcf72652926bfb29276f7a6bc.tar.gz cpython-7bf8d4ed4da5555dcf72652926bfb29276f7a6bc.tar.bz2 |
Add the missing importlib.test.extension.util.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/importlib/test/extension/util.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/importlib/test/extension/util.py b/Lib/importlib/test/extension/util.py new file mode 100644 index 0000000..d149169 --- /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 |