-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy path__init__.py
32 lines (28 loc) · 927 Bytes
/
__init__.py
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
28
29
30
31
32
# -*- coding: utf-8 -*-
"""Top-level package for NGINXpy."""
__author__ = """DecentFoX Studio"""
__email__ = 'foss@decentfox.com'
__version__ = '0.1.0'
try:
from ._nginx import (
Cycle, Log, get_current_cycle, ReturnCode,
Request,
NginxEventLoop, NginxEventLoopPolicy, Event,
)
except ImportError:
import sys
from os.path import abspath, dirname
from importlib.util import find_spec
spec = find_spec('nginx._nginx')
if spec and ('' not in sys.path or
abspath(dirname(spec.origin)) != abspath(dirname(__file__))):
print('Cannot import nginx, should load in nginx.conf first:')
print()
print(f' load_module {spec.origin};')
print()
elif '' in sys.path:
sys.modules.pop('nginx')
sys.path.remove('')
__import__('nginx')
else:
print('Cannot import nginx, please check installation.')