From 3e7b5406e998c6767725b2389d81245134cce37f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=84=9D=EC=A7=80=EC=98=81/=EC=B1=85=EC=9E=84=EC=97=B0?= =?UTF-8?q?=EA=B5=AC=EC=9B=90/SW=EA=B3=B5=ED=95=99=28=EC=97=B0=29Open=20So?= =?UTF-8?q?urce=20TP?= Date: Fri, 11 Jul 2025 15:28:10 +0900 Subject: [PATCH] Remove the pkg_resources MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 석지영/책임연구원/SW공학(연)Open Source TP --- src/fosslight_dependency/_help.py | 6 +++++- src/fosslight_dependency/run_dependency_scanner.py | 7 ++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/fosslight_dependency/_help.py b/src/fosslight_dependency/_help.py index 81d200b7..4511b35e 100644 --- a/src/fosslight_dependency/_help.py +++ b/src/fosslight_dependency/_help.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # Copyright (c) 2021 LG Electronics Inc. # SPDX-License-Identifier: Apache-2.0 -from fosslight_util.help import PrintHelpMsg +from fosslight_util.help import PrintHelpMsg, print_package_version _HELP_MESSAGE_DEPENDENCY = """ Usage: fosslight_dependency [option1] [option2] ... @@ -64,6 +64,10 @@ """ +def print_version(pkg_name: str) -> None: + print_package_version(pkg_name, "FOSSLight Dependency Scanner Version:") + + def print_help_msg(): helpMsg = PrintHelpMsg(_HELP_MESSAGE_DEPENDENCY) helpMsg.print_help_msg(True) diff --git a/src/fosslight_dependency/run_dependency_scanner.py b/src/fosslight_dependency/run_dependency_scanner.py index 7eb7f49d..4d5563e9 100755 --- a/src/fosslight_dependency/run_dependency_scanner.py +++ b/src/fosslight_dependency/run_dependency_scanner.py @@ -7,7 +7,6 @@ import platform import sys import argparse -import pkg_resources import warnings from datetime import datetime import logging @@ -16,7 +15,7 @@ from collections import defaultdict from fosslight_util.set_log import init_log import fosslight_util.constant as constant -from fosslight_dependency._help import print_help_msg +from fosslight_dependency._help import print_version, print_help_msg from fosslight_dependency._analyze_dependency import analyze_dependency from fosslight_util.output_format import check_output_formats_v2, write_output_file from fosslight_util.oss_item import ScannerItem @@ -361,9 +360,7 @@ def main(): print_help_msg() if args.version: # -v option - cur_version = pkg_resources.get_distribution(_PKG_NAME).version - print(f"FOSSLight Dependency Scanner Version: {cur_version}") - sys.exit(0) + print_version(_PKG_NAME) if args.manager: # -m option package_manager = ''.join(args.manager)