2020-01-17 15:45:48 +00:00
|
|
|
# __init__.py
|
|
|
|
|
2020-01-24 09:11:14 +00:00
|
|
|
import os
|
2020-01-31 14:49:48 +00:00
|
|
|
import pkg_resources
|
2020-01-24 09:11:14 +00:00
|
|
|
|
2020-01-25 15:47:58 +00:00
|
|
|
try:
|
|
|
|
spawn_class_name = os.environ['WEXPECT_SPAWN_CLASS']
|
|
|
|
except KeyError:
|
|
|
|
spawn_class_name = 'legacy_wexpect'
|
2020-01-17 15:45:48 +00:00
|
|
|
|
2020-02-03 14:44:55 +00:00
|
|
|
from .legacy_wexpect import ConsoleReader
|
2020-01-25 15:47:58 +00:00
|
|
|
if spawn_class_name == 'legacy_wexpect':
|
|
|
|
from .legacy_wexpect import ExceptionPexpect
|
|
|
|
from .legacy_wexpect import EOF
|
|
|
|
from .legacy_wexpect import TIMEOUT
|
|
|
|
from .legacy_wexpect import spawn
|
|
|
|
from .legacy_wexpect import run
|
|
|
|
from .legacy_wexpect import split_command_line
|
|
|
|
from .legacy_wexpect import join_args
|
|
|
|
from .legacy_wexpect import ConsoleReader
|
|
|
|
from .legacy_wexpect import __version__
|
|
|
|
from .legacy_wexpect import searcher_string
|
|
|
|
from .legacy_wexpect import searcher_re
|
2020-01-17 15:45:48 +00:00
|
|
|
|
2020-01-25 15:47:58 +00:00
|
|
|
__all__ = ['ExceptionPexpect', 'EOF', 'TIMEOUT', 'spawn', 'run', 'split_command_line',
|
|
|
|
'__version__', 'ConsoleReader', 'join_args', 'searcher_string', 'searcher_re']
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
from .wexpect_util import split_command_line
|
|
|
|
from .wexpect_util import join_args
|
|
|
|
from .wexpect_util import ExceptionPexpect
|
|
|
|
from .wexpect_util import EOF
|
|
|
|
from .wexpect_util import TIMEOUT
|
2020-01-17 15:45:48 +00:00
|
|
|
|
2020-01-25 15:47:58 +00:00
|
|
|
from .console_reader import ConsoleReaderSocket
|
|
|
|
from .console_reader import ConsoleReaderPipe
|
|
|
|
|
|
|
|
from .host import SpawnSocket
|
|
|
|
from .host import SpawnPipe
|
|
|
|
from .host import run
|
2020-01-31 14:49:48 +00:00
|
|
|
from .host import searcher_string
|
|
|
|
from .host import searcher_re
|
2020-01-25 15:47:58 +00:00
|
|
|
|
2020-01-24 09:11:14 +00:00
|
|
|
try:
|
|
|
|
spawn = globals()[spawn_class_name]
|
|
|
|
except KeyError:
|
|
|
|
print(f'Error: no spawn class: {spawn_class_name}')
|
2020-01-25 15:47:58 +00:00
|
|
|
raise
|
|
|
|
|
2020-01-31 14:49:48 +00:00
|
|
|
# The version is handled by the package: pbr, which derives the version from the git tags.
|
|
|
|
try:
|
|
|
|
__version__ = pkg_resources.require("wexpect")[0].version
|
|
|
|
except: # pragma: no cover
|
|
|
|
__version__ = '0.0.1.unkowndev0'
|
|
|
|
|
2020-01-25 15:47:58 +00:00
|
|
|
__all__ = ['split_command_line', 'join_args', 'ExceptionPexpect', 'EOF', 'TIMEOUT',
|
2020-01-31 14:49:48 +00:00
|
|
|
'ConsoleReaderSocket', 'ConsoleReaderPipe', 'spawn', 'SpawnSocket', 'SpawnPipe', 'run',
|
2020-02-03 14:44:55 +00:00
|
|
|
'searcher_string', 'searcher_re', '__version__', 'ConsoleReader']
|