On 2/28/24 3:00 AM, Bruno Haible wrote:
> I'm committing these three patches, that fix the version output also in the
> presence of
> 
> [log]
>       date = relative

Nice. I wasn't aware of this option. Your fixes give me the correct
date and time now.

How does this patch look for fixing the copyright headers? I could
have just used constants.__copyright__ in GLEmiter, but I thought it
was best to put in GLInfo just in case it is needed elsewhere later.

Collin
From 67a69b85467f1641f5e8741a22c929cdf8268cd8 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
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  <collin.fu...@gmail.com>
+
+	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  <collin.fu...@gmail.com>
 
 	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..1934fde103 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 formated copyright string showing a year range.'''
+        return f'Copyright (C) {constants.__copyright__}'
+
     def usage(self):
         '''Show help message.'''
         result = '''\
-- 
2.39.2

Reply via email to