commit:     3808311dfeb62c2297e03b78014168573cfa61b7
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Jul  4 05:13:24 2025 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Jul  4 05:13:24 2025 +0000
URL:        
https://gitweb.gentoo.org/proj/pkgcore/pkgcore.git/commit/?id=3808311d

rsync: fix SyntaxWarning when using Python 3.14

Thanks-to: Brian Harring <ferringb <AT> gmail.com>
Resolves: https://github.com/pkgcore/pkgcore/issues/448
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 NEWS.rst                  |  2 ++
 src/pkgcore/sync/rsync.py | 32 +++++++++++++++-----------------
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/NEWS.rst b/NEWS.rst
index 8cc97eed..b64489d1 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -11,6 +11,8 @@ pkgcore 0.12.31 (????-??-??)
 
 - rsync: fix logical bug with negative sync delta (Arthur Zamarin)
 
+- rsync: fix SyntaxWarning when using Python 3.14 (Arthur Zamarin, #448)
+
 ----------------------------
 pkgcore 0.12.30 (2025-06-02)
 ----------------------------

diff --git a/src/pkgcore/sync/rsync.py b/src/pkgcore/sync/rsync.py
index 8f470b9f..7c9aa243 100644
--- a/src/pkgcore/sync/rsync.py
+++ b/src/pkgcore/sync/rsync.py
@@ -228,22 +228,20 @@ class rsync_timestamp_syncer(rsync_syncer):
             # force a reset of the timestamp
             self.last_timestamp = self.current_timestamp()
         finally:
-            if ret:
-                return ret
-            # ensure the timestamp is back to the old
-            try:
-                timestamp_path = pjoin(self.basedir, "metadata", 
"timestamp.chk")
-                if self.last_timestamp is None:
-                    os.remove(timestamp_path)
-                else:
-                    with open(timestamp_path, "w") as f:
-                        f.write(
-                            time.strftime(
-                                "%a, %d %b %Y %H:%M:%S +0000",
-                                time.gmtime(self.last_timestamp),
+            if not ret:
+                # ensure the timestamp is back to the old
+                try:
+                    timestamp_path = pjoin(self.basedir, "metadata", 
"timestamp.chk")
+                    if self.last_timestamp is None:
+                        os.remove(timestamp_path)
+                    else:
+                        with open(timestamp_path, "w") as f:
+                            f.write(
+                                time.strftime(
+                                    "%a, %d %b %Y %H:%M:%S +0000",
+                                    time.gmtime(self.last_timestamp),
+                                )
                             )
-                        )
-            except EnvironmentError:
-                # don't care...
-                pass
+                except EnvironmentError:
+                    pass  # don't care...
         return ret

Reply via email to