pyx3270 0.1.6__tar.gz → 0.1.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyx3270-0.1.6 → pyx3270-0.1.7}/PKG-INFO +1 -1
- {pyx3270-0.1.6 → pyx3270-0.1.7}/pyproject.toml +1 -1
- {pyx3270-0.1.6 → pyx3270-0.1.7}/pyx3270/__init__.py +1 -1
- {pyx3270-0.1.6 → pyx3270-0.1.7}/pyx3270/bin/start.bin +0 -0
- {pyx3270-0.1.6 → pyx3270-0.1.7}/pyx3270/cli.py +15 -6
- {pyx3270-0.1.6 → pyx3270-0.1.7}/pyx3270/emulator.py +4 -3
- {pyx3270-0.1.6 → pyx3270-0.1.7}/pyx3270/hook/hook-pyx3270.py +4 -1
- {pyx3270-0.1.6 → pyx3270-0.1.7}/pyx3270/offline.py +2 -3
- {pyx3270-0.1.6 → pyx3270-0.1.7}/pyx3270/server.py +1 -1
- {pyx3270-0.1.6 → pyx3270-0.1.7}/pyx3270.egg-info/PKG-INFO +1 -1
- {pyx3270-0.1.6 → pyx3270-0.1.7}/pyx3270.egg-info/SOURCES.txt +0 -1
- {pyx3270-0.1.6 → pyx3270-0.1.7}/tests/test_offline.py +3 -4
- pyx3270-0.1.6/pyx3270/bin/start.bin.bak +0 -0
- {pyx3270-0.1.6 → pyx3270-0.1.7}/README.md +0 -0
- {pyx3270-0.1.6 → pyx3270-0.1.7}/docs/gen_tree.py +0 -0
- {pyx3270-0.1.6 → pyx3270-0.1.7}/pyx3270/__main__.py +0 -0
- {pyx3270-0.1.6 → pyx3270-0.1.7}/pyx3270/bin/linux/s3270 +0 -0
- {pyx3270-0.1.6 → pyx3270-0.1.7}/pyx3270/bin/linux/x3270 +0 -0
- {pyx3270-0.1.6 → pyx3270-0.1.7}/pyx3270/bin/windows/wc3270.exe +0 -0
- {pyx3270-0.1.6 → pyx3270-0.1.7}/pyx3270/bin/windows/ws3270.exe +0 -0
- {pyx3270-0.1.6 → pyx3270-0.1.7}/pyx3270/exceptions.py +0 -0
- {pyx3270-0.1.6 → pyx3270-0.1.7}/pyx3270/hook/__init__.py +0 -0
- {pyx3270-0.1.6 → pyx3270-0.1.7}/pyx3270/iemulator.py +0 -0
- {pyx3270-0.1.6 → pyx3270-0.1.7}/pyx3270/logging_config.py +0 -0
- {pyx3270-0.1.6 → pyx3270-0.1.7}/pyx3270/py.typed +0 -0
- {pyx3270-0.1.6 → pyx3270-0.1.7}/pyx3270/state.py +0 -0
- {pyx3270-0.1.6 → pyx3270-0.1.7}/pyx3270/tn3270.py +0 -0
- {pyx3270-0.1.6 → pyx3270-0.1.7}/pyx3270/x3270_commands.py +0 -0
- {pyx3270-0.1.6 → pyx3270-0.1.7}/pyx3270.egg-info/dependency_links.txt +0 -0
- {pyx3270-0.1.6 → pyx3270-0.1.7}/pyx3270.egg-info/entry_points.txt +0 -0
- {pyx3270-0.1.6 → pyx3270-0.1.7}/pyx3270.egg-info/requires.txt +0 -0
- {pyx3270-0.1.6 → pyx3270-0.1.7}/pyx3270.egg-info/top_level.txt +0 -0
- {pyx3270-0.1.6 → pyx3270-0.1.7}/setup.cfg +0 -0
- {pyx3270-0.1.6 → pyx3270-0.1.7}/site/gen_tree.py +0 -0
- {pyx3270-0.1.6 → pyx3270-0.1.7}/tests/__init__.py +0 -0
- {pyx3270-0.1.6 → pyx3270-0.1.7}/tests/conftest.py +0 -0
- {pyx3270-0.1.6 → pyx3270-0.1.7}/tests/test_cli.py +0 -0
- {pyx3270-0.1.6 → pyx3270-0.1.7}/tests/test_emulator.py +0 -0
- {pyx3270-0.1.6 → pyx3270-0.1.7}/tests/test_exceptions.py +0 -0
- {pyx3270-0.1.6 → pyx3270-0.1.7}/tests/test_server.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyx3270
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.7
|
|
4
4
|
Summary: Uma interface comum utilizada para automações de terminais 3270 da IBM.
|
|
5
5
|
Author-email: MatheusLPolidoro <mattpolidoro4@gmail.com>
|
|
6
6
|
Project-URL: Documentation, https://matheuslpolidoro.github.io/pyx3270/
|
|
Binary file
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import socket
|
|
3
|
+
import sys
|
|
3
4
|
import threading
|
|
4
5
|
from time import sleep
|
|
5
6
|
from typing import Callable
|
|
@@ -110,7 +111,9 @@ def replay(
|
|
|
110
111
|
except KeyboardInterrupt:
|
|
111
112
|
rich.print('\n[x] Interrompido pelo usuário.')
|
|
112
113
|
state.command_process.terminate()
|
|
113
|
-
|
|
114
|
+
if emulator:
|
|
115
|
+
emu.terminate()
|
|
116
|
+
sys.exit(0)
|
|
114
117
|
|
|
115
118
|
|
|
116
119
|
@app.command()
|
|
@@ -125,12 +128,12 @@ def record(
|
|
|
125
128
|
port = int(*port) if port else 3270
|
|
126
129
|
|
|
127
130
|
rich.print(f'[+] RECORD na porta {port}')
|
|
128
|
-
|
|
131
|
+
reconnect = False
|
|
129
132
|
try:
|
|
130
133
|
while True:
|
|
131
|
-
if emulator:
|
|
134
|
+
if emulator and not reconnect:
|
|
132
135
|
emu = X3270(visible=True, model=model, save_log_file=True)
|
|
133
|
-
|
|
136
|
+
elif not reconnect:
|
|
134
137
|
emu = None
|
|
135
138
|
|
|
136
139
|
server_thread = start_server_thread(
|
|
@@ -142,13 +145,19 @@ def record(
|
|
|
142
145
|
|
|
143
146
|
if emulator:
|
|
144
147
|
rich.print('[+] Conectando ao emulador...')
|
|
145
|
-
|
|
148
|
+
if reconnect:
|
|
149
|
+
emu.reconnect_host()
|
|
150
|
+
else:
|
|
151
|
+
emu.connect_host('localhost', port, tls, mode_3270=False)
|
|
146
152
|
|
|
147
153
|
rich.print(f'[+] Escutando localhost, origem {host=} {port=}')
|
|
148
154
|
control_replay(server_thread)
|
|
155
|
+
reconnect = True
|
|
149
156
|
except KeyboardInterrupt:
|
|
150
157
|
rich.print('\n[x] Interrompido pelo usuário.')
|
|
151
|
-
|
|
158
|
+
if emulator:
|
|
159
|
+
emu.terminate()
|
|
160
|
+
sys.exit(0)
|
|
152
161
|
|
|
153
162
|
|
|
154
163
|
if __name__ == '__main__':
|
|
@@ -370,7 +370,7 @@ class Wc3270App(ExecutableApp):
|
|
|
370
370
|
|
|
371
371
|
class Ws3270App(ExecutableApp):
|
|
372
372
|
args = [
|
|
373
|
-
get_binary_path(
|
|
373
|
+
get_binary_path('windows', 'ws3270'),
|
|
374
374
|
'-xrm',
|
|
375
375
|
'ws3270.unlockDelay:False',
|
|
376
376
|
]
|
|
@@ -814,14 +814,15 @@ class X3270(AbstractEmulator, X3270Cmd):
|
|
|
814
814
|
self.app.close()
|
|
815
815
|
self.is_terminated = True
|
|
816
816
|
logger.info('Emulador terminado com sucesso')
|
|
817
|
-
|
|
817
|
+
|
|
818
818
|
def is_connected(self) -> bool:
|
|
819
819
|
logger.debug('Verificando estado de conexão')
|
|
820
820
|
try:
|
|
821
821
|
# Verifica tempo desde o último comando
|
|
822
|
+
elapsed_max = 600
|
|
822
823
|
if self.last_command_time:
|
|
823
824
|
elapsed = time() - self.last_command_time
|
|
824
|
-
if elapsed >
|
|
825
|
+
if elapsed > elapsed_max:
|
|
825
826
|
logger.warning(
|
|
826
827
|
f'Tempo de inatividade excedido: '
|
|
827
828
|
f'{elapsed:.2f} segundos'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import os
|
|
2
|
+
|
|
2
3
|
from PyInstaller.utils.hooks import get_package_paths
|
|
3
4
|
|
|
4
5
|
# Caminho do pacote instalado
|
|
@@ -16,7 +17,9 @@ if os.path.isdir(bin_dir):
|
|
|
16
17
|
# Caminho relativo a partir da pasta bin (ex: windows/wc3270.exe)
|
|
17
18
|
rel_path = os.path.relpath(full_path, bin_dir)
|
|
18
19
|
# Corrige o destino para ser uma pasta, não um arquivo
|
|
19
|
-
target_dir = os.path.join(
|
|
20
|
+
target_dir = os.path.join(
|
|
21
|
+
'pyx3270', 'bin', os.path.dirname(rel_path)
|
|
22
|
+
)
|
|
20
23
|
datas.append((full_path, target_dir))
|
|
21
24
|
|
|
22
25
|
__all__ = ['datas']
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import subprocess
|
|
2
|
-
import sys
|
|
3
2
|
from logging import getLogger
|
|
4
3
|
from time import sleep
|
|
5
4
|
|
|
@@ -11,8 +10,6 @@ logger = getLogger(__name__)
|
|
|
11
10
|
class PyX3270Manager:
|
|
12
11
|
def __init__(self, emu: AbstractEmulator, directory='./screens'):
|
|
13
12
|
self.command = [
|
|
14
|
-
sys.executable,
|
|
15
|
-
'-m',
|
|
16
13
|
'pyx3270',
|
|
17
14
|
'replay',
|
|
18
15
|
'--directory',
|
|
@@ -48,6 +45,7 @@ class PyX3270Manager:
|
|
|
48
45
|
return
|
|
49
46
|
self.emu.pf(1)
|
|
50
47
|
sleep(0.1)
|
|
48
|
+
self.emu.pf(1)
|
|
51
49
|
|
|
52
50
|
def next(self):
|
|
53
51
|
"""Define a tela específica e aguarda processamento corretamente."""
|
|
@@ -75,6 +73,7 @@ class PyX3270Manager:
|
|
|
75
73
|
def change_directory(self, directory: str):
|
|
76
74
|
"""Troca o diretório de carregamento das telas."""
|
|
77
75
|
self._exec(f'change directory {directory}')
|
|
76
|
+
sleep(1)
|
|
78
77
|
self.emu.pf(1)
|
|
79
78
|
|
|
80
79
|
def terminate(self):
|
|
@@ -107,7 +107,7 @@ def find_directory(base_dir: str, search_name: str) -> str | None:
|
|
|
107
107
|
): # Compara de forma insensível a maiúsculas/minúsculas
|
|
108
108
|
return os.path.join(base_dir, dir_name)
|
|
109
109
|
|
|
110
|
-
return None
|
|
110
|
+
return None
|
|
111
111
|
|
|
112
112
|
|
|
113
113
|
def convert_s(hex_string: str) -> str:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyx3270
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.7
|
|
4
4
|
Summary: Uma interface comum utilizada para automações de terminais 3270 da IBM.
|
|
5
5
|
Author-email: MatheusLPolidoro <mattpolidoro4@gmail.com>
|
|
6
6
|
Project-URL: Documentation, https://matheuslpolidoro.github.io/pyx3270/
|
|
@@ -2,7 +2,7 @@ import gc
|
|
|
2
2
|
import subprocess
|
|
3
3
|
import sys
|
|
4
4
|
import weakref
|
|
5
|
-
from unittest.mock import MagicMock, patch
|
|
5
|
+
from unittest.mock import MagicMock, patch, call
|
|
6
6
|
|
|
7
7
|
from pyx3270.offline import PyX3270Manager
|
|
8
8
|
|
|
@@ -17,8 +17,6 @@ def test_pyx3270_manager_init_and_terminate(mock_popen, x3270_cmd_instance):
|
|
|
17
17
|
|
|
18
18
|
mock_popen.assert_called_once_with(
|
|
19
19
|
[
|
|
20
|
-
sys.executable,
|
|
21
|
-
'-m',
|
|
22
20
|
'pyx3270',
|
|
23
21
|
'replay',
|
|
24
22
|
'--directory',
|
|
@@ -58,7 +56,8 @@ def test_pyx3270_manager_exec(mock_logger, mock_popen, x3270_cmd_instance):
|
|
|
58
56
|
)
|
|
59
57
|
mock_process.stdin.write.assert_called_once_with(f'{command}\n')
|
|
60
58
|
mock_process.stdin.flush.assert_called_once()
|
|
61
|
-
manager.emu.pf.
|
|
59
|
+
assert manager.emu.pf.call_count == 2
|
|
60
|
+
manager.emu.pf.assert_has_calls([call(1), call(1)])
|
|
62
61
|
|
|
63
62
|
|
|
64
63
|
@patch('subprocess.Popen')
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|