From 4e2c5a96e2473dceef1a93cdf7d21f4da01a9b21 Mon Sep 17 00:00:00 2001 From: raimon Date: Tue, 28 Jan 2020 20:23:35 +0900 Subject: [PATCH 1/4] Extended conditions for finding package license files Find a match for LICENSE* / COPYING* Fix #59 --- piplicenses.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/piplicenses.py b/piplicenses.py index c199fb2..5cee706 100644 --- a/piplicenses.py +++ b/piplicenses.py @@ -135,8 +135,12 @@ def get_pkg_license_file(pkg): license_text = LICENSE_UNKNOWN pkg_dirname = "{}-{}.dist-info".format( pkg.project_name.replace("-", "_"), pkg.version) - license_file_base = os.path.join(pkg.location, pkg_dirname, 'LICENSE*') - for test_file in glob.glob(license_file_base): + file_names = ('LICENSE*', 'COPYING*') + patterns = [] + [patterns.extend(glob.glob(os.path.join(pkg.location, + pkg_dirname, + f))) for f in file_names] + for test_file in patterns: if os.path.exists(test_file): license_file = test_file with open(test_file, encoding='utf-8') as license_file_handle: From a94dc145950fb56eef0b6474fcf88ba3eb46be71 Mon Sep 17 00:00:00 2001 From: raimon Date: Tue, 28 Jan 2020 20:32:10 +0900 Subject: [PATCH 2/4] Bump version to 2.1.0 --- CHANGELOG.md | 5 +++++ piplicenses.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d45ead..66d3a68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## CHANGELOG +### 2.1.0 + +* Implement new option `--format=plain-vertical` +* Support for outputting license file named `COPYING *` + ### 2.0.1 * Better license file open handling in Python 3 diff --git a/piplicenses.py b/piplicenses.py index 5cee706..ea35aff 100644 --- a/piplicenses.py +++ b/piplicenses.py @@ -60,7 +60,7 @@ open = open # allow monkey patching __pkgname__ = 'pip-licenses' -__version__ = '2.0.1' +__version__ = '2.1.0' __author__ = 'raimon' __license__ = 'MIT License' __summary__ = ('Dump the software license list of ' From a518ae686b04a2411af3fde3985f341a2ee87983 Mon Sep 17 00:00:00 2001 From: raimon Date: Tue, 28 Jan 2020 20:34:15 +0900 Subject: [PATCH 3/4] Update dependencies for use latest version of wheel --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index afc7448..8a8fb6c 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -38,7 +38,7 @@ twine==1.15.0 urllib3==1.25.8 # via requests wcwidth==0.1.8 # via pytest webencodings==0.5.1 # via bleach -wheel==0.34.0 +wheel==0.34.1 # The following packages are considered to be unsafe in a requirements file: # pip From ef15b0058f6a4b1ad5b8b28797ef3a9b8b33f4aa Mon Sep 17 00:00:00 2001 From: raimon Date: Tue, 28 Jan 2020 20:38:42 +0900 Subject: [PATCH 4/4] Minor fix to not break links with reST Found in the following test upload https://test.pypi.org/project/pip-licenses/2.1.0/#plain-vertical --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 74deeea..ea5106a 100644 --- a/README.md +++ b/README.md @@ -332,7 +332,7 @@ When executed with the `--format=csv` option, you can output list in quoted CSV #### Plain Vertical When executed with the `--format=plain-vertical` option, you can output a simple plain vertical output that is similar to Angular CLI's -[`--extractLicenses` flag](https://angular.io/cli/build#options). This format minimizes rightward drift. +[--extractLicenses flag](https://angular.io/cli/build#options). This format minimizes rightward drift. ```bash (venv) $ pip-licenses --format=plain-vertical --with-license-file --no-license-path