Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-importlib-metadata for openSUSE:Factory checked in at 2022-06-10 15:57:10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-importlib-metadata (Old) and /work/SRC/openSUSE:Factory/.python-importlib-metadata.new.1548 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-importlib-metadata" Fri Jun 10 15:57:10 2022 rev:11 rq:981371 version:4.11.4 Changes: -------- --- /work/SRC/openSUSE:Factory/python-importlib-metadata/python-importlib-metadata.changes 2022-05-12 22:58:15.188627050 +0200 +++ /work/SRC/openSUSE:Factory/.python-importlib-metadata.new.1548/python-importlib-metadata.changes 2022-06-10 15:57:12.104796395 +0200 @@ -1,0 +2,11 @@ +Sun Jun 5 00:10:35 UTC 2022 - Dirk M??ller <dmuel...@suse.com> + +- update to 4.11.4: + * #379: In ``PathDistribution._name_from_stem``, avoid including + parts of the extension in the result. + * #381: In ``PathDistribution._normalized_name``, ensure names + loaded from the stem of the filename are also normalized, ensuring + duplicate entry points by packages varying only by non-normalized + name are hidden. + +------------------------------------------------------------------- Old: ---- importlib_metadata-4.11.3.tar.gz New: ---- importlib_metadata-4.11.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-importlib-metadata.spec ++++++ --- /var/tmp/diff_new_pack.utjjGS/_old 2022-06-10 15:57:13.408797975 +0200 +++ /var/tmp/diff_new_pack.utjjGS/_new 2022-06-10 15:57:13.412797981 +0200 @@ -27,17 +27,17 @@ %{?!python_module:%define python_module() python3-%{**}} %define skip_python2 1 Name: python-importlib-metadata%{psuffix} -Version: 4.11.3 +Version: 4.11.4 Release: 0 Summary: Read metadata from Python packages License: Apache-2.0 URL: http://importlib-metadata.readthedocs.io/ Source: https://files.pythonhosted.org/packages/source/i/importlib_metadata/importlib_metadata-%{version}.tar.gz BuildRequires: %{python_module base >= 3.7} +BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools_scm} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module tomli} -BuildRequires: %{python_module pip} BuildRequires: %{python_module wheel} BuildRequires: %{python_module zipp >= 0.5} BuildRequires: fdupes ++++++ importlib_metadata-4.11.3.tar.gz -> importlib_metadata-4.11.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/importlib_metadata-4.11.3/CHANGES.rst new/importlib_metadata-4.11.4/CHANGES.rst --- old/importlib_metadata-4.11.3/CHANGES.rst 2022-03-13 19:08:11.000000000 +0100 +++ new/importlib_metadata-4.11.4/CHANGES.rst 2022-05-21 18:39:40.000000000 +0200 @@ -1,3 +1,13 @@ +v4.11.4 +======= + +* #379: In ``PathDistribution._name_from_stem``, avoid including + parts of the extension in the result. +# #381: In ``PathDistribution._normalized_name``, ensure names + loaded from the stem of the filename are also normalized, ensuring + duplicate entry points by packages varying only by non-normalized + name are hidden. + v4.11.3 ======= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/importlib_metadata-4.11.3/PKG-INFO new/importlib_metadata-4.11.4/PKG-INFO --- old/importlib_metadata-4.11.3/PKG-INFO 2022-03-13 19:08:40.478635000 +0100 +++ new/importlib_metadata-4.11.4/PKG-INFO 2022-05-21 18:40:06.088998800 +0200 @@ -1,12 +1,10 @@ Metadata-Version: 2.1 Name: importlib_metadata -Version: 4.11.3 +Version: 4.11.4 Summary: Read metadata from Python packages Home-page: https://github.com/python/importlib_metadata Author: Jason R. Coombs Author-email: jar...@jaraco.com -License: UNKNOWN -Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Apache Software License @@ -96,5 +94,3 @@ * Report bugs at: https://github.com/python/importlib_metadata/issues * Code hosting: https://github.com/python/importlib_metadata * Documentation: https://importlib_metadata.readthedocs.io/ - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/importlib_metadata-4.11.3/docs/using.rst new/importlib_metadata-4.11.4/docs/using.rst --- old/importlib_metadata-4.11.3/docs/using.rst 2022-03-13 19:08:11.000000000 +0100 +++ new/importlib_metadata-4.11.4/docs/using.rst 2022-05-21 18:39:40.000000000 +0200 @@ -8,9 +8,9 @@ package metadata. Built in part on Python's import system, this library intends to replace similar functionality in the `entry point API`_ and `metadata API`_ of ``pkg_resources``. Along with -:mod:`importlib.resources` in Python 3.7 -and newer (backported as :doc:`importlib_resources <importlib_resources:index>` for older versions of -Python), this can eliminate the need to use the older and less efficient +:mod:`importlib.resources` (with new features backported to the +`importlib_resources`_ package), this can eliminate the need to use the older +and less efficient ``pkg_resources`` package. By "installed package" we generally mean a third-party package installed into @@ -23,6 +23,13 @@ anywhere. +.. seealso:: + + https://importlib-metadata.readthedocs.io/ + The documentation for ``importlib_metadata``, which supplies a + backport of ``importlib.metadata``. + + Overview ======== @@ -42,9 +49,9 @@ >>> version('wheel') '0.32.3' -You can also get the set of entry points keyed by group, such as +You can also get a collection of entry points selectable by properties of the EntryPoint (typically 'group' or 'name'), such as ``console_scripts``, ``distutils.commands`` and others. Each group contains a -sequence of :ref:`EntryPoint <entry-points>` objects. +collection of :ref:`EntryPoint <entry-points>` objects. You can get the :ref:`metadata for a distribution <metadata>`:: @@ -79,7 +86,7 @@ >>> eps = entry_points() The ``entry_points()`` function returns an ``EntryPoints`` object, -a sequence of all ``EntryPoint`` objects with ``names`` and ``groups`` +a collection of all ``EntryPoint`` objects with ``names`` and ``groups`` attributes for convenience:: >>> sorted(eps.groups) @@ -162,6 +169,13 @@ >>> wheel_metadata.json['requires_python'] '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*' +.. note:: + + The actual type of the object returned by ``metadata()`` is an + implementation detail and should be accessed only through the interface + described by the + `PackageMetadata protocol <https://importlib-metadata.readthedocs.io/en/latest/api.html#importlib_metadata.PackageMetadata>`. + .. _version: @@ -274,6 +288,15 @@ for additional details. +Distribution Discovery +====================== + +By default, this package provides built-in support for discovery of metadata for file system and zip file packages. This metadata finder search defaults to ``sys.path``, but varies slightly in how it interprets those values from how other import machinery does. In particular: + +- ``importlib_metadata`` does not honor :class:`bytes` objects on ``sys.path``. +- ``importlib_metadata`` will incidentally honor :py:class:`pathlib.Path` objects on ``sys.path`` even though such values will be ignored for imports. + + Extending the search algorithm ============================== @@ -315,6 +338,3 @@ .. _`entry point API`: https://setuptools.readthedocs.io/en/latest/pkg_resources.html#entry-points .. _`metadata API`: https://setuptools.readthedocs.io/en/latest/pkg_resources.html#metadata-api .. _`finders`: https://docs.python.org/3/reference/import.html#finders-and-loaders - - -.. rubric:: Footnotes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/importlib_metadata-4.11.3/importlib_metadata/__init__.py new/importlib_metadata-4.11.4/importlib_metadata/__init__.py --- old/importlib_metadata-4.11.3/importlib_metadata/__init__.py 2022-03-13 19:08:11.000000000 +0100 +++ new/importlib_metadata-4.11.4/importlib_metadata/__init__.py 2022-05-21 18:39:40.000000000 +0200 @@ -956,13 +956,26 @@ normalized name from the file system path. """ stem = os.path.basename(str(self._path)) - return self._name_from_stem(stem) or super()._normalized_name + return ( + pass_none(Prepared.normalize)(self._name_from_stem(stem)) + or super()._normalized_name + ) - def _name_from_stem(self, stem): - name, ext = os.path.splitext(stem) + @staticmethod + def _name_from_stem(stem): + """ + >>> PathDistribution._name_from_stem('foo-3.0.egg-info') + 'foo' + >>> PathDistribution._name_from_stem('CherryPy-3.0.dist-info') + 'CherryPy' + >>> PathDistribution._name_from_stem('face.egg-info') + 'face' + >>> PathDistribution._name_from_stem('foo.bar') + """ + filename, ext = os.path.splitext(stem) if ext not in ('.dist-info', '.egg-info'): return - name, sep, rest = stem.partition('-') + name, sep, rest = filename.partition('-') return name @@ -1002,6 +1015,15 @@ return distribution(distribution_name).version +_unique = functools.partial( + unique_everseen, + key=operator.attrgetter('_normalized_name'), +) +""" +Wrapper for ``distributions`` to return unique distributions by name. +""" + + def entry_points(**params) -> Union[EntryPoints, SelectableGroups]: """Return EntryPoint objects for all installed packages. @@ -1019,10 +1041,8 @@ :return: EntryPoints or SelectableGroups for all installed packages. """ - norm_name = operator.attrgetter('_normalized_name') - unique = functools.partial(unique_everseen, key=norm_name) eps = itertools.chain.from_iterable( - dist.entry_points for dist in unique(distributions()) + dist.entry_points for dist in _unique(distributions()) ) return SelectableGroups.load(eps).select(**params) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/importlib_metadata-4.11.3/importlib_metadata.egg-info/PKG-INFO new/importlib_metadata-4.11.4/importlib_metadata.egg-info/PKG-INFO --- old/importlib_metadata-4.11.3/importlib_metadata.egg-info/PKG-INFO 2022-03-13 19:08:40.000000000 +0100 +++ new/importlib_metadata-4.11.4/importlib_metadata.egg-info/PKG-INFO 2022-05-21 18:40:05.000000000 +0200 @@ -1,12 +1,10 @@ Metadata-Version: 2.1 Name: importlib-metadata -Version: 4.11.3 +Version: 4.11.4 Summary: Read metadata from Python packages Home-page: https://github.com/python/importlib_metadata Author: Jason R. Coombs Author-email: jar...@jaraco.com -License: UNKNOWN -Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Apache Software License @@ -96,5 +94,3 @@ * Report bugs at: https://github.com/python/importlib_metadata/issues * Code hosting: https://github.com/python/importlib_metadata * Documentation: https://importlib_metadata.readthedocs.io/ - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/importlib_metadata-4.11.3/tests/test_api.py new/importlib_metadata-4.11.4/tests/test_api.py --- old/importlib_metadata-4.11.3/tests/test_api.py 2022-03-13 19:08:11.000000000 +0100 +++ new/importlib_metadata-4.11.4/tests/test_api.py 2022-05-21 18:39:40.000000000 +0200 @@ -89,15 +89,15 @@ self.assertIn(ep.dist.name, ('distinfo-pkg', 'egginfo-pkg')) self.assertEqual(ep.dist.version, "1.0.0") - def test_entry_points_unique_packages(self): + def test_entry_points_unique_packages_normalized(self): """ Entry points should only be exposed for the first package - on sys.path with a given name. + on sys.path with a given name (even when normalized). """ alt_site_dir = self.fixtures.enter_context(fixtures.tempdir()) self.fixtures.enter_context(self.add_sys_path(alt_site_dir)) alt_pkg = { - "distinfo_pkg-1.1.0.dist-info": { + "DistInfo_pkg-1.1.0.dist-info": { "METADATA": """ Name: distinfo-pkg Version: 1.1.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/importlib_metadata-4.11.3/tests/test_main.py new/importlib_metadata-4.11.4/tests/test_main.py --- old/importlib_metadata-4.11.3/tests/test_main.py 2022-03-13 19:08:11.000000000 +0100 +++ new/importlib_metadata-4.11.4/tests/test_main.py 2022-05-21 18:39:40.000000000 +0200 @@ -1,7 +1,6 @@ import re import json import pickle -import textwrap import unittest import warnings import importlib @@ -14,6 +13,7 @@ EntryPoint, MetadataPathFinder, PackageNotFoundError, + _unique, distributions, entry_points, metadata, @@ -77,48 +77,50 @@ class NameNormalizationTests(fixtures.OnSysPath, fixtures.SiteDir, unittest.TestCase): @staticmethod - def pkg_with_dashes(site_dir): + def make_pkg(name): """ - Create minimal metadata for a package with dashes - in the name (and thus underscores in the filename). + Create minimal metadata for a dist-info package with + the indicated name on the file system. """ - metadata_dir = site_dir / 'my_pkg.dist-info' - metadata_dir.mkdir() - metadata = metadata_dir / 'METADATA' - with metadata.open('w', encoding='utf-8') as strm: - strm.write('Version: 1.0\n') - return 'my-pkg' + return { + f'{name}.dist-info': { + 'METADATA': 'VERSION: 1.0\n', + }, + } def test_dashes_in_dist_name_found_as_underscores(self): """ For a package with a dash in the name, the dist-info metadata uses underscores in the name. Ensure the metadata loads. """ - pkg_name = self.pkg_with_dashes(self.site_dir) - assert version(pkg_name) == '1.0' - - @staticmethod - def pkg_with_mixed_case(site_dir): - """ - Create minimal metadata for a package with mixed case - in the name. - """ - metadata_dir = site_dir / 'CherryPy.dist-info' - metadata_dir.mkdir() - metadata = metadata_dir / 'METADATA' - with metadata.open('w', encoding='utf-8') as strm: - strm.write('Version: 1.0\n') - return 'CherryPy' + fixtures.build_files(self.make_pkg('my_pkg'), self.site_dir) + assert version('my-pkg') == '1.0' def test_dist_name_found_as_any_case(self): """ Ensure the metadata loads when queried with any case. """ - pkg_name = self.pkg_with_mixed_case(self.site_dir) + pkg_name = 'CherryPy' + fixtures.build_files(self.make_pkg(pkg_name), self.site_dir) assert version(pkg_name) == '1.0' assert version(pkg_name.lower()) == '1.0' assert version(pkg_name.upper()) == '1.0' + def test_unique_distributions(self): + """ + Two distributions varying only by non-normalized name on + the file system should resolve as the same. + """ + fixtures.build_files(self.make_pkg('abc'), self.site_dir) + before = list(_unique(distributions())) + + alt_site_dir = self.fixtures.enter_context(fixtures.tempdir()) + self.fixtures.enter_context(self.add_sys_path(alt_site_dir)) + fixtures.build_files(self.make_pkg('ABC'), alt_site_dir) + after = list(_unique(distributions())) + + assert len(after) == len(before) + class NonASCIITests(fixtures.OnSysPath, fixtures.SiteDir, unittest.TestCase): @staticmethod @@ -127,11 +129,12 @@ Create minimal metadata for a package with non-ASCII in the description. """ - metadata_dir = site_dir / 'portend.dist-info' - metadata_dir.mkdir() - metadata = metadata_dir / 'METADATA' - with metadata.open('w', encoding='utf-8') as fp: - fp.write('Description: p??r??tend') + contents = { + 'portend.dist-info': { + 'METADATA': 'Description: p??r??tend', + }, + } + fixtures.build_files(contents, site_dir) return 'portend' @staticmethod @@ -140,19 +143,15 @@ Create minimal metadata for an egg-info package with non-ASCII in the description. """ - metadata_dir = site_dir / 'portend.dist-info' - metadata_dir.mkdir() - metadata = metadata_dir / 'METADATA' - with metadata.open('w', encoding='utf-8') as fp: - fp.write( - textwrap.dedent( - """ + contents = { + 'portend.dist-info': { + 'METADATA': """ Name: portend - p??r??tend - """ - ).strip() - ) + p??r??tend""", + }, + } + fixtures.build_files(contents, site_dir) return 'portend' def test_metadata_loads(self):