diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py index 4214fdc225e..1f08caaefce 100644 --- a/python/servo/build_commands.py +++ b/python/servo/build_commands.py @@ -19,8 +19,6 @@ import sys from time import time from typing import Optional, List, Dict -import notifypy - from mach.decorators import ( CommandArgument, CommandProvider, @@ -33,7 +31,7 @@ import servo.platform.macos import servo.util import servo.visual_studio -from servo.command_base import BuildType, CommandBase, call, check_call +from servo.command_base import BuildType, CommandBase, check_call from servo.gstreamer import windows_dlls, windows_plugins, package_gstreamer_dylibs from servo.platform.build_target import BuildTarget @@ -189,12 +187,10 @@ class MachCommands(CommandBase): except ImportError: pass - # Generate Desktop Notification if elapsed-time > some threshold value - + # Print how long the build took elapsed = time() - build_start elapsed_delta = datetime.timedelta(seconds=int(elapsed)) build_message = f"{'Succeeded' if status == 0 else 'Failed'} in {elapsed_delta}" - self.notify("Servo build", build_message) print(build_message) return status @@ -287,56 +283,6 @@ class MachCommands(CommandBase): env["TARGET_CFLAGS"] += " -fsanitize=thread" env["TARGET_CXXFLAGS"] += " -fsanitize=thread" - def notify(self, title: str, message: str): - """Generate desktop notification when build is complete and the - elapsed build time was longer than 30 seconds. - - If notify-command is set in the [tools] section of the configuration, - that is used instead.""" - notify_command = self.config["tools"].get("notify-command") - - # notifypy does not know how to send transient notifications, so we use a custom - # notifier on Linux. If transient notifications are not used, then notifications - # pile up in the notification center and must be cleared manually. - class LinuxNotifier(notifypy.BaseNotifier): - def __init__(self, **kwargs): - pass - - def send_notification(self, **kwargs): - try: - import dbus - - bus = dbus.SessionBus() - notify_obj = bus.get_object("org.freedesktop.Notifications", "/org/freedesktop/Notifications") - method = notify_obj.get_dbus_method("Notify", "org.freedesktop.Notifications") - method( - kwargs.get("application_name"), - 0, # Don't replace previous notification. - kwargs.get("notification_icon", ""), - kwargs.get("notification_title"), - kwargs.get("notification_subtitle"), - [], # actions - {"transient": True}, # hints - -1, # timeout - ) - except Exception as exception: - print(f"[Warning] Could not generate notification: {exception}", file=sys.stderr) - return True - - if notify_command: - if call([notify_command, title, message]) != 0: - print(f"[Warning] Could not generate notification: Could not run '{notify_command}'.", file=sys.stderr) - else: - try: - notifier = LinuxNotifier if sys.platform.startswith("linux") else None - notification = notifypy.Notify(use_custom_notifier=notifier) - notification.title = title - notification.message = message - notification.icon = path.join(self.get_top_dir(), "resources", "servo_64.png") - notification.send(block=False) - except notifypy.exceptions.UnsupportedPlatform as e: - print(f"[Warning] Could not generate notification: {e}", file=sys.stderr) - def copy_windows_dlls_to_build_directory(servo_binary: str, target: BuildTarget) -> bool: servo_exe_dir = os.path.dirname(servo_binary) diff --git a/servobuild.example b/servobuild.example index 8efc1e2907a..a43894a9e96 100644 --- a/servobuild.example +++ b/servobuild.example @@ -5,12 +5,6 @@ # Tool options [tools] -# If uncommented, this command is used instead of the platform’s default -# to notify at the end of a compilation that took a long time. -# This is the name or path of an executable called with two arguments: -# the summary and content of the notification. -#notify-command = "notify-send" - [build] # Set "mode = dev" or use `mach build --dev` to build the project with warning. # or Set "mode = release" or use `mach build --release` for optimized build. diff --git a/shell.nix b/shell.nix index 74a5dd4511b..c6f3f6f9673 100644 --- a/shell.nix +++ b/shell.nix @@ -89,7 +89,6 @@ stdenv.mkDerivation (androidEnvironment // { # Ensure the Python version is same as the one in `.python-version` file so # that `uv` will just symlink to the one in nix store. Otherwise `uv` will # download a pre-built binary that won't work on nix. - # FIXME: dbus python module needs to be installed into the virtual environment. python311 uv