Skip to content

Commit

Permalink
Add exception for checking version
Browse files Browse the repository at this point in the history
  • Loading branch information
soimkim authored Aug 24, 2021
2 parents e1a72f4 + 9f85e69 commit 86ae621
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/fosslight_util/set_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def init_check_latest_version(pkg_version="", main_package_name=""):
except TypeError:
logger.warning('Cannot check the lastest version on PIP')
logger.warning('You could use already installed version\n')
except Exception as error:
logger.debug('Cannot check the latest version:' + str(error))


def init_log(log_file, create_file=True, stream_log_level=logging.INFO,
Expand Down Expand Up @@ -60,9 +62,14 @@ def init_log(log_file, create_file=True, stream_log_level=logging.INFO,
"OS": platform.system()+" "+platform.release(),
}
if main_package_name != "":
pkg_version = pkg_resources.get_distribution(main_package_name).version
init_check_latest_version(pkg_version, main_package_name)
_result_log["Tool Info"] = main_package_name + " v" + pkg_version
pkg_info = main_package_name
try:
pkg_version = pkg_resources.get_distribution(main_package_name).version
init_check_latest_version(pkg_version, main_package_name)
pkg_info = main_package_name + " v" + pkg_version
except Exception as error:
logger.debug('Cannot check the version:' + str(error))
_result_log["Tool Info"] = pkg_info
if path_to_analyze != "":
_result_log["Path to analyze"] = path_to_analyze

Expand Down

0 comments on commit 86ae621

Please sign in to comment.