Skip to content
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

vcstool is broken on Python 3.13 #281

Open
fferri opened this issue Nov 18, 2024 · 0 comments
Open

vcstool is broken on Python 3.13 #281

fferri opened this issue Nov 18, 2024 · 0 comments

Comments

@fferri
Copy link

fferri commented Nov 18, 2024

e.g.:

❯ vcs import --input https://raw.githubusercontent.com/ros2/ros2/jazzy/ros2.repos src
Traceback (most recent call last):
  File "/opt/homebrew/bin/vcs", line 5, in <module>
    from vcstool.commands.vcs import main
  File "/opt/homebrew/lib/python3.13/site-packages/vcstool/commands/vcs.py", line 3, in <module>
    from vcstool.commands.help import get_entrypoint
  File "/opt/homebrew/lib/python3.13/site-packages/vcstool/commands/help.py", line 4, in <module>
    from pkg_resources import load_entry_point
  File "/opt/homebrew/lib/python3.13/site-packages/pkg_resources/__init__.py", line 2172, in <module>
    register_finder(pkgutil.ImpImporter, find_on_path)
                    ^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?

it seems vcstool it is using deprecated pkg_resources (related: #269).

Solution:

make the following changes in vcstool/commands/help.py:

  1. change from pkg_resources import load_entry_point to from importlib.metadata import entry_points
  2. add following helper function:
def load_vcs_command(commands):
    entries = entry_points()
    vcs_entry_point = next(
        ep for ep in entries
        if ep.group == 'console_scripts' and ep.name == 'vcs-' + commands[0]
    )
    return vcs_entry_point.load()
  1. in function get_entrypoint(command), replace return load_entry_point(... with return load_vcs_command(commands)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant