eva-shell 0.2.28__tar.gz → 0.2.30__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: eva-shell
3
- Version: 0.2.28
3
+ Version: 0.2.30
4
4
  Summary: EVA ICS v4 shell
5
5
  Home-page: https://github.com/eva-ics/eva4
6
6
  Author: Bohemia Automation / Altertech
@@ -1,3 +1,3 @@
1
- __version__ = '0.2.28'
1
+ __version__ = '0.2.30'
2
2
 
3
3
  DEFAULT_REPOSITORY_URL = 'https://pub.bma.ai/eva4'
@@ -1460,7 +1460,7 @@ class CLI:
1460
1460
  if current_command.json:
1461
1461
  d['ip'] = ip
1462
1462
  else:
1463
- d.append({'name': 'IP address', 'value': ip})
1463
+ d.append({'name': 'IP addr/host', 'value': ip})
1464
1464
  print_result(d, need_header=False, name_value=False)
1465
1465
 
1466
1466
  def mirror_set(self, mirror_url):
@@ -5,6 +5,7 @@ from neotermcolor import colored
5
5
  from .sharedobj import common, current_command
6
6
  from .cli import CLI
7
7
  from .ap import init_ap
8
+ from .tools import is_local_shell
8
9
 
9
10
  banner = """ _______ _____ _______________
10
11
  / ____/ | / / | / _/ ____/ ___/
@@ -19,13 +20,22 @@ dir_eva_default = '/opt/eva4'
19
20
 
20
21
 
21
22
  def launch():
22
- common.dir_eva = os.environ.get('EVA_DIR', dir_eva_default)
23
- if not os.path.exists(common.dir_eva):
24
- raise RuntimeError(
25
- f'EVA ICS directory not found. Consider installing EVA ICS either '
26
- f'in {dir_eva_default} or specifying EVA_DIR env variable')
27
- common.bus_path = f'{common.dir_eva}/var/bus.ipc'
28
- common.bus_name = f'eva-shell.{os.getpid()}'
23
+ bus = os.environ.get('EVA_BUS')
24
+ if bus:
25
+ common.dir_eva = None
26
+ common.bus_path = bus
27
+ import socket
28
+ common.bus_name = f'eva-shell.{socket.gethostname()}.{os.getpid()}'
29
+ else:
30
+ common.dir_eva = os.environ.get('EVA_DIR', dir_eva_default)
31
+ if not os.path.exists(common.dir_eva):
32
+ raise RuntimeError(
33
+ f'EVA ICS directory not found. Consider installing EVA ICS either '
34
+ f'in {dir_eva_default} or specifying EVA_DIR env variable. '
35
+ f'For For a remote host, set EVA_BUS=HOST:PORT env variable'
36
+ )
37
+ common.bus_path = f'{common.dir_eva}/var/bus.ipc'
38
+ common.bus_name = f'eva-shell.{os.getpid()}'
29
39
 
30
40
  common.cli = CLI()
31
41
 
@@ -20,7 +20,7 @@ def check_local_shell():
20
20
 
21
21
 
22
22
  def is_local_shell():
23
- return True
23
+ return common.dir_eva is not None
24
24
 
25
25
 
26
26
  def ok():
@@ -93,19 +93,24 @@ def remove_file_lock(name):
93
93
 
94
94
 
95
95
  def get_my_ip():
96
- try:
97
- s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
98
- s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
99
- s.connect(('255.255.255.255', 0))
100
- ip = s.getsockname()[0]
101
- try:
102
- s.close()
103
- except:
104
- pass
105
- except:
106
- ip = None
107
- return ip
108
-
96
+ if common.bus_path:
97
+ if common.bus_path.startswith('/'):
98
+ try:
99
+ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
100
+ s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
101
+ s.connect(('255.255.255.255', 0))
102
+ ip = s.getsockname()[0]
103
+ try:
104
+ s.close()
105
+ except:
106
+ pass
107
+ except:
108
+ ip = None
109
+ return ip
110
+ else:
111
+ return common.bus_path.split(':')[0]
112
+ else:
113
+ return ''
109
114
 
110
115
  TIME_ORD = {
111
116
  'created': 0,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: eva-shell
3
- Version: 0.2.28
3
+ Version: 0.2.30
4
4
  Summary: EVA ICS v4 shell
5
5
  Home-page: https://github.com/eva-ics/eva4
6
6
  Author: Bohemia Automation / Altertech
@@ -1,4 +1,4 @@
1
- __version__ = '0.2.28'
1
+ __version__ = '0.2.30'
2
2
 
3
3
  import setuptools
4
4
 
File without changes
File without changes
File without changes
File without changes
File without changes