36 # - removed dependency to prettytable |
36 # - removed dependency to prettytable |
37 # - removed some not needed code |
37 # - removed some not needed code |
38 # - changed 'create_licenses_table' to 'create_licenses_list' |
38 # - changed 'create_licenses_table' to 'create_licenses_list' |
39 # - changed 'create_summary_table' to 'create_summary_list' |
39 # - changed 'create_summary_table' to 'create_summary_list' |
40 # - changed 'create_output_string' to return a JSON string |
40 # - changed 'create_output_string' to return a JSON string |
|
41 # - removed 'load_config_from_file()' because we only use command line |
|
42 # configuration |
41 # |
43 # |
42 |
44 |
43 from __future__ import annotations |
45 from __future__ import annotations |
44 |
46 |
45 import argparse |
47 import argparse |
64 from email.message import Message |
66 from email.message import Message |
65 from typing import Callable, Dict, Iterator, Optional, Sequence |
67 from typing import Callable, Dict, Iterator, Optional, Sequence |
66 |
68 |
67 |
69 |
68 __pkgname__ = "pip-licenses" |
70 __pkgname__ = "pip-licenses" |
69 __version__ = "4.4.0" |
71 __version__ = "5.0.0" |
70 __author__ = "raimon" |
|
71 __license__ = "MIT" |
|
72 __summary__ = ( |
72 __summary__ = ( |
73 "Dump the software license list of Python packages installed with pip." |
73 "Dump the software license list of Python packages installed with pip." |
74 ) |
74 ) |
75 __url__ = "https://github.com/raimon49/pip-licenses" |
|
76 |
75 |
77 |
76 |
78 FIELD_NAMES = ( |
77 FIELD_NAMES = ( |
79 'Name', |
78 'Name', |
80 'Version', |
79 'Version', |
691 namespace: argparse.Namespace, |
696 namespace: argparse.Namespace, |
692 values: str, |
697 values: str, |
693 option_string: Optional[str] = None, |
698 option_string: Optional[str] = None, |
694 ) -> None: |
699 ) -> None: |
695 enum_cls = MAP_DEST_TO_ENUM[self.dest] |
700 enum_cls = MAP_DEST_TO_ENUM[self.dest] |
696 values = value_to_enum_key(values) |
701 setattr(namespace, self.dest, get_value_from_enum(enum_cls, values)) |
697 setattr(namespace, self.dest, getattr(enum_cls, values)) |
702 |
698 |
703 |
699 |
704 def create_parser() -> CompatibleArgumentParser: |
700 def create_parser(): |
|
701 parser = CompatibleArgumentParser( |
705 parser = CompatibleArgumentParser( |
702 description=__summary__, formatter_class=CustomHelpFormatter |
706 description=__summary__, formatter_class=CustomHelpFormatter |
703 ) |
707 ) |
704 |
708 |
705 common_options = parser.add_argument_group('Common options') |
709 common_options = parser.add_argument_group('Common options') |