From 5b62f0452e0e7f7f4160d22c9325a3b5c57104be Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Wed, 28 Feb 2024 13:12:05 -0800 Subject: [PATCH] gnulib-tool.py: Emit year range on file copyright notices. * pygnulib/GLInfo.py (GLInfo.copyright_range): New function. Return a copyright string with a year range. * pygnulib/GLEmiter.py (GLEmiter.copyright_notice): Use the new function for file copyright headers. --- ChangeLog | 8 ++++++++ pygnulib/GLEmiter.py | 2 +- pygnulib/GLInfo.py | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8cfe498940..02d22de00f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2024-02-28 Collin Funk + + gnulib-tool.py: Emit year range on file copyright notices. + * pygnulib/GLInfo.py (GLInfo.copyright_range): New function. Return a + copyright string with a year range. + * pygnulib/GLEmiter.py (GLEmiter.copyright_notice): Use the new function + for file copyright headers. + 2024-02-28 Collin Funk gnulib-tool.py: Make module sorting more similar to gnulib-tool. diff --git a/pygnulib/GLEmiter.py b/pygnulib/GLEmiter.py index d8cc085f59..260478e5da 100644 --- a/pygnulib/GLEmiter.py +++ b/pygnulib/GLEmiter.py @@ -73,7 +73,7 @@ class GLEmiter(object): '''GLEmiter.copyright_notice() -> str Emit a header for a generated file.''' - emit = "# %s" % self.info.copyright() + emit = '# %s' % self.info.copyright_range() emit += """ # # This file is free software; you can redistribute it and/or modify diff --git a/pygnulib/GLInfo.py b/pygnulib/GLInfo.py index a0a70270a9..08edb9b383 100644 --- a/pygnulib/GLInfo.py +++ b/pygnulib/GLInfo.py @@ -125,6 +125,10 @@ class GLInfo(object): result = re.compile(' .*').sub('', first_changelog_line) return result + def copyright_range(self): + '''Returns a formatted copyright string showing a year range.''' + return f'Copyright (C) {constants.__copyright__}' + def usage(self): '''Show help message.''' result = '''\ -- 2.39.5