Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions vcstool/commands/help.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import argparse
import sys

from pkg_resources import load_entry_point
if sys.version_info >= (3, 8):
from importlib.metadata import entry_points
else:
from pkg_resources import load_entry_point

from vcstool.clients import vcstool_clients
from vcstool.commands import vcstool_commands
from vcstool.streams import set_streams
Expand Down Expand Up @@ -85,9 +89,16 @@ def get_entrypoint(command):
'\nDid you mean one of these?\n' + '\n '.join(commands),
file=sys.stderr)
return None

return load_entry_point(
'vcstool', 'console_scripts', 'vcs-' + commands[0])

if sys.version_info >= (3, 8):
eps = entry_points()
for ep in eps.select(group='console_scripts'):
if ep.name == 'vcs-' + commands[0]:
return ep.load()
print(f"Could not find entry point for 'vcs-{commands[0]}'", file=sys.stderr)
return None
else:
return load_entry_point('vcstool', 'console_scripts', 'vcs-' + commands[0])


def get_parser_with_command_only():
Expand Down