From 0217b6af423f74ea02a01b669ad6480b935d99b6 Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Thu, 22 Aug 2013 16:10:23 +0200 Subject: [PATCH] Fix useless whitespace characters in license header refs #4603 --- bin/license_writer.py | 49 +++++++++++++++++++++++++++++++----- bin/refresh-translations.php | 24 ++++++++++++++++++ bin/sample.php | 24 ++++++++++++++++++ 3 files changed, 91 insertions(+), 6 deletions(-) diff --git a/bin/license_writer.py b/bin/license_writer.py index f89984e9e..4c5eb27c8 100755 --- a/bin/license_writer.py +++ b/bin/license_writer.py @@ -1,4 +1,30 @@ #!/usr/bin/python + +# {{{ICINGA_LICENSE_HEADER}}} +# This file is part of Icinga 2 Web. +# +# Icinga 2 Web - Head for multiple monitoring backends. +# Copyright (C) 2013 Icinga 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 2 +# 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, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# @copyright 2013 Icinga Development Team +# @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 +# @author Icinga Development Team +# {{{ICINGA_LICENSE_HEADER}}} + import sys import logging import optparse @@ -14,12 +40,17 @@ FILE_TYPE_CONFIG = { 'php': {'prefix': ' * ', 'firstComment': '/**', 'lastComment': ' */', - 'linesFirst': 0, + 'linesBefore': 0, 'linesAfter': 0}, 'js': {'prefix': ' * ', 'firstComment': '/**', 'lastComment': ' */', - 'linesFirst': 0, + 'linesBefore': 0, + 'linesAfter': 0}, + 'py': {'prefix': '# ', + 'firstComment': None, + 'lastComment': None, + 'linesBefore': 0, 'linesAfter': 0} } @@ -156,11 +187,17 @@ def get_license(type): except(KeyError): config = FILE_TYPE_CONFIG[type] license_data = [] - license_data.extend([''] * config['linesFirst']) - license_data.append(config['firstComment']) + license_data.extend([''] * config['linesBefore']) + if config['firstComment'] != None: + license_data.append(config['firstComment']) for line in LICENSE_DATA.split('\n'): - license_data.append(config['prefix'] + line) - license_data.append(config['lastComment']) + if line: + license_data.append(config['prefix'] + line) + else: + # Whitespace is uselses in this case (#4603) + license_data.append(config['prefix'].rstrip()) + if config['lastComment'] != None: + license_data.append(config['lastComment']) license_data.extend([''] * config['linesAfter']) __LICENSE_STORE[type] = '\n'.join(license_data) __LICENSE_STORE[type] = __LICENSE_STORE[type] % REPLACE_TOKENS diff --git a/bin/refresh-translations.php b/bin/refresh-translations.php index 0e2fc1d86..b585cf493 100755 --- a/bin/refresh-translations.php +++ b/bin/refresh-translations.php @@ -1,6 +1,30 @@ #!/usr/bin/php + * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 + * @author Icinga Development Team + */ // {{{ICINGA_LICENSE_HEADER}}} require_once dirname(__FILE__) . '/../library/Icinga/Application/Cli.php'; diff --git a/bin/sample.php b/bin/sample.php index 9a6c21279..769d26580 100755 --- a/bin/sample.php +++ b/bin/sample.php @@ -1,6 +1,30 @@ #!/usr/bin/php + * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 + * @author Icinga Development Team + */ // {{{ICINGA_LICENSE_HEADER}}} set_include_path(