Skip to content

Commit

Permalink
Fix after review #1
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Kazantsev <[email protected]>
  • Loading branch information
rkazants committed Sep 4, 2020
1 parent 90665aa commit ff3957b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions model-optimizer/mo/utils/versions_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,17 +187,16 @@ def version_check(name, installed_v, required_v, sign, not_satisfied_v, exit_cod
return exit_code


def get_environment_variables():
def get_environment_setup():
"""
Get environment setup such as python version
Checks if installed modules versions satisfy required versions in requirements file
:return: a dictionary of environment variables
"""
env_params = dict()
exec("import sys")
python_version = "{}.{}.{}".format(sys.version_info.major,
sys.version_info.minor,
sys.version_info.micro)
exec("del sys")
env_params['python_version'] = python_version
return env_params

Expand All @@ -217,6 +216,8 @@ def check_requirements(framework=None):
if framework is None:
framework_suffix = ""
elif framework == "tf":
# TODO: requirements file must be determined based on input model (TF1 or TF2)
# and not by installed TensorFlow version
try:
exec("import tensorflow")
tf_version = sys.modules["tensorflow"].__version__
Expand All @@ -233,7 +234,7 @@ def check_requirements(framework=None):

file_name = "requirements{}.txt".format(framework_suffix)
requirements_file = os.path.realpath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, file_name))
env_params = get_environment_variables()
env_params = get_environment_setup()
requirements_list = get_module_version_list_from_file(requirements_file, env_params)
not_satisfied_versions = []
exit_code = 0
Expand Down

0 comments on commit ff3957b

Please sign in to comment.