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 2023-05-05 15:57:37
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pip-licenses (Old)
and /work/SRC/openSUSE:Factory/.python-pip-licenses.new.1533 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pip-licenses"
Fri May 5 15:57:37 2023 rev:11 rq:1084817 version:4.3.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pip-licenses/python-pip-licenses.changes
2023-04-12 15:48:23.034752858 +0200
+++
/work/SRC/openSUSE:Factory/.python-pip-licenses.new.1533/python-pip-licenses.changes
2023-05-05 15:57:41.140222824 +0200
@@ -1,0 +2,9 @@
+Thu May 4 16:56:21 UTC 2023 - Daniel Garcia <[email protected]>
+
+- Update to 4.3.1:
+ * Fix to treat package names as normalized as in PEP 503 with
+ --packages and --ignore-packages option
+- 4.3.0:
+ * Implement new option --no-version
+
+-------------------------------------------------------------------
Old:
----
pip-licenses-4.2.0.tar.gz
New:
----
pip-licenses-4.3.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-pip-licenses.spec ++++++
--- /var/tmp/diff_new_pack.RYzsYO/_old 2023-05-05 15:57:41.656225780 +0200
+++ /var/tmp/diff_new_pack.RYzsYO/_new 2023-05-05 15:57:41.664225826 +0200
@@ -18,7 +18,7 @@
%define skip_python2 1
Name: python-pip-licenses
-Version: 4.2.0
+Version: 4.3.1
Release: 0
Summary: Python packages license list
License: MIT
@@ -40,6 +40,7 @@
BuildRequires: %{python_module docutils}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module py}
+BuildRequires: %{python_module typing_extensions}
BuildRequires: %{python_module wheel}
# /SECTION
%python_subpackages
@@ -65,8 +66,7 @@
%check
export LANG=en_US.UTF-8
# gh#raimon49/pip-licenses#120 for test_from_all
-# gh#raimon49/pip-licenses#156 for test_different_python
-%pytest -k 'not (test_from_all or test_different_python)'
+%pytest -k 'not test_from_all'
%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib}
%{buildroot}%{_bindir}/pip-licenses-%{$python_bin_suffix} -s
%post
++++++ pip-licenses-4.2.0.tar.gz -> pip-licenses-4.3.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pip-licenses-4.2.0/CHANGELOG.md
new/pip-licenses-4.3.1/CHANGELOG.md
--- old/pip-licenses-4.2.0/CHANGELOG.md 2023-04-12 11:58:29.000000000 +0200
+++ new/pip-licenses-4.3.1/CHANGELOG.md 2023-05-04 04:29:28.000000000 +0200
@@ -1,5 +1,13 @@
## CHANGELOG
+### 4.3.1
+
+* Fix to treat package names as normalized as in [PEP
503](https://peps.python.org/pep-0503/) with `--packages` and
`--ignore-packages` option
+
+### 4.3.0
+
+* Implement new option `--no-version`
+
### 4.2.0
* Implement new option `--with-maintainers`
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pip-licenses-4.2.0/PKG-INFO
new/pip-licenses-4.3.1/PKG-INFO
--- old/pip-licenses-4.2.0/PKG-INFO 2023-04-12 13:24:35.490549600 +0200
+++ new/pip-licenses-4.3.1/PKG-INFO 2023-05-04 04:33:00.846429300 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: pip-licenses
-Version: 4.2.0
+Version: 4.3.1
Summary: Dump the software license list of Python packages installed with pip.
Home-page: https://github.com/raimon49/pip-licenses
Author: raimon
@@ -70,6 +70,7 @@
- `Option: with-maintainers <#option-with-maintainers>`__
- `Option: with-urls <#option-with-urls>`__
- `Option: with-description <#option-with-description>`__
+ - `Option: no-version <#option-no-version>`__
- `Option: with-license-file <#option-with-license-file>`__
- `Option: filter-strings <#option-filter-strings>`__
- `Option: filter-code-page <#option-filter-code-page>`__
@@ -590,6 +591,19 @@
Django 2.0.2 BSD A high-level Python Web framework that
encourages rapid development and clean, pragmatic design.
pytz 2017.3 MIT World timezone definitions, modern and historical
+Option: no-version
+^^^^^^^^^^^^^^^^^^
+
+When executed with the ``--no-version`` option, output without the
+version number.
+
+.. code:: bash
+
+ (venv) $ pip-licenses --no-version
+ Name License
+ Django BSD
+ pytz MIT
+
Option: with-license-file
^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -815,6 +829,22 @@
CHANGELOG
---------
+.. _431:
+
+4.3.1
+~~~~~
+
+- Fix to treat package names as normalized as in `PEP
+ 503 <https://peps.python.org/pep-0503/>`__ with ``--packages`` and
+ ``--ignore-packages`` option
+
+.. _430:
+
+4.3.0
+~~~~~
+
+- Implement new option ``--no-version``
+
.. _420:
4.2.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pip-licenses-4.2.0/README.md
new/pip-licenses-4.3.1/README.md
--- old/pip-licenses-4.2.0/README.md 2023-04-12 11:58:26.000000000 +0200
+++ new/pip-licenses-4.3.1/README.md 2023-04-25 10:07:16.000000000 +0200
@@ -33,6 +33,7 @@
* [Option: with\-maintainers](#option-with-maintainers)
* [Option: with\-urls](#option-with-urls)
* [Option: with\-description](#option-with-description)
+ * [Option: no\-version](#option-no-version)
* [Option: with\-license\-file](#option-with-license-file)
* [Option: filter\-strings](#option-filter-strings)
* [Option: filter\-code\-page](#option-filter-code-page)
@@ -458,6 +459,17 @@
pytz 2017.3 MIT World timezone definitions, modern and historical
```
+#### Option: no-version
+
+When executed with the `--no-version` option, output without the version
number.
+
+```bash
+(venv) $ pip-licenses --no-version
+ Name License
+ Django BSD
+ pytz MIT
+```
+
#### Option: with-license-file
When executed with the `--with-license-file` option, output the location of
the package's license file on disk and the full contents of that file. Due to
the length of these fields, this option is best paired with `--format=json`.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pip-licenses-4.2.0/pip_licenses.egg-info/PKG-INFO
new/pip-licenses-4.3.1/pip_licenses.egg-info/PKG-INFO
--- old/pip-licenses-4.2.0/pip_licenses.egg-info/PKG-INFO 2023-04-12
13:24:35.000000000 +0200
+++ new/pip-licenses-4.3.1/pip_licenses.egg-info/PKG-INFO 2023-05-04
04:33:00.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: pip-licenses
-Version: 4.2.0
+Version: 4.3.1
Summary: Dump the software license list of Python packages installed with pip.
Home-page: https://github.com/raimon49/pip-licenses
Author: raimon
@@ -70,6 +70,7 @@
- `Option: with-maintainers <#option-with-maintainers>`__
- `Option: with-urls <#option-with-urls>`__
- `Option: with-description <#option-with-description>`__
+ - `Option: no-version <#option-no-version>`__
- `Option: with-license-file <#option-with-license-file>`__
- `Option: filter-strings <#option-filter-strings>`__
- `Option: filter-code-page <#option-filter-code-page>`__
@@ -590,6 +591,19 @@
Django 2.0.2 BSD A high-level Python Web framework that
encourages rapid development and clean, pragmatic design.
pytz 2017.3 MIT World timezone definitions, modern and historical
+Option: no-version
+^^^^^^^^^^^^^^^^^^
+
+When executed with the ``--no-version`` option, output without the
+version number.
+
+.. code:: bash
+
+ (venv) $ pip-licenses --no-version
+ Name License
+ Django BSD
+ pytz MIT
+
Option: with-license-file
^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -815,6 +829,22 @@
CHANGELOG
---------
+.. _431:
+
+4.3.1
+~~~~~
+
+- Fix to treat package names as normalized as in `PEP
+ 503 <https://peps.python.org/pep-0503/>`__ with ``--packages`` and
+ ``--ignore-packages`` option
+
+.. _430:
+
+4.3.0
+~~~~~
+
+- Implement new option ``--no-version``
+
.. _420:
4.2.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pip-licenses-4.2.0/piplicenses.py
new/pip-licenses-4.3.1/piplicenses.py
--- old/pip-licenses-4.2.0/piplicenses.py 2023-04-12 13:23:06.000000000
+0200
+++ new/pip-licenses-4.3.1/piplicenses.py 2023-05-04 04:26:34.000000000
+0200
@@ -56,7 +56,7 @@
open = open # allow monkey patching
__pkgname__ = "pip-licenses"
-__version__ = "4.2.0"
+__version__ = "4.3.1"
__author__ = "raimon"
__license__ = "MIT"
__summary__ = (
@@ -129,6 +129,24 @@
return None
+PATTERN_DELIMITER = re.compile(r"[-_.]+")
+
+
+def normalize_pkg_name(pkg_name: str) -> str:
+ """Return normalized name according to PEP specification
+
+ See here: https://peps.python.org/pep-0503/#normalized-names
+
+ Args:
+ pkg_name: Package name it is extracted from the package metadata
+ or specified in the CLI
+
+ Returns:
+ normalized packege name
+ """
+ return PATTERN_DELIMITER.sub("-", pkg_name).lower()
+
+
METADATA_KEYS: Dict[str, List[Callable[[Message], Optional[str]]]] = {
"home-page": [extract_homepage],
"author": [
@@ -254,8 +272,10 @@
search_paths = get_python_sys_path(args.python)
pkgs = importlib_metadata.distributions(path=search_paths)
- ignore_pkgs_as_lower = [pkg.lower() for pkg in args.ignore_packages]
- pkgs_as_lower = [pkg.lower() for pkg in args.packages]
+ ignore_pkgs_as_normalize = [
+ normalize_pkg_name(pkg) for pkg in args.ignore_packages
+ ]
+ pkgs_as_normalize = [normalize_pkg_name(pkg) for pkg in args.packages]
fail_on_licenses = set()
if args.fail_on:
@@ -266,16 +286,16 @@
allow_only_licenses = set(map(str.strip, args.allow_only.split(";")))
for pkg in pkgs:
- pkg_name = pkg.metadata["name"]
+ pkg_name = normalize_pkg_name(pkg.metadata["name"])
pkg_name_and_version = pkg_name + ":" + pkg.metadata["version"]
if (
- pkg_name.lower() in ignore_pkgs_as_lower
- or pkg_name_and_version.lower() in ignore_pkgs_as_lower
+ pkg_name.lower() in ignore_pkgs_as_normalize
+ or pkg_name_and_version.lower() in ignore_pkgs_as_normalize
):
continue
- if pkgs_as_lower and pkg_name.lower() not in pkgs_as_lower:
+ if pkgs_as_normalize and pkg_name.lower() not in pkgs_as_normalize:
continue
if not args.with_system and pkg_name in SYSTEM_PACKAGES:
@@ -594,6 +614,9 @@
if args.with_description:
output_fields.append("Description")
+ if args.no_version:
+ output_fields.remove("Version")
+
if args.with_license_file:
if not args.no_license_path:
output_fields.append("LicenseFile")
@@ -967,6 +990,13 @@
help="dump with short package description",
)
format_options.add_argument(
+ "-nv",
+ "--no-version",
+ action="store_true",
+ default=False,
+ help="dump without package version",
+ )
+ format_options.add_argument(
"-l",
"--with-license-file",
action="store_true",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pip-licenses-4.2.0/test_piplicenses.py
new/pip-licenses-4.3.1/test_piplicenses.py
--- old/pip-licenses-4.2.0/test_piplicenses.py 2023-04-12 11:58:29.000000000
+0200
+++ new/pip-licenses-4.3.1/test_piplicenses.py 2023-05-04 04:22:44.000000000
+0200
@@ -46,6 +46,7 @@
get_output_fields,
get_packages,
get_sortby,
+ normalize_pkg_name,
output_colored,
save_if_needs,
select_license_by_source,
@@ -344,6 +345,17 @@
output_string = create_output_string(args)
self.assertIn("Description", output_string)
+ def test_without_version(self) -> None:
+ without_version_args = ["--no-version"]
+ args = self.parser.parse_args(without_version_args)
+
+ output_fields = get_output_fields(args)
+ self.assertNotEqual(output_fields, list(DEFAULT_OUTPUT_FIELDS))
+ self.assertNotIn("Version", output_fields)
+
+ output_string = create_output_string(args)
+ self.assertNotIn("Version", output_string)
+
def test_with_license_file(self) -> None:
with_license_file_args = ["--with-license-file"]
args = self.parser.parse_args(with_license_file_args)
@@ -418,6 +430,18 @@
pkg_name_columns = self._create_pkg_name_columns(table)
self.assertNotIn(ignore_pkg_name, pkg_name_columns)
+ def test_ignore_normalized_packages(self) -> None:
+ ignore_pkg_name = "pip-licenses"
+ ignore_packages_args = [
+ "--ignore-package=pip_licenses",
+ "--with-system",
+ ]
+ args = self.parser.parse_args(ignore_packages_args)
+ table = create_licenses_table(args)
+
+ pkg_name_columns = self._create_pkg_name_columns(table)
+ self.assertNotIn(ignore_pkg_name, pkg_name_columns)
+
def test_ignore_packages_and_version(self) -> None:
# Fictitious version that does not exist
ignore_pkg_name = "prettytable"
@@ -442,6 +466,18 @@
pkg_name_columns = self._create_pkg_name_columns(table)
self.assertListEqual([pkg_name], pkg_name_columns)
+ def test_with_normalized_packages(self) -> None:
+ pkg_name = "typing_extensions"
+ only_packages_args = [
+ "--package=typing-extensions",
+ "--with-system",
+ ]
+ args = self.parser.parse_args(only_packages_args)
+ table = create_licenses_table(args)
+
+ pkg_name_columns = self._create_pkg_name_columns(table)
+ self.assertListEqual([pkg_name], pkg_name_columns)
+
def test_with_packages_with_system(self) -> None:
pkg_name = "prettytable"
only_packages_args = ["--packages=" + pkg_name, "--with-system"]
@@ -830,7 +866,7 @@
python_arg = f"--python={python_exec}"
args = create_parser().parse_args([python_arg, "-s", "-f=json"])
pkgs = get_packages(args)
- package_names = sorted(p["name"] for p in pkgs)
+ package_names = sorted(set(p["name"] for p in pkgs))
print(package_names)
assert package_names == ["pip", "setuptools"]
@@ -909,6 +945,14 @@
assert arg in capture
+def test_normalize_pkg_name() -> None:
+ expected_normalized_name = "pip-licenses"
+
+ assert normalize_pkg_name("pip_licenses") == expected_normalized_name
+ assert normalize_pkg_name("pip.licenses") == expected_normalized_name
+ assert normalize_pkg_name("Pip-Licenses") == expected_normalized_name
+
+
def test_extract_homepage_home_page_set() -> None:
metadata = MagicMock()
metadata.get.return_value = "Foobar"