-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy path__init__.py
More file actions
27 lines (23 loc) · 800 Bytes
/
__init__.py
File metadata and controls
27 lines (23 loc) · 800 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os
import sys
import types
try:
PY_TAG = sys.implementation.cache_tag or 'unknown'
PY_VERSION = sys.hexversion
BUNDLE_DIR = os.path.join(__path__[0], 'bundle')
except AttributeError:
raise ImportError('Python >= 3.4 required')
def load():
from marshal import load
try:
with open(os.path.join(BUNDLE_DIR, PY_TAG + '.dgbundle'), 'rb') as fd:
for code in load(fd):
eval(code)
except FileNotFoundError:
try:
with open(os.path.join(BUNDLE_DIR, PY_TAG + '.dgbundle.py')) as fd:
for code in eval(fd.read(), {'C': types.CodeType}):
eval(code)
except FileNotFoundError:
raise ImportError('python implementation {!r} not supported'.format(PY_TAG))
load()