Skip to content

Commit

Permalink
Fix printing windows version (#179)
Browse files Browse the repository at this point in the history
Signed-off-by: s-cu-bot <[email protected]>
  • Loading branch information
s-cu-bot authored Aug 28, 2024
1 parent bed65ac commit 5bc8176
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/fosslight_util/set_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,21 @@ def init_check_latest_version(pkg_version="", main_package_name=""):
logger.debug('Cannot check the latest version:' + str(error))


def get_os_version():

logger = logging.getLogger(constant.LOGGER_NAME)

os_version = platform.system() + " " + platform.release()
if os_version == "Windows 10":
try:
windows_build = sys.getwindowsversion().build
if windows_build >= 22000:
os_version = "Windows 11"
except Exception as error:
logger.debug(str(error))
return os_version


class CustomAdapter(logging.LoggerAdapter):
def __init__(self, logger, extra):
super(CustomAdapter, self).__init__(logger, {})
Expand Down Expand Up @@ -72,7 +87,7 @@ def init_log(log_file: str, create_file: bool = True, stream_log_level: int = lo
_result_log = {
"Tool Info": main_package_name,
"Python version": _PYTHON_VERSION,
"OS": platform.system()+" "+platform.release(),
"OS": get_os_version(),
}
if main_package_name != "":
pkg_info = main_package_name
Expand Down

0 comments on commit 5bc8176

Please sign in to comment.