-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace pkg_resources by importlib.metadata #766
base: main
Are you sure you want to change the base?
Conversation
catkin_tools/commands/catkin.py
Outdated
@@ -184,7 +196,7 @@ def catkin_main(sysargs): | |||
# Check for version | |||
if '--version' in sysargs: | |||
print('catkin_tools {} (C) 2014-{} Open Source Robotics Foundation'.format( | |||
pkg_resources.get_distribution('catkin_tools').version, | |||
distribution('catkin_tools').version, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's importlib.metadata.version as a shortcut for this
I have a PR that fixes the deprecation warnings: #767 |
not needed as only python>=3.8 is supported
So the select isn't available on 3.8 and 3.9.. I wil fix it later. And maybe #767 is better. But it lacks the single call to entry_points for now. |
It uses functools.lru_cache to do a single call |
But only for the verb entry points, in this PR there is a single call to entry_points for all groups combined |
This PR also does multiple calls for now. But we should combine the code regarding it of this PR and #767 |
pkg_resources
is deprecated and was causing issues in finding dependencies ofcatkin_tools_document
.I replaced it by
importlib.metadata
. I am not 100% sure the changes incatkin_tools/metadata.py
are correct.The call on
entry_points()
is expensive, therefore I added a private function in combination with a global variable. I only applied this in thecommands/catkin.py
. Ideally this is shared between files. Please let me know when you have suggestion to it a bit more cleanly and share it between the files.