[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] reproducible debian: only use colours when the output is a tty
Mattia Rizzolo
gitlab at salsa.debian.org
Tue May 15 19:25:52 BST 2018
Mattia Rizzolo pushed to branch master at Debian QA / jenkins.debian.net
Commits:
8490b292 by Mattia Rizzolo at 2018-05-15T20:22:34+02:00
reproducible debian: only use colours when the output is a tty
Signed-off-by: Mattia Rizzolo <mattia at debian.org>
- - - - -
1 changed file:
- bin/reproducible_common.py
Changes:
=====================================
bin/reproducible_common.py
=====================================
--- a/bin/reproducible_common.py
+++ b/bin/reproducible_common.py
@@ -266,13 +266,16 @@ def create_temp_file(mode='w+b'):
class bcolors:
- BOLD = '\033[1m'
- UNDERLINE = '\033[4m'
- RED = '\033[91m'
- GOOD = '\033[92m'
- WARN = '\033[93m' + UNDERLINE
- FAIL = RED + BOLD + UNDERLINE
- ENDC = '\033[0m'
+ @staticmethod
+ def __if_a_tty(colorcode):
+ return colorcode if sys.stdout.isatty() else ''
+ BOLD = __if_a_tty('\033[1m')
+ UNDERLINE = __if_a_tty('\033[4m')
+ RED = __if_a_tty('\033[91m')
+ GOOD = __if_a_tty('\033[92m')
+ WARN = __if_a_tty('\033[93m' + UNDERLINE)
+ FAIL = __if_a_tty(RED + BOLD + UNDERLINE)
+ ENDC = __if_a_tty('\033[0m')
def convert_into_hms_string(duration):
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/commit/8490b29210b41fa25514e0bb2e911b324f462234
---
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/commit/8490b29210b41fa25514e0bb2e911b324f462234
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/qa-jenkins-scm/attachments/20180515/39192d14/attachment.html>
More information about the Qa-jenkins-scm
mailing list