From 1640a65091c56eeed0f6bb1020fd156cdc279a6e Mon Sep 17 00:00:00 2001 From: Alexandru DAMIAN Date: Thu, 30 Jul 2015 19:25:09 +0300 Subject: bitbake: toaster: tts: fix pylint warnings This patch brings TTS to the pylint coding standards. Pylint was run with some disables: disable=logging-too-many-args,line-too-long,missing-docstring and achieved Your code has been rated at 10.00/10 There are no functional changes. (Bitbake rev: 2b40b412ff6a7e3fd4cc32707bd3cd713bc09ddb) Signed-off-by: Alexandru DAMIAN Signed-off-by: Ed Bartosh Signed-off-by: Richard Purdie --- bitbake/lib/toaster/contrib/tts/recv.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'bitbake/lib/toaster/contrib/tts/recv.py') diff --git a/bitbake/lib/toaster/contrib/tts/recv.py b/bitbake/lib/toaster/contrib/tts/recv.py index 168294acab..2faf8d08c7 100755 --- a/bitbake/lib/toaster/contrib/tts/recv.py +++ b/bitbake/lib/toaster/contrib/tts/recv.py @@ -26,7 +26,6 @@ from __future__ import print_function import sys, os, config, shellutils -from shellutils import ShellCmdException from email.parser import Parser @@ -34,9 +33,13 @@ def recv_mail(datastring): headers = Parser().parsestr(datastring) return headers['subject'] +def main(): + lock_file = shellutils.lockfile(shellutils.mk_lock_filename(), retry=True) -if __name__ == "__main__": - lf = shellutils.lockfile(shellutils.mk_lock_filename(), retry = True) + if lock_file is None: + if config.DEBUG: + print("Concurrent script in progress, exiting") + sys.exit(1) subject = recv_mail(sys.stdin.read()) @@ -47,5 +50,7 @@ if __name__ == "__main__": line = "%s|%s\n" % (task_name, config.TASKS.PENDING) fout.write(line) - shellutils.unlockfile(lf) + shellutils.unlockfile(lock_file) +if __name__ == "__main__": + main() -- cgit v1.2.3-54-g00ecf