Skip to content

Commit

Permalink
Break terminal_notifier dependency on pkg_resources (#73)
Browse files Browse the repository at this point in the history
Instead of looking for the distribution which defined the entry point,
root the path off from the top-level module.
  • Loading branch information
cottsay authored Mar 12, 2024
1 parent d905a99 commit 41a1f09
Showing 1 changed file with 3 additions and 10 deletions.
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

0 comments on commit 41a1f09

Please sign in to comment.