From 71744a6332524588bdfae271f762083ad0fe7e85 Mon Sep 17 00:00:00 2001 From: raimon Date: Wed, 24 Jun 2020 18:26:20 +0900 Subject: [PATCH 1/5] Use sorted glob.glob() results #69 The 'LICENSE' is always selected when the following four LICENSE files exist: LICENSE LICENSE.APACHE LICENSE.BSD LICENSE.PSF --- piplicenses.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/piplicenses.py b/piplicenses.py index 24c395f..ef18a77 100644 --- a/piplicenses.py +++ b/piplicenses.py @@ -138,9 +138,9 @@ def get_pkg_included_file(pkg, file_names): pkg_dirname = "{}-{}.dist-info".format( pkg.project_name.replace("-", "_"), pkg.version) patterns = [] - [patterns.extend(glob.glob(os.path.join(pkg.location, + [patterns.extend(sorted(glob.glob(os.path.join(pkg.location, pkg_dirname, - f))) for f in file_names] + f)))) for f in file_names] for test_file in patterns: if os.path.exists(test_file): included_file = test_file From 9a3fbf33f770c39d1b4a7936ead53ebf019a5ea1 Mon Sep 17 00:00:00 2001 From: raimon Date: Wed, 24 Jun 2020 18:35:09 +0900 Subject: [PATCH 2/5] Bump version to 2.2.1 --- CHANGELOG.md | 4 ++++ piplicenses.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 570b28b..032f8e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## CHANGELOG +### 2.2.1 + +* Fixed the file that is selected when multiple matches are made with "LICENSE" with run '--with-license-file' + ### 2.2.0 * Implement new option `--with-notice-file` diff --git a/piplicenses.py b/piplicenses.py index ef18a77..904b857 100644 --- a/piplicenses.py +++ b/piplicenses.py @@ -60,7 +60,7 @@ open = open # allow monkey patching __pkgname__ = 'pip-licenses' -__version__ = '2.2.0' +__version__ = '2.2.1' __author__ = 'raimon' __license__ = 'MIT License' __summary__ = ('Dump the software license list of ' From 6a432cced8f524fb11b99c5eb633275cc1e0c146 Mon Sep 17 00:00:00 2001 From: raimon Date: Wed, 24 Jun 2020 18:39:44 +0900 Subject: [PATCH 3/5] Update dependencies for development --- dev-requirements.txt | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index f7dda90..4b66017 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -5,38 +5,39 @@ # pip-compile dev-requirements.in # attrs==19.3.0 # via pytest -autopep8==1.5.2 # via -r dev-requirements.in +autopep8==1.5.3 # via -r dev-requirements.in bleach==3.1.5 # via readme-renderer -certifi==2020.4.5.1 # via requests +certifi==2020.6.20 # via requests chardet==3.0.4 # via requests click==7.1.2 # via pip-tools -codecov==2.0.22 # via -r dev-requirements.in +codecov==2.1.7 # via -r dev-requirements.in coverage==5.1 # via codecov, pytest-cov docutils==0.16 # via -r dev-requirements.in, readme-renderer idna==2.9 # via requests -more-itertools==8.2.0 # via pytest -packaging==20.3 # via bleach, pytest -pip-tools==5.1.0 # via -r dev-requirements.in +more-itertools==8.4.0 # via pytest +packaging==20.4 # via bleach, pytest +pip-tools==5.2.1 # via -r dev-requirements.in pkginfo==1.5.0.1 # via twine pluggy==0.13.1 # via pytest ptable==0.9.2 # via -r requirements.in -py==1.8.1 # via pytest -pycodestyle==2.5.0 # via autopep8, pytest-pycodestyle +py==1.8.2 # via pytest +pycodestyle==2.6.0 # via autopep8, pytest-pycodestyle pygments==2.6.1 # via readme-renderer pypandoc==1.5 # via -r dev-requirements.in pyparsing==2.4.7 # via packaging -pytest-cov==2.8.1 # via -r dev-requirements.in +pytest-cov==2.10.0 # via -r dev-requirements.in pytest-pycodestyle==2.0.0 # via -r dev-requirements.in pytest-runner==5.2 # via -r dev-requirements.in -pytest==5.4.1 # via pytest-cov, pytest-pycodestyle +pytest==5.4.3 # via pytest-cov, pytest-pycodestyle readme-renderer==26.0 # via twine requests-toolbelt==0.9.1 # via twine -requests==2.23.0 # via codecov, requests-toolbelt, twine -six==1.14.0 # via bleach, packaging, pip-tools, readme-renderer -tqdm==4.45.0 # via twine +requests==2.24.0 # via codecov, requests-toolbelt, twine +six==1.15.0 # via bleach, packaging, pip-tools, readme-renderer +toml==0.10.1 # via autopep8 +tqdm==4.46.1 # via twine twine==1.15.0 # via -r dev-requirements.in urllib3==1.25.9 # via requests -wcwidth==0.1.9 # via pytest +wcwidth==0.2.5 # via pytest webencodings==0.5.1 # via bleach wheel==0.34.2 # via -r dev-requirements.in, pypandoc From 9ef0ddb248da65025c6e95f88480d912468f8623 Mon Sep 17 00:00:00 2001 From: raimon Date: Wed, 24 Jun 2020 18:39:53 +0900 Subject: [PATCH 4/5] Fix errors from pycodestyle --- piplicenses.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/piplicenses.py b/piplicenses.py index 904b857..6dd841f 100644 --- a/piplicenses.py +++ b/piplicenses.py @@ -139,8 +139,9 @@ def get_pkg_included_file(pkg, file_names): pkg.project_name.replace("-", "_"), pkg.version) patterns = [] [patterns.extend(sorted(glob.glob(os.path.join(pkg.location, - pkg_dirname, - f)))) for f in file_names] + pkg_dirname, + f)))) + for f in file_names] for test_file in patterns: if os.path.exists(test_file): included_file = test_file From a7e7b36c213b8fceab70e172997b490bbf5e7f79 Mon Sep 17 00:00:00 2001 From: raimon Date: Wed, 24 Jun 2020 18:44:57 +0900 Subject: [PATCH 5/5] Use Markdown in CHANGELOG [ci skip] --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 032f8e5..b4e1169 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,12 +2,12 @@ ### 2.2.1 -* Fixed the file that is selected when multiple matches are made with "LICENSE" with run '--with-license-file' +* Fixed the file that is selected when multiple matches are made with `LICENSE*` with run `--with-license-file` ### 2.2.0 * Implement new option `--with-notice-file` -* Added to find British style file name `LICENCE` with run '--with-license-file' +* Added to find British style file name `LICENCE` with run `--with-license-file` ### 2.1.1