#32 scripts/pythondistdeps: Fix for Python 3.10
Closed 2 years ago by torsava. Opened 2 years ago by torsava.
rpms/ torsava/python-rpm-generators importlib  into  main

file modified
+5 -1
@@ -53,7 +53,6 @@ 

  class Distribution(PathDistribution):

      def __init__(self, path):

          super(Distribution, self).__init__(Path(path))

-         self.name = self.metadata['Name']

          self.normalized_name = normalize_name(self.name)

          self.legacy_normalized_name = legacy_normalize_name(self.name)

          self.requirements = [Requirement(r) for r in self.requires or []]
@@ -61,6 +60,11 @@ 

              v for k, v in self.metadata.items() if k == 'Provides-Extra']

          self.py_version = self._parse_py_version(path)

  

+     @property

+     def name(self):

+         """Return the 'Name' metadata for the distribution package."""

+         return self.metadata['Name']

+ 

      def _parse_py_version(self, path):

          # Try to parse the Python version from the path the metadata

          # resides at (e.g. /usr/lib/pythonX.Y/site-packages/...)

self.name in PathDistribution is a property in Python 3.10+ and thus we
can't redefine it as an instance variable. Instead we explicitly define
it as a property, which works on all supported Python versions.

Pull-Request has been closed by torsava

2 years ago

Rawhide and main branches are synced.

Build succeeded.

Metadata