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 2022-11-06 12:42:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pip-licenses (Old) and /work/SRC/openSUSE:Factory/.python-pip-licenses.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pip-licenses" Sun Nov 6 12:42:21 2022 rev:7 rq:1033784 version:4.0.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pip-licenses/python-pip-licenses.changes 2022-02-26 17:02:51.375543272 +0100 +++ /work/SRC/openSUSE:Factory/.python-pip-licenses.new.2275/python-pip-licenses.changes 2022-11-06 12:42:38.593539762 +0100 @@ -1,0 +2,12 @@ +Sun Nov 6 07:53:28 UTC 2022 - Matej Cepl <mc...@suse.com> + +- Update to 4.0.0: + - Support for Python 3.11 + - Dropped support Python 3.7 + - Migrate Docker base image from Alpine to Debian 11-slim + - Breaking changes + - Does not work with PTable and depends on prettytable + - Depend on importlib_metadata rather than pip +- Remove unnecessary no-pip-internal.patch. + +------------------------------------------------------------------- Old: ---- no-pip-internal.patch pip-licenses-3.5.2.tar.gz New: ---- pip-licenses-4.0.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pip-licenses.spec ++++++ --- /var/tmp/diff_new_pack.dlO1Kw/_old 2022-11-06 12:42:39.269543799 +0100 +++ /var/tmp/diff_new_pack.dlO1Kw/_new 2022-11-06 12:42:39.273543823 +0100 @@ -16,18 +16,15 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-pip-licenses -Version: 3.5.2 +Version: 4.0.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 -# PATCH-FIX-UPSTREAM no-pip-internal.patch gh#raimon49/pip-licenses#116 mc...@suse.com -# replace missing get_installed_distributions() -Patch0: no-pip-internal.patch +BuildRequires: %{python_module importlib_metadata} BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools} BuildRequires: fdupes @@ -49,32 +46,24 @@ Dump the software license list of Python packages installed with pip. %prep -%setup -q -n pip-licenses-%{version} -%autopatch -p1 - -# PTable is an incompatible PrettyTable fork, and pip-licenses supports -# either https://github.com/raimon49/pip-licenses/pull/52 -sed -i 's/PTable/prettytable/' setup.cfg piplicenses.py test_piplicenses.py +%autosetup -p1 -n pip-licenses-%{version} sed -i '/addopts/d' setup.cfg sed -i '/pytest-/d' setup.cfg sed -i '1{/^#!/d}' piplicenses.py %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_clone -a %{buildroot}%{_bindir}/pip-licenses %python_expand %fdupes %{buildroot}%{$python_sitelib} %check export LANG=en_US.UTF-8 -# test_format_plain_vertical fails due to pytest output incompatibility -# test_from_meta fails due to SPDX license naming -# gh#raimon49/pip-licenses#120 for -# test_format_csv, test_format_json, test_format_json_license_manager, and test_from_all -%pytest -k 'not (test_format_plain_vertical or test_from_meta or test_format_csv or test_format_json or test_format_json_license_manager or test_from_all)' +# gh#raimon49/pip-licenses#120 for test_from_all +%pytest -k 'not test_from_all' %python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} %{buildroot}%{_bindir}/pip-licenses-%{$python_bin_suffix} -s %post @@ -87,6 +76,8 @@ %doc CHANGELOG.md README.md %license LICENSE %python_alternative %{_bindir}/pip-licenses -%{python_sitelib}/* +%{python_sitelib}/piplicenses.py +%{python_sitelib}/pip_licenses-%{version}*-info +%pycache_only %{python_sitelib}/__pycache__/piplicenses.*pyc %changelog ++++++ pip-licenses-3.5.2.tar.gz -> pip-licenses-4.0.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pip-licenses-3.5.2/CHANGELOG.md new/pip-licenses-4.0.0/CHANGELOG.md --- old/pip-licenses-3.5.2/CHANGELOG.md 2021-08-27 08:55:48.000000000 +0200 +++ new/pip-licenses-4.0.0/CHANGELOG.md 2022-11-06 04:15:10.000000000 +0100 @@ -1,5 +1,27 @@ ## CHANGELOG +### 4.0.0 + +* Support for Python 3.11 +* Dropped support Python 3.7 +* Migrate Docker base image from Alpine to Debian 11-slim +* Breaking changes + * Does not work with PTable and depends on prettytable + * Depend on importlib\_metadata rather than pip + +### 3.5.5 + +* Search for path defined in [PEP 639](https://peps.python.org/pep-0639/) with `--with-license-file` option +* Dropped support Python 3.6 + +### 3.5.4 + +* Skip directories when detecting license files + +### 3.5.3 + +* Support pip 21.3 or later + ### 3.5.2 * Ignore spaces around `--fail-on` and `--allow-only` parameters diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pip-licenses-3.5.2/PKG-INFO new/pip-licenses-4.0.0/PKG-INFO --- old/pip-licenses-3.5.2/PKG-INFO 2021-08-27 08:59:21.410000000 +0200 +++ new/pip-licenses-4.0.0/PKG-INFO 2022-11-06 04:22:26.290000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pip-licenses -Version: 3.5.2 +Version: 4.0.0 Summary: Dump the software license list of Python packages installed with pip. Home-page: https://github.com/raimon49/pip-licenses Author: raimon @@ -15,13 +15,13 @@ Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3 :: Only -Classifier: Programming Language :: Python :: 3.6 -Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 Classifier: Topic :: System :: Systems Administration Classifier: Topic :: System :: System Shells -Requires-Python: ~=3.6 +Requires-Python: ~=3.8 Provides-Extra: test License-File: LICENSE @@ -30,7 +30,6 @@ |Build Status| |PyPI - Python Version| |PyPI version| |GitHub Release| |Codecov| |GitHub contributors| |BSD License| |PyPI - Downloads| -|Requirements Status| Dump the software license list of Python packages installed with pip. @@ -109,6 +108,18 @@ # Install or Upgrade to newest available version $ pip install -U pip-licenses + # If upgrading from pip-licenses 3.x, remove PTable + $ pip uninstall -y PTable + +**Note for Python 3.7 users:** pip-licenses 4.x discontinued support +earlier than the Python 3.7 EOL schedule. If you want to use it with +Python 3.7, install pip-licenses 3.x. + +.. code:: bash + + # Using old version for the Python 3.7 environment + $ pip install 'pip-licenses<4.0' + **Note:** If you are still using Python 2.7, install version less than 2.0. No new features will be provided for version 1.x. @@ -441,9 +452,10 @@ (venv) $ pip-licenses --with-system --ignore-packages django pip pip-licenses Name Version License - PTable 0.9.2 BSD (3 clause) + prettytable 3.5.0 BSD License pytz 2017.3 MIT setuptools 38.5.0 UNKNOWN + wcwidth 0.2.5 MIT License Option: packages ^^^^^^^^^^^^^^^^ @@ -461,9 +473,9 @@ .. code:: bash - (venv) $ pip-licenses --with-system --packages PTable pytz + (venv) $ pip-licenses --with-system --packages prettytable pytz Name Version License - PTable 0.9.2 BSD (3 clause) + prettytable 3.5.0 BSD License pytz 2017.3 MIT Format options @@ -475,6 +487,9 @@ By default, system packages such as ``pip`` and ``setuptools`` are ignored. +And ``pip-licenses`` and the implicit dependency ``prettytable`` and +``wcwidth`` will also be ignored. + If you want to output all including system package, use the ``--with-system`` option. @@ -483,11 +498,12 @@ (venv) $ pip-licenses --with-system Name Version License Django 2.0.2 BSD - PTable 0.9.2 BSD (3 clause) pip 9.0.1 MIT pip-licenses 1.0.0 MIT License + prettytable 3.5.0 BSD License pytz 2017.3 MIT setuptools 38.5.0 UNKNOWN + wcwidth 0.2.5 MIT License Option: with-authors ^^^^^^^^^^^^^^^^^^^^ @@ -667,21 +683,18 @@ **Note:** This Docker image can not check package licenses with C and C ++ Extensions. It only works with pure Python package dependencies. -If you want to resolve build environment issues, try adding -``build-base`` packages and more. +If you want to resolve build environment issues, try using not slim +image and more. .. code:: diff + diff --git a/Dockerfile b/Dockerfile + index bfc4edc..175e968 100644 --- a/Dockerfile +++ b/Dockerfile - @@ -7,6 +7,8 @@ WORKDIR ${APPDIR} - - COPY ./docker/requirements.txt ${APPDIR} - - +RUN set -ex && apk add --no-cache --update --virtual .py-deps \ - + build-base - RUN python3 -m venv ${APPDIR}/myapp \ - && source ${APPDIR}/myapp/bin/activate + @@ -1,4 +1,4 @@ + -FROM python:3.11-slim-bullseye + +FROM python:3.11-bullseye About UnicodeEncodeError ------------------------ @@ -705,14 +718,12 @@ Dependencies ~~~~~~~~~~~~ -- `PTable <https://pypi.org/project/PTable/>`__ by Luke Maurits and - maintainer of fork version Kane Blueriver under the BSD-3-Clause - License - - - **Note:** Alternatively, it works fine with the - `PrettyTable <https://pypi.org/project/PrettyTable/>`__ package. - (See also): `Allow using prettytable - #52 <https://github.com/raimon49/pip-licenses/pull/52>`__ +- `prettytable <https://pypi.org/project/prettytable/>`__ by Luke + Maurits and maintainer of fork version Jazzband team under the + BSD-3-Clause License + + - **Note:** This package implicitly requires + `wcwidth <https://pypi.org/project/wcwidth/>`__. ``pip-licenses`` has been implemented in the policy to minimize the dependence on external package. @@ -724,7 +735,7 @@ .. code:: bash - $ pip uninstall pip-licenses PTable + $ pip uninstall pip-licenses prettytable wcwidth Contributing ------------ @@ -748,13 +759,48 @@ :target: https://github.com/raimon49/pip-licenses/blob/master/LICENSE .. |PyPI - Downloads| image:: https://img.shields.io/pypi/dm/pip-licenses :target: https://pypistats.org/packages/pip-licenses -.. |Requirements Status| image:: https://requires.io/github/raimon49/pip-licenses/requirements.svg?branch=master - :target: https://requires.io/github/raimon49/pip-licenses/requirements/?branch=master CHANGELOG --------- +.. _400: + +4.0.0 +~~~~~ + +- Support for Python 3.11 +- Dropped support Python 3.7 +- Migrate Docker base image from Alpine to Debian 11-slim +- Breaking changes + + - Does not work with PTable and depends on prettytable + - Depend on importlib_metadata rather than pip + +.. _355: + +3.5.5 +~~~~~ + +- Search for path defined in `PEP + 639 <https://peps.python.org/pep-0639/>`__ with + ``--with-license-file`` option +- Dropped support Python 3.6 + +.. _354: + +3.5.4 +~~~~~ + +- Skip directories when detecting license files + +.. _353: + +3.5.3 +~~~~~ + +- Support pip 21.3 or later + .. _352: 3.5.2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pip-licenses-3.5.2/README.md new/pip-licenses-4.0.0/README.md --- old/pip-licenses-3.5.2/README.md 2021-07-03 09:10:51.000000000 +0200 +++ new/pip-licenses-4.0.0/README.md 2022-11-06 04:18:47.000000000 +0100 @@ -1,6 +1,6 @@ # pip-licenses -[](https://github.com/raimon49/pip-licenses/actions?query=workflow%3A%22Python+package%22) [](https://pypi.org/project/pip-licenses/) [](https://badge.fury.io/py/pip-licenses) [](https://github.com/raimon49/pip-licenses/releases) [](https://codecov.io/gh/raimon49/pip-licenses) [](https://github.com/raimon49/pip-licenses/graphs/contributors) [](https://github.com/raimon49/pip-licenses/blob/master/LICENSE) [](https://pypistats.org/packages/pip-licenses) [](https://requires.io/github/raimon49/pip-licenses/requirements/?branch=master) +[](https://github.com/raimon49/pip-licenses/actions?query=workflow%3A%22Python+package%22) [](https://pypi.org/project/pip-licenses/) [](https://badge.fury.io/py/pip-licenses) [](https://github.com/raimon49/pip-licenses/releases) [](https://codecov.io/gh/raimon49/pip-licenses) [](https://github.com/raimon49/pip-licenses/graphs/contributors) [](https://github.com/raimon49/pip-licenses/blob/master/LICENSE) [](https://pypistats.org/packages/pip-licenses) Dump the software license list of Python packages installed with pip. @@ -60,6 +60,16 @@ ```bash # Install or Upgrade to newest available version $ pip install -U pip-licenses + +# If upgrading from pip-licenses 3.x, remove PTable +$ pip uninstall -y PTable +``` + +**Note for Python 3.7 users:** pip-licenses 4.x discontinued support earlier than the Python 3.7 EOL schedule. If you want to use it with Python 3.7, install pip-licenses 3.x. + +```bash +# Using old version for the Python 3.7 environment +$ pip install 'pip-licenses<4.0' ``` **Note:** If you are still using Python 2.7, install version less than 2.0. No new features will be provided for version 1.x. @@ -335,9 +345,10 @@ ```bash (venv) $ pip-licenses --with-system --ignore-packages django pip pip-licenses Name Version License - PTable 0.9.2 BSD (3 clause) + prettytable 3.5.0 BSD License pytz 2017.3 MIT setuptools 38.5.0 UNKNOWN + wcwidth 0.2.5 MIT License ``` #### Option: packages @@ -353,9 +364,9 @@ Package names of arguments can be separated by spaces. ```bash -(venv) $ pip-licenses --with-system --packages PTable pytz +(venv) $ pip-licenses --with-system --packages prettytable pytz Name Version License - PTable 0.9.2 BSD (3 clause) + prettytable 3.5.0 BSD License pytz 2017.3 MIT ``` @@ -365,17 +376,20 @@ By default, system packages such as `pip` and `setuptools` are ignored. +And `pip-licenses` and the implicit dependency `prettytable` and `wcwidth` will also be ignored. + If you want to output all including system package, use the `--with-system` option. ```bash (venv) $ pip-licenses --with-system Name Version License Django 2.0.2 BSD - PTable 0.9.2 BSD (3 clause) pip 9.0.1 MIT pip-licenses 1.0.0 MIT License + prettytable 3.5.0 BSD License pytz 2017.3 MIT setuptools 38.5.0 UNKNOWN + wcwidth 0.2.5 MIT License ``` #### Option: with-authors @@ -522,19 +536,16 @@ **Note:** This Docker image can not check package licenses with C and C ++ Extensions. It only works with pure Python package dependencies. -If you want to resolve build environment issues, try adding `build-base` packages and more. +If you want to resolve build environment issues, try using not slim image and more. ```diff +diff --git a/Dockerfile b/Dockerfile +index bfc4edc..175e968 100644 --- a/Dockerfile +++ b/Dockerfile -@@ -7,6 +7,8 @@ WORKDIR ${APPDIR} - - COPY ./docker/requirements.txt ${APPDIR} - -+RUN set -ex && apk add --no-cache --update --virtual .py-deps \ -+ build-base - RUN python3 -m venv ${APPDIR}/myapp \ - && source ${APPDIR}/myapp/bin/activate +@@ -1,4 +1,4 @@ +-FROM python:3.11-slim-bullseye ++FROM python:3.11-bullseye ``` ## About UnicodeEncodeError @@ -554,8 +565,8 @@ ### Dependencies -* [PTable](https://pypi.org/project/PTable/) by Luke Maurits and maintainer of fork version Kane Blueriver under the BSD-3-Clause License - * **Note:** Alternatively, it works fine with the [PrettyTable](https://pypi.org/project/PrettyTable/) package. (See also): [Allow using prettytable #52](https://github.com/raimon49/pip-licenses/pull/52) +* [prettytable](https://pypi.org/project/prettytable/) by Luke Maurits and maintainer of fork version Jazzband team under the BSD-3-Clause License + * **Note:** This package implicitly requires [wcwidth](https://pypi.org/project/wcwidth/). `pip-licenses` has been implemented in the policy to minimize the dependence on external package. @@ -564,7 +575,7 @@ Uninstall package and dependent package with `pip` command. ```bash -$ pip uninstall pip-licenses PTable +$ pip uninstall pip-licenses prettytable wcwidth ``` ## Contributing diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pip-licenses-3.5.2/pip_licenses.egg-info/PKG-INFO new/pip-licenses-4.0.0/pip_licenses.egg-info/PKG-INFO --- old/pip-licenses-3.5.2/pip_licenses.egg-info/PKG-INFO 2021-08-27 08:59:21.000000000 +0200 +++ new/pip-licenses-4.0.0/pip_licenses.egg-info/PKG-INFO 2022-11-06 04:22:26.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pip-licenses -Version: 3.5.2 +Version: 4.0.0 Summary: Dump the software license list of Python packages installed with pip. Home-page: https://github.com/raimon49/pip-licenses Author: raimon @@ -15,13 +15,13 @@ Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3 :: Only -Classifier: Programming Language :: Python :: 3.6 -Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 Classifier: Topic :: System :: Systems Administration Classifier: Topic :: System :: System Shells -Requires-Python: ~=3.6 +Requires-Python: ~=3.8 Provides-Extra: test License-File: LICENSE @@ -30,7 +30,6 @@ |Build Status| |PyPI - Python Version| |PyPI version| |GitHub Release| |Codecov| |GitHub contributors| |BSD License| |PyPI - Downloads| -|Requirements Status| Dump the software license list of Python packages installed with pip. @@ -109,6 +108,18 @@ # Install or Upgrade to newest available version $ pip install -U pip-licenses + # If upgrading from pip-licenses 3.x, remove PTable + $ pip uninstall -y PTable + +**Note for Python 3.7 users:** pip-licenses 4.x discontinued support +earlier than the Python 3.7 EOL schedule. If you want to use it with +Python 3.7, install pip-licenses 3.x. + +.. code:: bash + + # Using old version for the Python 3.7 environment + $ pip install 'pip-licenses<4.0' + **Note:** If you are still using Python 2.7, install version less than 2.0. No new features will be provided for version 1.x. @@ -441,9 +452,10 @@ (venv) $ pip-licenses --with-system --ignore-packages django pip pip-licenses Name Version License - PTable 0.9.2 BSD (3 clause) + prettytable 3.5.0 BSD License pytz 2017.3 MIT setuptools 38.5.0 UNKNOWN + wcwidth 0.2.5 MIT License Option: packages ^^^^^^^^^^^^^^^^ @@ -461,9 +473,9 @@ .. code:: bash - (venv) $ pip-licenses --with-system --packages PTable pytz + (venv) $ pip-licenses --with-system --packages prettytable pytz Name Version License - PTable 0.9.2 BSD (3 clause) + prettytable 3.5.0 BSD License pytz 2017.3 MIT Format options @@ -475,6 +487,9 @@ By default, system packages such as ``pip`` and ``setuptools`` are ignored. +And ``pip-licenses`` and the implicit dependency ``prettytable`` and +``wcwidth`` will also be ignored. + If you want to output all including system package, use the ``--with-system`` option. @@ -483,11 +498,12 @@ (venv) $ pip-licenses --with-system Name Version License Django 2.0.2 BSD - PTable 0.9.2 BSD (3 clause) pip 9.0.1 MIT pip-licenses 1.0.0 MIT License + prettytable 3.5.0 BSD License pytz 2017.3 MIT setuptools 38.5.0 UNKNOWN + wcwidth 0.2.5 MIT License Option: with-authors ^^^^^^^^^^^^^^^^^^^^ @@ -667,21 +683,18 @@ **Note:** This Docker image can not check package licenses with C and C ++ Extensions. It only works with pure Python package dependencies. -If you want to resolve build environment issues, try adding -``build-base`` packages and more. +If you want to resolve build environment issues, try using not slim +image and more. .. code:: diff + diff --git a/Dockerfile b/Dockerfile + index bfc4edc..175e968 100644 --- a/Dockerfile +++ b/Dockerfile - @@ -7,6 +7,8 @@ WORKDIR ${APPDIR} - - COPY ./docker/requirements.txt ${APPDIR} - - +RUN set -ex && apk add --no-cache --update --virtual .py-deps \ - + build-base - RUN python3 -m venv ${APPDIR}/myapp \ - && source ${APPDIR}/myapp/bin/activate + @@ -1,4 +1,4 @@ + -FROM python:3.11-slim-bullseye + +FROM python:3.11-bullseye About UnicodeEncodeError ------------------------ @@ -705,14 +718,12 @@ Dependencies ~~~~~~~~~~~~ -- `PTable <https://pypi.org/project/PTable/>`__ by Luke Maurits and - maintainer of fork version Kane Blueriver under the BSD-3-Clause - License - - - **Note:** Alternatively, it works fine with the - `PrettyTable <https://pypi.org/project/PrettyTable/>`__ package. - (See also): `Allow using prettytable - #52 <https://github.com/raimon49/pip-licenses/pull/52>`__ +- `prettytable <https://pypi.org/project/prettytable/>`__ by Luke + Maurits and maintainer of fork version Jazzband team under the + BSD-3-Clause License + + - **Note:** This package implicitly requires + `wcwidth <https://pypi.org/project/wcwidth/>`__. ``pip-licenses`` has been implemented in the policy to minimize the dependence on external package. @@ -724,7 +735,7 @@ .. code:: bash - $ pip uninstall pip-licenses PTable + $ pip uninstall pip-licenses prettytable wcwidth Contributing ------------ @@ -748,13 +759,48 @@ :target: https://github.com/raimon49/pip-licenses/blob/master/LICENSE .. |PyPI - Downloads| image:: https://img.shields.io/pypi/dm/pip-licenses :target: https://pypistats.org/packages/pip-licenses -.. |Requirements Status| image:: https://requires.io/github/raimon49/pip-licenses/requirements.svg?branch=master - :target: https://requires.io/github/raimon49/pip-licenses/requirements/?branch=master CHANGELOG --------- +.. _400: + +4.0.0 +~~~~~ + +- Support for Python 3.11 +- Dropped support Python 3.7 +- Migrate Docker base image from Alpine to Debian 11-slim +- Breaking changes + + - Does not work with PTable and depends on prettytable + - Depend on importlib_metadata rather than pip + +.. _355: + +3.5.5 +~~~~~ + +- Search for path defined in `PEP + 639 <https://peps.python.org/pep-0639/>`__ with + ``--with-license-file`` option +- Dropped support Python 3.6 + +.. _354: + +3.5.4 +~~~~~ + +- Skip directories when detecting license files + +.. _353: + +3.5.3 +~~~~~ + +- Support pip 21.3 or later + .. _352: 3.5.2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pip-licenses-3.5.2/pip_licenses.egg-info/requires.txt new/pip-licenses-4.0.0/pip_licenses.egg-info/requires.txt --- old/pip-licenses-3.5.2/pip_licenses.egg-info/requires.txt 2021-08-27 08:59:21.000000000 +0200 +++ new/pip-licenses-4.0.0/pip_licenses.egg-info/requires.txt 2022-11-06 04:22:26.000000000 +0100 @@ -1,4 +1,4 @@ -PTable +prettytable>=2.3.0 [test] docutils diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pip-licenses-3.5.2/piplicenses.py new/pip-licenses-4.0.0/piplicenses.py --- old/pip-licenses-3.5.2/piplicenses.py 2021-08-27 08:54:45.000000000 +0200 +++ new/pip-licenses-4.0.0/piplicenses.py 2022-11-06 04:15:45.000000000 +0100 @@ -28,40 +28,24 @@ """ import argparse import codecs -import glob -import os +import re import sys from collections import Counter -from email import message_from_string -from email.parser import FeedParser from enum import Enum, auto from functools import partial +from importlib import metadata as importlib_metadata from typing import List, Optional, Sequence, Text -try: - from pip._internal.utils.misc import get_installed_distributions -except ImportError: # pragma: no cover - from pip import get_installed_distributions - from prettytable import PrettyTable - -try: - from prettytable.prettytable import ALL as RULE_ALL - from prettytable.prettytable import FRAME as RULE_FRAME - from prettytable.prettytable import HEADER as RULE_HEADER - from prettytable.prettytable import NONE as RULE_NONE - PTABLE = True -except ImportError: # pragma: no cover - from prettytable import ALL as RULE_ALL - from prettytable import FRAME as RULE_FRAME - from prettytable import HEADER as RULE_HEADER - from prettytable import NONE as RULE_NONE - PTABLE = False +from prettytable import ALL as RULE_ALL +from prettytable import FRAME as RULE_FRAME +from prettytable import HEADER as RULE_HEADER +from prettytable import NONE as RULE_NONE open = open # allow monkey patching __pkgname__ = 'pip-licenses' -__version__ = '3.5.2' +__version__ = '4.0.0' __author__ = 'raimon' __license__ = 'MIT' __summary__ = ('Dump the software license list of ' @@ -121,7 +105,8 @@ SYSTEM_PACKAGES = ( __pkgname__, 'pip', - 'PTable' if PTABLE else 'prettytable', + 'prettytable', + 'wcwidth', 'setuptools', 'wheel', ) @@ -131,71 +116,59 @@ def get_packages(args: "CustomNamespace"): - def get_pkg_included_file(pkg, file_names): + def get_pkg_included_file(pkg, file_names_rgx): """ Attempt to find the package's included file on disk and return the tuple (included_file_path, included_file_contents). """ included_file = LICENSE_UNKNOWN included_text = LICENSE_UNKNOWN - pkg_dirname = "{}-{}.dist-info".format( - 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] - for test_file in patterns: - if os.path.exists(test_file): - included_file = test_file - with open(test_file, encoding='utf-8', - errors='backslashreplace') as included_file_handle: - included_text = included_file_handle.read() - break - return (included_file, included_text) + + pkg_files = pkg.files or () + pattern = re.compile(file_names_rgx) + matched_rel_paths = filter( + lambda file: pattern.match(file.name), + pkg_files + ) + for rel_path in matched_rel_paths: + abs_path = pkg.locate_file(rel_path) + if not abs_path.is_file(): + continue + included_file = abs_path + with open( + abs_path, + encoding='utf-8', + errors='backslashreplace' + ) as included_file_handle: + included_text = included_file_handle.read() + break + return (str(included_file), included_text) def get_pkg_info(pkg): (license_file, license_text) = get_pkg_included_file( pkg, - ('LICENSE*', 'LICENCE*', 'COPYING*') + "LICEN[CS]E.*|COPYING.*" ) (notice_file, notice_text) = get_pkg_included_file( pkg, - ('NOTICE*',) + "NOTICE.*" ) pkg_info = { - 'name': pkg.project_name, + 'name': pkg.metadata["name"], 'version': pkg.version, - 'namever': str(pkg), + 'namever': "{} {}".format(pkg.metadata["name"], pkg.version), 'licensefile': license_file, 'licensetext': license_text, 'noticefile': notice_file, 'noticetext': notice_text, } - metadata = None - if pkg.has_metadata('METADATA'): - metadata = pkg.get_metadata('METADATA') - - if pkg.has_metadata('PKG-INFO') and metadata is None: - metadata = pkg.get_metadata('PKG-INFO') - - if metadata is None: - for key in METADATA_KEYS: - pkg_info[key] = LICENSE_UNKNOWN - - return pkg_info - - feed_parser = FeedParser() - feed_parser.feed(metadata) - parsed_metadata = feed_parser.close() - + metadata = pkg.metadata for key in METADATA_KEYS: - pkg_info[key] = parsed_metadata.get(key, LICENSE_UNKNOWN) + pkg_info[key] = metadata.get(key, LICENSE_UNKNOWN) - if metadata is not None: - message = message_from_string(metadata) - pkg_info['license_classifier'] = \ - find_license_from_classifier(message) + classifiers = metadata.get_all("classifier", []) + pkg_info['license_classifier'] = \ + find_license_from_classifier(classifiers) if args.filter_strings: for k in pkg_info: @@ -211,7 +184,10 @@ return pkg_info - pkgs = get_installed_distributions() + pkgs = filter( + lambda pkg: pkg.metadata["name"] != "pip-licenses", + importlib_metadata.distributions() + ) ignore_pkgs_as_lower = [pkg.lower() for pkg in args.ignore_packages] pkgs_as_lower = [pkg.lower() for pkg in args.packages] @@ -224,7 +200,7 @@ allow_only_licenses = set(map(str.strip, args.allow_only.split(";"))) for pkg in pkgs: - pkg_name = pkg.project_name + pkg_name = pkg.metadata["name"] if pkg_name.lower() in ignore_pkgs_as_lower: continue @@ -308,12 +284,9 @@ class JsonPrettyTable(PrettyTable): """PrettyTable-like class exporting to JSON""" - def _format_row(self, row, options): + def _format_row(self, row): resrow = {} for (field, value) in zip(self._field_names, row): - if field not in options["fields"]: - continue - resrow[field] = value return resrow @@ -326,7 +299,7 @@ options = self._get_options(kwargs) rows = self._get_rows(options) - formatted_rows = self._format_rows(rows, options) + formatted_rows = self._format_rows(rows) lines = [] for row in formatted_rows: @@ -336,7 +309,7 @@ class JsonLicenseFinderTable(JsonPrettyTable): - def _format_row(self, row, options): + def _format_row(self, row): resrow = {} for (field, value) in zip(self._field_names, row): if field == 'Name': @@ -358,7 +331,7 @@ options = self._get_options(kwargs) rows = self._get_rows(options) - formatted_rows = self._format_rows(rows, options) + formatted_rows = self._format_rows(rows) lines = [] for row in formatted_rows: @@ -386,7 +359,7 @@ options = self._get_options(kwargs) rows = self._get_rows(options) - formatted_rows = self._format_rows(rows, options) + formatted_rows = self._format_rows(rows) lines = [] formatted_header = ','.join(['"%s"' % (esc_quotes(val), ) @@ -450,15 +423,14 @@ return table -def find_license_from_classifier(message): +def find_license_from_classifier(classifiers): licenses = [] - for k, v in message.items(): - if k == 'Classifier' and v.startswith('License'): - license = v.split(' :: ')[-1] - - # Through the declaration of 'Classifier: License :: OSI Approved' - if license != 'OSI Approved': - licenses.append(license) + for classifier in filter(lambda c: c.startswith("License"), classifiers): + license = classifier.split(' :: ')[-1] + + # Through the declaration of 'Classifier: License :: OSI Approved' + if license != 'OSI Approved': + licenses.append(license) return licenses @@ -466,7 +438,8 @@ def select_license_by_source(from_source, license_classifier, license_meta): license_classifier_set = set(license_classifier) or {LICENSE_UNKNOWN} if (from_source == FromArg.CLASSIFIER or - from_source == FromArg.MIXED and len(license_classifier) > 0): + from_source == FromArg.MIXED and + len(license_classifier) > 0): return license_classifier_set else: return {license_meta} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pip-licenses-3.5.2/setup.cfg new/pip-licenses-4.0.0/setup.cfg --- old/pip-licenses-3.5.2/setup.cfg 2021-08-27 08:59:21.410000000 +0200 +++ new/pip-licenses-4.0.0/setup.cfg 2022-11-06 04:22:26.290000000 +0100 @@ -10,24 +10,24 @@ License :: OSI Approved :: MIT License Programming Language :: Python :: 3 Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 Topic :: System :: Systems Administration Topic :: System :: System Shells [options] packages = find: include_package_data = True -python_requires = ~=3.6 +python_requires = ~=3.8 py_modules = piplicenses setup_requires = setuptools >= 40.9.0 pytest-runner install_requires = - PTable + prettytable >= 2.3.0 tests_require = docutils pytest-cov diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pip-licenses-3.5.2/test_piplicenses.py new/pip-licenses-4.0.0/test_piplicenses.py --- old/pip-licenses-3.5.2/test_piplicenses.py 2021-07-06 12:50:56.000000000 +0200 +++ new/pip-licenses-4.0.0/test_piplicenses.py 2022-11-06 04:15:10.000000000 +0100 @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # vim:fenc=utf-8 ff=unix ft=python ts=4 sw=4 sts=4 si et import copy +import email import re import sys import unittest @@ -29,14 +30,35 @@ UNICODE_APPENDIX = f.readline().replace("\n", "") -def get_installed_distributions_mocked(*args, **kwargs): - packages = get_installed_distributions_orig(*args, **kwargs) - if not packages[-1].project_name.endswith(UNICODE_APPENDIX): - packages[-1].project_name += " "+UNICODE_APPENDIX +def importlib_metadata_distributions_mocked(*args, **kwargs): + + class DistributionMocker(piplicenses.importlib_metadata.Distribution): + def __init__(self, orig_dist): + self.__dist = orig_dist + + @property + def metadata(self): + return EmailMessageMocker(self.__dist.metadata) + + class EmailMessageMocker(email.message.Message): + def __init__(self, orig_msg): + self.__msg = orig_msg + + def __getattr__(self, attr): + return getattr(self.__msg, attr) + + def __getitem__(self, key): + if key.lower() == "name": + return self.__msg["name"] + " " + UNICODE_APPENDIX + return self.__msg[key] + + packages = list(importlib_metadata_distributions_orig(*args, **kwargs)) + packages[-1] = DistributionMocker(packages[-1]) return packages -get_installed_distributions_orig = piplicenses.get_installed_distributions +importlib_metadata_distributions_orig = \ + piplicenses.importlib_metadata.distributions class CommandLineTestCase(unittest.TestCase): @@ -171,28 +193,21 @@ self.assertIn(license, license_classifier) def test_find_license_from_classifier(self): - metadata = ('Metadata-Version: 2.0\r\n' - 'Name: pip-licenses\r\n' - 'Version: 1.0.0\r\n' - 'Classifier: License :: OSI Approved :: MIT License\r\n') - message = message_from_string(metadata) + classifiers = ['License :: OSI Approved :: MIT License'] self.assertEqual(['MIT License'], - find_license_from_classifier(message)) + find_license_from_classifier(classifiers)) 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\r\n' - 'Classifier: License :: OSI Approved :: ' - 'GNU General Public License v3 (GPLv3)\r\n' - 'Classifier: License :: OSI Approved :: MIT License\r\n' - 'Classifier: License :: Public Domain\r\n') - message = message_from_string(metadata) + classifiers = [ + 'License :: OSI Approved', + 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', + 'License :: OSI Approved :: MIT License', + 'License :: Public Domain' + ] self.assertEqual(['GNU General Public License v3 (GPLv3)', 'MIT License', 'Public Domain'], - find_license_from_classifier(message)) + find_license_from_classifier(classifiers)) def test_not_found_license_from_classifier(self): metadata_as_no_license = ('Metadata-Version: 2.0\r\n' @@ -222,6 +237,10 @@ select_license_by_source(FromArg.MIXED, [], 'MIT')) + self.assertEqual({'Apache License 2.0'}, + select_license_by_source(FromArg.MIXED, + ['Apache License 2.0'], + 'Apache-2.0')) def test_with_system(self): with_system_args = ['--with-system'] @@ -426,8 +445,8 @@ @unittest.skipIf(sys.version_info < (3, 6, 0), "To unsupport Python 3.5 in the near future") def test_format_rst_without_filter(self): - piplicenses.get_installed_distributions = \ - get_installed_distributions_mocked + piplicenses.importlib_metadata.distributions = \ + importlib_metadata_distributions_mocked format_rst_args = ['--format=rst'] args = self.parser.parse_args(format_rst_args) table = create_licenses_table(args) @@ -439,12 +458,12 @@ self.assertEqual(RULE_ALL, table.hrules) with self.assertRaises(docutils.utils.SystemMessage): self.check_rst(str(table)) - piplicenses.get_installed_distributions = \ - get_installed_distributions_orig + piplicenses.importlib_metadata.distributions = \ + importlib_metadata_distributions_orig def test_format_rst_default_filter(self): - piplicenses.get_installed_distributions = \ - get_installed_distributions_mocked + piplicenses.importlib_metadata.distributions = \ + importlib_metadata_distributions_mocked format_rst_args = ['--format=rst', '--filter-strings'] args = self.parser.parse_args(format_rst_args) table = create_licenses_table(args) @@ -455,8 +474,8 @@ self.assertEqual('+', table.junction_char) self.assertEqual(RULE_ALL, table.hrules) self.check_rst(str(table)) - piplicenses.get_installed_distributions = \ - get_installed_distributions_orig + piplicenses.importlib_metadata.distributions = \ + importlib_metadata_distributions_orig def test_format_confluence(self): format_confluence_args = ['--format=confluence'] @@ -562,32 +581,32 @@ self.assertTrue(actual.endswith('\033[0m')) def test_without_filter(self): - piplicenses.get_installed_distributions = \ - get_installed_distributions_mocked + piplicenses.importlib_metadata.distributions = \ + importlib_metadata_distributions_mocked args = self.parser.parse_args([]) packages = list(piplicenses.get_packages(args)) self.assertIn(UNICODE_APPENDIX, packages[-1]["name"]) - piplicenses.get_installed_distributions = \ - get_installed_distributions_orig + piplicenses.importlib_metadata.distributions = \ + importlib_metadata_distributions_orig def test_with_default_filter(self): - piplicenses.get_installed_distributions = \ - get_installed_distributions_mocked + piplicenses.importlib_metadata.distributions = \ + importlib_metadata_distributions_mocked args = self.parser.parse_args(["--filter-strings"]) packages = list(piplicenses.get_packages(args)) - piplicenses.get_installed_distributions = \ - get_installed_distributions_orig + piplicenses.importlib_metadata.distributions = \ + importlib_metadata_distributions_orig self.assertNotIn(UNICODE_APPENDIX, packages[-1]["name"]) def test_with_specified_filter(self): - piplicenses.get_installed_distributions = \ - get_installed_distributions_mocked + piplicenses.importlib_metadata.distributions = \ + importlib_metadata_distributions_mocked args = self.parser.parse_args(["--filter-strings", "--filter-code-page=ascii"]) packages = list(piplicenses.get_packages(args)) self.assertNotIn(UNICODE_APPENDIX, packages[-1]["summary"]) - piplicenses.get_installed_distributions = \ - get_installed_distributions_orig + piplicenses.importlib_metadata.distributions = \ + importlib_metadata_distributions_orig class MockStdStream(object):