Tristan Van Berkom pushed to branch tristan/notifications at BuildStream / buildstream
Commits:
-
d1bd8c0b
by Chandan Singh at 2018-08-21T12:46:57Z
-
12d1cec2
by Chandan Singh at 2018-08-21T12:46:57Z
-
320b9562
by Tristan Van Berkom at 2018-08-21T13:57:00Z
-
be964b1e
by Tristan Van Berkom at 2018-08-21T15:10:46Z
3 changed files:
Changes:
| 1 |
-image: buildstream/testsuite-debian:9-master-112-a9f63c5e
|
|
| 1 |
+image: buildstream/testsuite-debian:9-master-114-4cab18e3
|
|
| 2 | 2 |
|
| 3 | 3 |
cache:
|
| 4 | 4 |
key: "$CI_JOB_NAME-"
|
| ... | ... | @@ -79,25 +79,25 @@ source_dist: |
| 79 | 79 |
- coverage-linux/
|
| 80 | 80 |
|
| 81 | 81 |
tests-debian-9:
|
| 82 |
- image: buildstream/testsuite-debian:9-master-112-a9f63c5e
|
|
| 82 |
+ image: buildstream/testsuite-debian:9-master-114-4cab18e3
|
|
| 83 | 83 |
<<: *linux-tests
|
| 84 | 84 |
|
| 85 | 85 |
tests-fedora-27:
|
| 86 |
- image: buildstream/testsuite-fedora:27-master-112-a9f63c5e
|
|
| 86 |
+ image: buildstream/testsuite-fedora:27-master-114-4cab18e3
|
|
| 87 | 87 |
<<: *linux-tests
|
| 88 | 88 |
|
| 89 | 89 |
tests-fedora-28:
|
| 90 |
- image: buildstream/testsuite-fedora:28-master-112-a9f63c5e
|
|
| 90 |
+ image: buildstream/testsuite-fedora:28-master-114-4cab18e3
|
|
| 91 | 91 |
<<: *linux-tests
|
| 92 | 92 |
|
| 93 | 93 |
tests-ubuntu-18.04:
|
| 94 |
- image: buildstream/testsuite-ubuntu:18.04-master-112-a9f63c5e
|
|
| 94 |
+ image: buildstream/testsuite-ubuntu:18.04-master-114-4cab18e3
|
|
| 95 | 95 |
<<: *linux-tests
|
| 96 | 96 |
|
| 97 | 97 |
tests-unix:
|
| 98 | 98 |
# Use fedora here, to a) run a test on fedora and b) ensure that we
|
| 99 | 99 |
# can get rid of ostree - this is not possible with debian-8
|
| 100 |
- image: buildstream/testsuite-fedora:27-master-112-a9f63c5e
|
|
| 100 |
+ image: buildstream/testsuite-fedora:27-master-114-4cab18e3
|
|
| 101 | 101 |
stage: test
|
| 102 | 102 |
variables:
|
| 103 | 103 |
BST_FORCE_BACKEND: "unix"
|
| ... | ... | @@ -22,12 +22,43 @@ import click |
| 22 | 22 |
from .app import App
|
| 23 | 23 |
|
| 24 | 24 |
|
| 25 |
+# This trick is currently only supported on some terminals,
|
|
| 26 |
+# avoid using it where it can cause garbage to be printed
|
|
| 27 |
+# to the terminal.
|
|
| 28 |
+#
|
|
| 29 |
+def _osc_777_supported():
|
|
| 30 |
+ |
|
| 31 |
+ term = os.environ['TERM']
|
|
| 32 |
+ |
|
| 33 |
+ if term.startswith('xterm') or term.startswith('vte'):
|
|
| 34 |
+ |
|
| 35 |
+ # Since vte version 4600, upstream silently ignores
|
|
| 36 |
+ # the OSC 777 without printing garbage to the terminal.
|
|
| 37 |
+ #
|
|
| 38 |
+ # For distros like Fedora who have patched vte, this
|
|
| 39 |
+ # will trigger a desktop notification and bring attention
|
|
| 40 |
+ # to the terminal.
|
|
| 41 |
+ #
|
|
| 42 |
+ vte_version = os.environ['VTE_VERSION']
|
|
| 43 |
+ try:
|
|
| 44 |
+ vte_version_int = int(vte_version)
|
|
| 45 |
+ except ValueError:
|
|
| 46 |
+ return False
|
|
| 47 |
+ |
|
| 48 |
+ if vte_version_int >= 4600:
|
|
| 49 |
+ return True
|
|
| 50 |
+ |
|
| 51 |
+ return False
|
|
| 52 |
+ |
|
| 53 |
+ |
|
| 25 | 54 |
# A linux specific App implementation
|
| 26 | 55 |
#
|
| 27 | 56 |
class LinuxApp(App):
|
| 28 | 57 |
|
| 29 | 58 |
def notify(self, title, text):
|
| 30 | 59 |
|
| 31 |
- term = os.environ['TERM']
|
|
| 32 |
- if term in ('xterm', 'vte'):
|
|
| 33 |
- click.echo("\033]777;notify;{};{}\007".format(title, text))
|
|
| 60 |
+ # Currently we only try this notification method
|
|
| 61 |
+ # of sending an escape sequence to the terminal
|
|
| 62 |
+ #
|
|
| 63 |
+ if _osc_777_supported():
|
|
| 64 |
+ click.echo("\033]777;notify;{};{}\007".format(title, text), err=True)
|
| 1 | 1 |
coverage == 4.4.0
|
| 2 | 2 |
pep8
|
| 3 |
-pytest >= 3.1.0
|
|
| 3 |
+pylint == 2.1.1
|
|
| 4 |
+pytest >= 3.7
|
|
| 4 | 5 |
pytest-cov >= 2.5.0
|
| 5 | 6 |
pytest-datafiles
|
| 6 | 7 |
pytest-env
|
