From: Thanh Ha Date: Fri, 4 Aug 2017 17:29:18 +0000 (-0400) Subject: Ignore shebang when evaluating license headers X-Git-Tag: v0.7.0~4 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F43%2F5743%2F1;p=releng%2Flftools.git Ignore shebang when evaluating license headers The shebang lines in some scripts should be ignored when evaluating license headers. Change-Id: I7d895cf6b00a6edf8303c229278a262129ec2661 Signed-off-by: Thanh Ha --- diff --git a/lftools/license.py b/lftools/license.py index a4ec135b..32bb9554 100644 --- a/lftools/license.py +++ b/lftools/license.py @@ -34,7 +34,8 @@ def get_header_text(_file): if not result: break string = re.sub(r'^\s*#+', '', line).strip() - if bool(re.match('Copyright', string, re.I)): # Ignore the Copyright line + if (bool(re.match('Copyright', string, re.I)) # Ignore the Copyright line + or bool(re.match('^#!', line, re.I))): # Ignore #! shebang lines continue text += ' {}'.format(string) # Strip unnecessary spacing