src/buildservice/errors.py \
src/buildservice/events.py \
src/buildservice/httpclient.py \
+ src/buildservice/i18n.py \
src/buildservice/images.py \
src/buildservice/jobs.py \
src/buildservice/keys.py \
from . import repos
from . import users
+from .i18n import N_
from .constants import *
from .decorators import *
# Notify everyone this build has finished...
if success:
+ # Send a push notification
+ await self._send_push_message(
+ title = N_("Build Successful"),
+ body = "%s" % self,
+ )
+
+ # Send an email
await self._send_email("builds/messages/finished.txt")
# ... or that it has failed
else:
+ # Send a push notification
+ await self._send_push_message(
+ title = N_("Build Failed"),
+ body = "%s" % self,
+ )
+
+ # Send an email
await self._send_email("builds/messages/failed.txt")
# Create any test builds
"""
return self.has_finished() and self.failed is True
+ async def _send_push_message(self, *args, exclude=None, **kwargs):
+ """
+ Convenience function which sends a push notification to everybody
+ """
+ watchers = await self.get_watchers()
+
+ for watcher in watchers:
+ # Skip some people
+ if exclude and watcher.user in exclude:
+ continue
+
+ # Send a push notification
+ await watcher.user.send_push_message(*args, **kwargs)
+
async def _send_email(self, *args, exclude=None, **kwargs):
"""
Convenience function which sends an email to everybody who would care
--- /dev/null
+###############################################################################
+# #
+# Pakfire - The IPFire package management system #
+# Copyright (C) 2025 Pakfire development team #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+# #
+###############################################################################
+
+# Don't translate anything, yet
+N_ = lambda x: x