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

Break terminal_notifier dependency on pkg_resources #73

Merged
merged 1 commit into from
Mar 12, 2024
Merged
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
13 changes: 3 additions & 10 deletions colcon_notification/desktop_notification/terminal_notifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
from colcon_core.logging import colcon_logger
from colcon_core.plugin_system import satisfies_version
from colcon_core.plugin_system import SkipExtensionException
import colcon_notification
from colcon_notification.desktop_notification \
import DesktopNotificationExtensionPoint
from pkg_resources import iter_entry_points

logger = colcon_logger.getChild(__name__)

Expand All @@ -34,16 +34,9 @@ def notify(self, *, title, message, icon_path=None): # noqa: D102
if message.startswith('-'):
message = '\\' + message

entry_points = list(iter_entry_points(
'colcon_notification.desktop_notification',
name='terminal_notifier'))
if not entry_points:
logger.error(
"Failed to find entry point of 'terminal_notifier'")
return

# determine the install prefix of this Python package
install_prefix = _get_prefix_path(entry_points[0].dist.location)
install_prefix = _get_prefix_path(
Path(colcon_notification.__file__).parent.parent)
if install_prefix is None:
# for 'develop' the dist location points to the build directory
# and the prefix path can't be determined
Expand Down