blob: 8d089f0d7c3fa2c506e9960bfc444d68b7c1576a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
from importlib import machinery
import os
import sys
PATH = None
EXT = None
FILENAME = None
NAME = '_testcapi'
try:
for PATH in sys.path:
for EXT in machinery.EXTENSION_SUFFIXES:
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
|