Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-pip-licenses for
openSUSE:Factory checked in at 2024-07-01 11:21:34
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pip-licenses (Old)
and /work/SRC/openSUSE:Factory/.python-pip-licenses.new.18349 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pip-licenses"
Mon Jul 1 11:21:34 2024 rev:16 rq:1184133 version:4.4.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pip-licenses/python-pip-licenses.changes
2024-03-19 17:31:10.285293900 +0100
+++
/work/SRC/openSUSE:Factory/.python-pip-licenses.new.18349/python-pip-licenses.changes
2024-07-01 11:22:19.139318326 +0200
@@ -1,0 +2,8 @@
+Sun Jun 30 20:00:21 UTC 2024 - Dirk Müller <[email protected]>
+
+- update to 4.4.0:
+ * Implement new option `--partial-match`
+- drop 0001-Fix-test_different_python-under-pyhon-3.12.patch
+ (upstream)
+
+-------------------------------------------------------------------
Old:
----
0001-Fix-test_different_python-under-pyhon-3.12.patch
pip-licenses-4.3.4.tar.gz
New:
----
pip-licenses-4.4.0.tar.gz
BETA DEBUG BEGIN:
Old: * Implement new option `--partial-match`
- drop 0001-Fix-test_different_python-under-pyhon-3.12.patch
(upstream)
BETA DEBUG END:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-pip-licenses.spec ++++++
--- /var/tmp/diff_new_pack.e4VEJU/_old 2024-07-01 11:22:20.191356402 +0200
+++ /var/tmp/diff_new_pack.e4VEJU/_new 2024-07-01 11:22:20.203356836 +0200
@@ -16,16 +16,14 @@
#
-%define skip_python2 1
+%{?sle15_python_module_pythons}
Name: python-pip-licenses
-Version: 4.3.4
+Version: 4.4.0
Release: 0
Summary: Python packages license list
License: MIT
URL: https://github.com/raimon49/pip-licenses
Source:
https://files.pythonhosted.org/packages/source/p/pip-licenses/pip-licenses-%{version}.tar.gz
-# FIX-UPSTREAM https://github.com/raimon49/pip-licenses/pull/184
-Patch1: 0001-Fix-test_different_python-under-pyhon-3.12.patch
BuildRequires: %{python_module importlib_metadata}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
++++++ pip-licenses-4.3.4.tar.gz -> pip-licenses-4.4.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pip-licenses-4.3.4/CHANGELOG.md
new/pip-licenses-4.4.0/CHANGELOG.md
--- old/pip-licenses-4.3.4/CHANGELOG.md 2024-01-20 03:44:10.000000000 +0100
+++ new/pip-licenses-4.4.0/CHANGELOG.md 2024-03-28 10:41:37.000000000 +0100
@@ -1,5 +1,9 @@
## CHANGELOG
+### 4.4.0
+
+* Implement new option `--partial-match`
+
### 4.3.4
* Maintain to pass test with wcwidth>=0.2.10
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pip-licenses-4.3.4/PKG-INFO
new/pip-licenses-4.4.0/PKG-INFO
--- old/pip-licenses-4.3.4/PKG-INFO 2024-01-20 03:49:26.336636000 +0100
+++ new/pip-licenses-4.4.0/PKG-INFO 2024-03-28 16:21:40.460741800 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: pip-licenses
-Version: 4.3.4
+Version: 4.4.0
Summary: Dump the software license list of Python packages installed with pip.
Home-page: https://github.com/raimon49/pip-licenses
Author: raimon
@@ -79,6 +79,7 @@
- `Option: fail-on <#option-fail-on>`__
- `Option: allow-only <#option-allow-only>`__
+ - `Option: partial-match <#option-partial-match>`__
- `More Information <#more-information>`__
@@ -702,6 +703,52 @@
$ echo $?
1
+Option: partial-match
+^^^^^^^^^^^^^^^^^^^^^
+
+If set, enables partial (substring) matching for ``--fail-on`` or
+``--allow-only``. Default is unset (False).
+
+Usage:
+
+.. code:: bash
+
+ (venv) $ pip-licenses --partial-match --allow-only="MIT License;BSD License"
+ (venv) $ pip-licenses --partial-match --fail-on="MIT License;BSD License"
+
+**Note:** Semantics are the same as with ``--fail-on`` or
+``--allow-only``. This only enables substring matching.
+
+::
+
+ # keyring library has 2 licenses
+ $ pip-licenses --package keyring
+ Name Version License
+ keyring 23.0.1 MIT License; Python Software Foundation License
+
+ # One or both licenses must be specified (order and case does not matter).
Following checks will pass:
+ $ pip-licenses --package keyring --allow-only="MIT License"
+ $ pip-licenses --package keyring --allow-only="mit License"
+ $ pip-licenses --package keyring --allow-only="BSD License;MIT License"
+ $ pip-licenses --package keyring --allow-only="Python Software Foundation
License"
+ $ pip-licenses --package keyring --allow-only="Python Software Foundation
License;MIT License"
+
+ # These won't pass, as they're not a full match against one of the licenses
+ $ pip-licenses --package keyring --allow-only="MIT"
+ $ echo $?
+ 1
+ $ pip-licenses --package keyring --allow-only="mit"
+ $ echo $?
+ 1
+
+ # with --partial-match, they pass
+ $ pip-licenses --package keyring --partial-match --allow-only="MIT"
+ $ echo $?
+ 0
+ $ pip-licenses --package keyring --partial-match --allow-only="mit"
+ $ echo $?
+ 0
+
More Information
~~~~~~~~~~~~~~~~
@@ -830,6 +877,13 @@
CHANGELOG
---------
+.. _440:
+
+4.4.0
+~~~~~
+
+- Implement new option ``--partial-match``
+
.. _434:
4.3.4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pip-licenses-4.3.4/README.md
new/pip-licenses-4.4.0/README.md
--- old/pip-licenses-4.3.4/README.md 2023-07-17 12:48:49.000000000 +0200
+++ new/pip-licenses-4.4.0/README.md 2024-03-28 10:40:17.000000000 +0100
@@ -40,6 +40,7 @@
* [Verify options](#verify-options)
* [Option: fail\-on](#option-fail-on)
* [Option: allow\-only](#option-allow-only)
+ * [Option: partial\-match](#option-partial-match)
* [More Information](#more-information)
* [Dockerfile](#dockerfile)
* [About UnicodeEncodeError](#about-unicodeencodeerror)
@@ -545,6 +546,49 @@
1
```
+#### Option: partial\-match
+
+If set, enables partial (substring) matching for `--fail-on` or
`--allow-only`. Default is unset (False).
+
+Usage:
+
+```bash
+(venv) $ pip-licenses --partial-match --allow-only="MIT License;BSD License"
+(venv) $ pip-licenses --partial-match --fail-on="MIT License;BSD License"
+
+```
+
+**Note:** Semantics are the same as with `--fail-on` or `--allow-only`. This
only enables substring matching.
+```
+# keyring library has 2 licenses
+$ pip-licenses --package keyring
+ Name Version License
+ keyring 23.0.1 MIT License; Python Software Foundation License
+
+# One or both licenses must be specified (order and case does not matter).
Following checks will pass:
+$ pip-licenses --package keyring --allow-only="MIT License"
+$ pip-licenses --package keyring --allow-only="mit License"
+$ pip-licenses --package keyring --allow-only="BSD License;MIT License"
+$ pip-licenses --package keyring --allow-only="Python Software Foundation
License"
+$ pip-licenses --package keyring --allow-only="Python Software Foundation
License;MIT License"
+
+# These won't pass, as they're not a full match against one of the licenses
+$ pip-licenses --package keyring --allow-only="MIT"
+$ echo $?
+1
+$ pip-licenses --package keyring --allow-only="mit"
+$ echo $?
+1
+
+# with --partial-match, they pass
+$ pip-licenses --package keyring --partial-match --allow-only="MIT"
+$ echo $?
+0
+$ pip-licenses --package keyring --partial-match --allow-only="mit"
+$ echo $?
+0
+```
+
### More Information
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pip-licenses-4.3.4/pip_licenses.egg-info/PKG-INFO
new/pip-licenses-4.4.0/pip_licenses.egg-info/PKG-INFO
--- old/pip-licenses-4.3.4/pip_licenses.egg-info/PKG-INFO 2024-01-20
03:49:26.000000000 +0100
+++ new/pip-licenses-4.4.0/pip_licenses.egg-info/PKG-INFO 2024-03-28
16:21:40.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: pip-licenses
-Version: 4.3.4
+Version: 4.4.0
Summary: Dump the software license list of Python packages installed with pip.
Home-page: https://github.com/raimon49/pip-licenses
Author: raimon
@@ -79,6 +79,7 @@
- `Option: fail-on <#option-fail-on>`__
- `Option: allow-only <#option-allow-only>`__
+ - `Option: partial-match <#option-partial-match>`__
- `More Information <#more-information>`__
@@ -702,6 +703,52 @@
$ echo $?
1
+Option: partial-match
+^^^^^^^^^^^^^^^^^^^^^
+
+If set, enables partial (substring) matching for ``--fail-on`` or
+``--allow-only``. Default is unset (False).
+
+Usage:
+
+.. code:: bash
+
+ (venv) $ pip-licenses --partial-match --allow-only="MIT License;BSD License"
+ (venv) $ pip-licenses --partial-match --fail-on="MIT License;BSD License"
+
+**Note:** Semantics are the same as with ``--fail-on`` or
+``--allow-only``. This only enables substring matching.
+
+::
+
+ # keyring library has 2 licenses
+ $ pip-licenses --package keyring
+ Name Version License
+ keyring 23.0.1 MIT License; Python Software Foundation License
+
+ # One or both licenses must be specified (order and case does not matter).
Following checks will pass:
+ $ pip-licenses --package keyring --allow-only="MIT License"
+ $ pip-licenses --package keyring --allow-only="mit License"
+ $ pip-licenses --package keyring --allow-only="BSD License;MIT License"
+ $ pip-licenses --package keyring --allow-only="Python Software Foundation
License"
+ $ pip-licenses --package keyring --allow-only="Python Software Foundation
License;MIT License"
+
+ # These won't pass, as they're not a full match against one of the licenses
+ $ pip-licenses --package keyring --allow-only="MIT"
+ $ echo $?
+ 1
+ $ pip-licenses --package keyring --allow-only="mit"
+ $ echo $?
+ 1
+
+ # with --partial-match, they pass
+ $ pip-licenses --package keyring --partial-match --allow-only="MIT"
+ $ echo $?
+ 0
+ $ pip-licenses --package keyring --partial-match --allow-only="mit"
+ $ echo $?
+ 0
+
More Information
~~~~~~~~~~~~~~~~
@@ -830,6 +877,13 @@
CHANGELOG
---------
+.. _440:
+
+4.4.0
+~~~~~
+
+- Implement new option ``--partial-match``
+
.. _434:
4.3.4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pip-licenses-4.3.4/piplicenses.py
new/pip-licenses-4.4.0/piplicenses.py
--- old/pip-licenses-4.3.4/piplicenses.py 2024-01-20 03:43:34.000000000
+0100
+++ new/pip-licenses-4.4.0/piplicenses.py 2024-03-28 10:41:02.000000000
+0100
@@ -56,7 +56,7 @@
open = open # allow monkey patching
__pkgname__ = "pip-licenses"
-__version__ = "4.3.4"
+__version__ = "4.4.0"
__author__ = "raimon"
__license__ = "MIT"
__summary__ = (
@@ -316,9 +316,15 @@
)
if fail_on_licenses:
- failed_licenses = case_insensitive_set_intersect(
- license_names, fail_on_licenses
- )
+ failed_licenses = set()
+ if not args.partial_match:
+ failed_licenses = case_insensitive_set_intersect(
+ license_names, fail_on_licenses
+ )
+ else:
+ failed_licenses = case_insensitive_partial_match_set_intersect(
+ license_names, fail_on_licenses
+ )
if failed_licenses:
sys.stderr.write(
"fail-on license {} was found for package "
@@ -331,9 +337,16 @@
sys.exit(1)
if allow_only_licenses:
- uncommon_licenses = case_insensitive_set_diff(
- license_names, allow_only_licenses
- )
+ uncommon_licenses = set()
+ if not args.partial_match:
+ uncommon_licenses = case_insensitive_set_diff(
+ license_names, allow_only_licenses
+ )
+ else:
+ uncommon_licenses = case_insensitive_partial_match_set_diff(
+ license_names, allow_only_licenses
+ )
+
if len(uncommon_licenses) == len(license_names):
sys.stderr.write(
"license {} not in allow-only licenses was found"
@@ -409,6 +422,24 @@
return common_items
+def case_insensitive_partial_match_set_intersect(set_a, set_b):
+ common_items = set()
+ for item_a in set_a:
+ for item_b in set_b:
+ if item_b.lower() in item_a.lower():
+ common_items.add(item_a)
+ return common_items
+
+
+def case_insensitive_partial_match_set_diff(set_a, set_b):
+ uncommon_items = set_a.copy()
+ for item_a in set_a:
+ for item_b in set_b:
+ if item_b.lower() in item_a.lower():
+ uncommon_items.remove(item_a)
+ return uncommon_items
+
+
def case_insensitive_set_diff(set_a, set_b):
"""Same as set.difference() but case-insensitive"""
uncommon_items = set()
@@ -761,6 +792,7 @@
with_notice_file: bool
filter_strings: bool
filter_code_page: str
+ partial_match: bool
fail_on: Optional[str]
allow_only: Optional[str]
@@ -1055,6 +1087,12 @@
help="fail (exit with code 1) on the first occurrence "
"of the licenses not in the semicolon-separated list",
)
+ verify_options.add_argument(
+ "--partial-match",
+ action="store_true",
+ default=False,
+ help="enables partial matching for --allow-only/--fail-on",
+ )
return parser
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pip-licenses-4.3.4/test_piplicenses.py
new/pip-licenses-4.4.0/test_piplicenses.py
--- old/pip-licenses-4.3.4/test_piplicenses.py 2024-01-20 03:35:27.000000000
+0100
+++ new/pip-licenses-4.4.0/test_piplicenses.py 2024-03-28 10:40:17.000000000
+0100
@@ -33,6 +33,8 @@
CompatibleArgumentParser,
FromArg,
__pkgname__,
+ case_insensitive_partial_match_set_diff,
+ case_insensitive_partial_match_set_intersect,
case_insensitive_set_diff,
case_insensitive_set_intersect,
create_licenses_table,
@@ -769,6 +771,42 @@
self.assertTrue({"revised BSD"} == b_intersect_c)
self.assertTrue(len(a_intersect_empty) == 0)
+ def test_case_insensitive_partial_match_set_diff(self) -> None:
+ set_a = {"MIT License"}
+ set_b = {"Mit", "BSD License"}
+ set_c = {"mit license"}
+ a_diff_b = case_insensitive_partial_match_set_diff(set_a, set_b)
+ a_diff_c = case_insensitive_partial_match_set_diff(set_a, set_c)
+ b_diff_c = case_insensitive_partial_match_set_diff(set_b, set_c)
+ a_diff_empty = case_insensitive_partial_match_set_diff(set_a, set())
+
+ self.assertTrue(len(a_diff_b) == 0)
+ self.assertTrue(len(a_diff_c) == 0)
+ self.assertIn("BSD License", b_diff_c)
+ self.assertIn("MIT License", a_diff_empty)
+
+ def test_case_insensitive_partial_match_set_intersect(self) -> None:
+ set_a = {"Revised BSD"}
+ set_b = {"Apache License", "revised BSD"}
+ set_c = {"bsd"}
+ a_intersect_b = case_insensitive_partial_match_set_intersect(
+ set_a, set_b
+ )
+ a_intersect_c = case_insensitive_partial_match_set_intersect(
+ set_a, set_c
+ )
+ b_intersect_c = case_insensitive_partial_match_set_intersect(
+ set_b, set_c
+ )
+ a_intersect_empty = case_insensitive_partial_match_set_intersect(
+ set_a, set()
+ )
+
+ self.assertTrue(set_a == a_intersect_b)
+ self.assertTrue(set_a == a_intersect_c)
+ self.assertTrue({"revised BSD"} == b_intersect_c)
+ self.assertTrue(len(a_intersect_empty) == 0)
+
class MockStdStream(object):
def __init__(self) -> None:
@@ -850,6 +888,35 @@
)
+def test_allow_only_partial(monkeypatch) -> None:
+ licenses = (
+ "Bsd",
+ "Apache",
+ "Mozilla Public License 2.0 (MPL 2.0)",
+ "Python Software Foundation License",
+ "Public Domain",
+ "GNU General Public License (GPL)",
+ "GNU Library or Lesser General Public License (LGPL)",
+ )
+ allow_only_args = [
+ "--partial-match",
+ "--allow-only={}".format(";".join(licenses)),
+ ]
+ mocked_stdout = MockStdStream()
+ mocked_stderr = MockStdStream()
+ monkeypatch.setattr(sys.stdout, "write", mocked_stdout.write)
+ monkeypatch.setattr(sys.stderr, "write", mocked_stderr.write)
+ monkeypatch.setattr(sys, "exit", lambda n: None)
+ args = create_parser().parse_args(allow_only_args)
+ create_licenses_table(args)
+
+ assert "" == mocked_stdout.printed
+ assert (
+ "license MIT License not in allow-only licenses was found for "
+ "package" in mocked_stderr.printed
+ )
+
+
def test_different_python() -> None:
import tempfile
@@ -867,7 +934,10 @@
package_names = sorted(set(p["name"] for p in pkgs))
print(package_names)
- assert package_names == ["pip", "setuptools"]
+ expected_packages = ["pip"]
+ if sys.version_info < (3, 12, 0):
+ expected_packages.append("setuptools")
+ assert package_names == expected_packages
def test_fail_on(monkeypatch) -> None:
@@ -876,6 +946,27 @@
mocked_stdout = MockStdStream()
mocked_stderr = MockStdStream()
monkeypatch.setattr(sys.stdout, "write", mocked_stdout.write)
+ monkeypatch.setattr(sys.stderr, "write", mocked_stderr.write)
+ monkeypatch.setattr(sys, "exit", lambda n: None)
+ args = create_parser().parse_args(allow_only_args)
+ create_licenses_table(args)
+
+ assert "" == mocked_stdout.printed
+ assert (
+ "fail-on license MIT License was found for "
+ "package" in mocked_stderr.printed
+ )
+
+
+def test_fail_on_partial_match(monkeypatch) -> None:
+ licenses = ("MIT",)
+ allow_only_args = [
+ "--partial-match",
+ "--fail-on={}".format(";".join(licenses)),
+ ]
+ mocked_stdout = MockStdStream()
+ mocked_stderr = MockStdStream()
+ monkeypatch.setattr(sys.stdout, "write", mocked_stdout.write)
monkeypatch.setattr(sys.stderr, "write", mocked_stderr.write)
monkeypatch.setattr(sys, "exit", lambda n: None)
args = create_parser().parse_args(allow_only_args)