nanonyme commented on code in PR #1948:
URL: https://github.com/apache/buildstream/pull/1948#discussion_r1864986397


##########
src/buildstream/_pluginfactory/pluginoriginpip.py:
##########
@@ -53,63 +47,56 @@ def get_plugin_paths(self, kind, plugin_type):
         else:
             assert False, "unreachable"
 
-        # key by a tuple to avoid collision
         try:
-            package = pkg_resources.get_entry_info(self._package_name, 
entrypoint_group, kind)
-        except pkg_resources.DistributionNotFound as e:
+            package = Requirement(self._package_name)
+        except InvalidRequirement as e:
+            raise PluginError(
+                "{}: Malformed package-name '{}' encountered: {}".format(
+                    self.provenance_node.get_provenance(), self._package_name, 
e
+                ),
+                reason="package-malformed-requirement",
+            ) from e
+
+        try:
+            dist = distribution(package.name)
+        except PackageNotFoundError as e:
             raise PluginError(
                 "{}: Failed to load {} plugin '{}': {}".format(
                     self.provenance_node.get_provenance(), plugin_type, kind, e
                 ),
                 reason="package-not-found",
             ) from e
-        except pkg_resources.VersionConflict as e:
+
+        if dist.version not in package.specifier:
             raise PluginError(
                 "{}: Version conflict encountered while loading {} plugin 
'{}'".format(
                     self.provenance_node.get_provenance(), plugin_type, kind
                 ),
-                detail=e.report(),
+                detail="{} {} is installed but {} is 
required".format(dist.name, dist.version, package),

Review Comment:
   Try doing `dist.metadata["Name"]` here. I think the data is still there, the 
property helper is just missing.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to