Skip to content

Commit 7bae224

Browse files
authored
Remove the pkg_resources (#261)
Signed-off-by: 석지영/책임연구원/SW공학(연)Open Source TP <[email protected]>
1 parent d6e4c3e commit 7bae224

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/fosslight_dependency/_help.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33
# Copyright (c) 2021 LG Electronics Inc.
44
# SPDX-License-Identifier: Apache-2.0
5-
from fosslight_util.help import PrintHelpMsg
5+
from fosslight_util.help import PrintHelpMsg, print_package_version
66

77
_HELP_MESSAGE_DEPENDENCY = """
88
Usage: fosslight_dependency [option1] <arg1> [option2] <arg2>...
@@ -64,6 +64,10 @@
6464
"""
6565

6666

67+
def print_version(pkg_name: str) -> None:
68+
print_package_version(pkg_name, "FOSSLight Dependency Scanner Version:")
69+
70+
6771
def print_help_msg():
6872
helpMsg = PrintHelpMsg(_HELP_MESSAGE_DEPENDENCY)
6973
helpMsg.print_help_msg(True)

src/fosslight_dependency/run_dependency_scanner.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import platform
88
import sys
99
import argparse
10-
import pkg_resources
1110
import warnings
1211
from datetime import datetime
1312
import logging
@@ -16,7 +15,7 @@
1615
from collections import defaultdict
1716
from fosslight_util.set_log import init_log
1817
import fosslight_util.constant as constant
19-
from fosslight_dependency._help import print_help_msg
18+
from fosslight_dependency._help import print_version, print_help_msg
2019
from fosslight_dependency._analyze_dependency import analyze_dependency
2120
from fosslight_util.output_format import check_output_formats_v2, write_output_file
2221
from fosslight_util.oss_item import ScannerItem
@@ -361,9 +360,7 @@ def main():
361360
print_help_msg()
362361

363362
if args.version: # -v option
364-
cur_version = pkg_resources.get_distribution(_PKG_NAME).version
365-
print(f"FOSSLight Dependency Scanner Version: {cur_version}")
366-
sys.exit(0)
363+
print_version(_PKG_NAME)
367364

368365
if args.manager: # -m option
369366
package_manager = ''.join(args.manager)

0 commit comments

Comments
 (0)