Skip to content

Commit cf1ec6a

Browse files
committed
Improve version comparison
1 parent 23d4de1 commit cf1ec6a

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '2.0.8'
1+
__version__ = '2.0.9'

cli/cli_helper.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
from colors import Color
22
from constants import MINIMAL_SUPPORTED_INSTANCE_VERSION
3-
3+
import pkg_resources
44

55
class CliHelper:
66

77
@staticmethod
88
def check_if_version_is_supported(args, current_version, server):
9-
if args['quiet'] is False and 'hybrid-analysis.com' not in server and current_version.split('-')[0] < MINIMAL_SUPPORTED_INSTANCE_VERSION:
9+
parsed_current_version = pkg_resources.parse_version(current_version.split('-')[0])
10+
minimal_supported_version = pkg_resources.parse_version(MINIMAL_SUPPORTED_INSTANCE_VERSION)
11+
12+
if args['quiet'] is False and 'hybrid-analysis.com' not in server and parsed_current_version < minimal_supported_version:
1013
print(Color.warning('This version of VxAPI works best on VxWebService version {} (or above). Consider upgrading to ensure the flawless performance.'.format(MINIMAL_SUPPORTED_INSTANCE_VERSION)))
1114

helper_classes/cli_helper.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,3 @@ def prompt_for_dir_content_submission(args):
4444
if not submit_warning or submit_warning[0].lower() != 'y':
4545
print('You did not indicate approval, exiting ...')
4646
exit(1)
47-
48-
@staticmethod
49-
def check_if_version_is_supported(args, api_instance_version_object, request_handler, headers, minimal_compatible_version):
50-
if args['quiet'] is False and 'hybrid-analysis.com' not in api_instance_version_object.server:
51-
api_instance_version_object.call(request_handler, headers)
52-
api_response = api_instance_version_object.get_api_response()
53-
if api_response.status_code == 200 and api_instance_version_object.get_response_msg_success_nature() is True:
54-
if api_instance_version_object.get_response_json()['response']['version'] < minimal_compatible_version:
55-
print(Color.warning('This version of VxAPI works best on VxWebService version {} (or above). Consider upgrading to ensure the flawless performance.'.format(minimal_compatible_version)))
56-

0 commit comments

Comments
 (0)