diff --git a/CHANGELOG.md b/CHANGELOG.md index f52d9ae..5d04a5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ ## CHANGELOG +### 1.6.1 + +* Fix bug + * Support display multiple license with `--from-classifier` option +* Improve document + * Add section of 'Uninstallation' in README + ### 1.6.0 * Implement new option `--format-html` diff --git a/README.md b/README.md index f0dc8c4..76f7438 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ Dump the software license list of Python packages installed with pip. * [More Information](#more-information) * [License](#license) * [Dependencies](#dependencies) +* [Uninstallation](#uninstallation) ## Description @@ -217,3 +218,11 @@ Other, please make sure to execute the `--help` option. * [PTable](https://pypi.python.org/pypi/PTable) by Luke Maurits and maintainer of fork version Kane Blueriver under the BSD-3-Clause License `pip-licenses` has been implemented in the policy to minimize the dependence on external package. + +## Uninstallation + +Uninstall package and dependent package with `pip` command. + +```bash +$ pip uninstall pip-licenses PTable +``` diff --git a/piplicenses.py b/piplicenses.py index e3772c2..45afa5f 100644 --- a/piplicenses.py +++ b/piplicenses.py @@ -38,7 +38,7 @@ from prettytable.prettytable import HEADER as RULE_HEADER, ALL as RULE_ALL __pkgname__ = 'pip-licenses' -__version__ = '1.6.0' +__version__ = '1.6.1' __author__ = 'raimon' __license__ = 'MIT License' __summary__ = ('Dump the software license list of ' @@ -156,9 +156,13 @@ def factory_styled_table_with_args(args): def find_license_from_classifier(message): license_from_classifier = LICENSE_UNKNOWN + licenses = [] for k, v in message.items(): if k == 'Classifier' and v.startswith('License'): - license_from_classifier = v.split(' :: ')[-1] + licenses.append(v.split(' :: ')[-1]) + + if len(licenses) > 0: + license_from_classifier = ', '.join(licenses) return license_from_classifier diff --git a/test_piplicenses.py b/test_piplicenses.py index 7b58b31..bbbc21f 100644 --- a/test_piplicenses.py +++ b/test_piplicenses.py @@ -94,6 +94,17 @@ def test_find_license_from_classifier(self): self.assertEquals('MIT License', find_license_from_classifier(message)) + def test_display_multiple_license_from_classifier(self): + metadata = ('Metadata-Version: 2.0\r\n' + 'Name: helga\r\n' + 'Version: 1.7.6\r\n' + 'Classifier: License :: OSI Approved :: ' + 'GNU General Public License v3 (GPLv3)\r\n' + 'Classifier: License :: OSI Approved :: MIT License\r\n') + message = message_from_string(metadata) + self.assertEquals('GNU General Public License v3 (GPLv3), MIT License', + find_license_from_classifier(message)) + def test_not_found_license_from_classifier(self): metadata_as_no_license = ('Metadata-Version: 2.0\r\n' 'Name: pip-licenses\r\n'