Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-crontab for openSUSE:Factory 
checked in at 2025-07-14 10:51:40
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-crontab (Old)
 and      /work/SRC/openSUSE:Factory/.python-crontab.new.7373 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-crontab"

Mon Jul 14 10:51:40 2025 rev:7 rq:1292436 version:1.0.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-crontab/python-crontab.changes    
2025-06-16 11:13:18.665357285 +0200
+++ /work/SRC/openSUSE:Factory/.python-crontab.new.7373/python-crontab.changes  
2025-07-14 10:56:59.809800718 +0200
@@ -1,0 +2,8 @@
+Sat Jul 12 17:26:33 UTC 2025 - Dirk Müller <dmuel...@suse.com>
+
+- update to 1.0.5:
+  * [added] the ability to use z0 as last day of the month, z1
+    for the day before the last day of the month, up to z7 for
+    7 days before the last day of the month.
+
+-------------------------------------------------------------------

Old:
----
  crontab-1.0.4.tar.gz

New:
----
  crontab-1.0.5.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-crontab.spec ++++++
--- /var/tmp/diff_new_pack.dMnLpO/_old  2025-07-14 10:57:00.349823105 +0200
+++ /var/tmp/diff_new_pack.dMnLpO/_new  2025-07-14 10:57:00.353823270 +0200
@@ -18,7 +18,7 @@
 
 %{?sle15_python_module_pythons}
 Name:           python-crontab
-Version:        1.0.4
+Version:        1.0.5
 Release:        0
 Summary:        Python module for parsing and using crontab schedules
 License:        LGPL-2.1-only

++++++ crontab-1.0.4.tar.gz -> crontab-1.0.5.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/parse-crontab-1.0.4/README.rst 
new/parse-crontab-1.0.5/README.rst
--- old/parse-crontab-1.0.4/README.rst  2025-04-09 21:01:12.000000000 +0200
+++ new/parse-crontab-1.0.5/README.rst  2025-07-09 19:08:27.000000000 +0200
@@ -21,7 +21,7 @@
 Seconds       No          0-59              0              \* / , -
 Minutes       Yes         0-59              N/A            \* / , -
 Hours         Yes         0-23              N/A            \* / , -
-Day of month  Yes         1-31              N/A            \* / , - ? L
+Day of month  Yes         1-31              N/A            \* / , - ? L Z
 Month         Yes         1-12 or JAN-DEC   N/A            \* / , -
 Day of week   Yes         0-6 or SUN-SAT    N/A            \* / , - ? L
 Year          No          1970-2099         *              \* / , -
@@ -117,3 +117,8 @@
     24 7 * * L5 -> 7:24 AM on the last friday of every month
     24 7 * * Lwed-fri ->
         7:24 AM on the last wednesday, thursday, and friday of every month
+    0 8 L * * -> 8 AM on the last day of the month, every month
+    0 8 Z0 * * -> 8 AM on the last day of the month, z0 is an alias for L
+    0 8 Z1 * * -> 8 AM 1 day before the last day of the month, every month
+    0 8 Z2 * * -> 8 AM 2 days before last day of the month, every month
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/parse-crontab-1.0.4/changelog.txt 
new/parse-crontab-1.0.5/changelog.txt
--- old/parse-crontab-1.0.4/changelog.txt       2025-04-09 21:01:12.000000000 
+0200
+++ new/parse-crontab-1.0.5/changelog.txt       2025-07-09 19:08:27.000000000 
+0200
@@ -1,4 +1,12 @@
-# changes in verion 1.0.1
+# changes in version 1.0.5
+[added] the ability to use z0 as last day of the month, z1 for the day before
+  the last day of the month, up to z7 for 7 days before the last day of the
+  month. Closing feature request issue #46.
+
+# changes in 1.0.2, 1.0.3, 1.0.4
+[fixed] distutils -> setuptools
+
+# changes in version 1.0.1
 [added] merge PR #41
 
 # changes in version 1.0.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/parse-crontab-1.0.4/crontab/_crontab.py 
new/parse-crontab-1.0.5/crontab/_crontab.py
--- old/parse-crontab-1.0.4/crontab/_crontab.py 2025-04-09 21:01:12.000000000 
+0200
+++ new/parse-crontab-1.0.5/crontab/_crontab.py 2025-07-09 19:08:27.000000000 
+0200
@@ -2,8 +2,8 @@
 '''
 crontab.py
 
-Written July 15, 2011 by Josiah Carlson
-Copyright 2011-2021 Josiah Carlson
+Originally written July 15, 2011 by Josiah Carlson <josiah.carl...@gmail.com>
+Copyright 2011-2025 Josiah Carlson
 Released under the GNU LGPL v2.1 and v3
 available:
 http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
@@ -224,18 +224,29 @@
 
                 x = x[1:]
                 if x.isdigit():
-                    x = int(x) if x != '7' else 0
+                    x = int(x, 10) if x != '7' else 0
                     if v == x:
                         return True
                     continue
 
-                start, end = map(int, x.partition('-')[::2])
+                start, end = (int(i, 10) for i in x.partition('-')[::2])
                 allowed = set(range(start, end+1))
                 if 7 in allowed:
                     allowed.add(0)
                 if v in allowed:
                     return True
 
+            elif x.startswith('z'):
+                x = x[1:]
+                eom = _end_of_month(dt).day
+                if x.isdigit():
+                    x = int(x, 10)
+                    return (eom - x) == v
+
+                start, end = (int(i, 10) for i in x.partition('-')[::2])
+                if v in set(eom - i for i in range(start, end+1)):
+                    return True
+
         return self.any or v in self.allowed
 
     def __lt__(self, other):
@@ -332,14 +343,24 @@
                 "you can only specify a bare 'L' in the 'day' field")
             return None, _end
 
+        # for the days before the last day of the month
+        elif entry.startswith('z'):
+            _assert(which == DAY_OFFSET,
+                "you can only specify a leading 'Z' in the 'day' field")
+            es, _, ee = entry[1:].partition('-')
+            _assert((entry[1:].isdigit() and 0 <= int(es, 10) <= 7) or
+                    (_ and es.isdigit() and ee.isdigit() and 0 <= int(es, 10) 
<= 7 and 1 <= int(ee, 10) <= 7 and es <= ee),
+                "<day> specifier must include a day number or range 0..7 in 
the 'day' field, you entered %r", entry)
+            return None, _end
+
         # for the last 'friday' of the month, for example
         elif entry.startswith('l'):
             _assert(which == WEEK_OFFSET,
                 "you can only specify a leading 'L' in the 'weekday' field")
             es, _, ee = entry[1:].partition('-')
-            _assert((entry[1:].isdigit() and 0 <= int(es) <= 7) or
-                    (_ and es.isdigit() and ee.isdigit() and 0 <= int(es) <= 7 
and 0 <= int(ee) <= 7),
-                "last <day> specifier must include a day number or range in 
the 'weekday' field, you entered %r", entry)
+            _assert((entry[1:].isdigit() and 0 <= int(es, 10) <= 7) or
+                    (_ and es.isdigit() and ee.isdigit() and 0 <= int(es, 10) 
<= 7 and 0 <= int(ee, 10) <= 7),
+                "last <day> specifier must include a day number or range 0..7 
in the 'weekday' field, you entered %r", entry)
             return None, _end
 
         # allow Sunday to be specified as weekday 7
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/parse-crontab-1.0.4/setup.py 
new/parse-crontab-1.0.5/setup.py
--- old/parse-crontab-1.0.4/setup.py    2025-04-09 21:01:12.000000000 +0200
+++ new/parse-crontab-1.0.5/setup.py    2025-07-09 19:08:27.000000000 +0200
@@ -10,7 +10,7 @@
 
 setup(
     name='crontab',
-    version='1.0.4',
+    version='1.0.5',
     description='Parse and use crontab schedules in Python',
     author='Josiah Carlson',
     author_email='josiah.carl...@gmail.com',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/parse-crontab-1.0.4/tests/test_crontab.py 
new/parse-crontab-1.0.5/tests/test_crontab.py
--- old/parse-crontab-1.0.4/tests/test_crontab.py       2025-04-09 
21:01:12.000000000 +0200
+++ new/parse-crontab-1.0.5/tests/test_crontab.py       2025-07-09 
19:08:27.000000000 +0200
@@ -225,5 +225,22 @@
         b = CronTab("3 * 5 6 *")
         self.assertNotEqual(a, b)
 
+    def test_last_days(self):
+        utc = dateutil.tz.tzutc()
+        a = CronTab("* * l * *")
+        b = CronTab("* * z0 * *")
+        c = CronTab("* * z1 * *")
+        d = CronTab("* * z7 * *")
+        e = CronTab("* * z0-7 * *")
+
+        a_day = datetime.datetime(2025, 7, 8, 0, 0, tzinfo=utc)
+        last = a.next(a_day)
+        self.assertEqual(last, b.next(a_day))
+        last = a_day + datetime.timedelta(seconds=last)
+        self.assertEqual(last.day - 1, (a_day + 
datetime.timedelta(seconds=c.next(a_day))).day)
+        self.assertEqual(last.day - 7, (a_day + 
datetime.timedelta(seconds=d.next(a_day))).day)
+        self.assertEqual(last.day - 7, (a_day + 
datetime.timedelta(seconds=e.next(a_day))).day)
+
+
 if __name__ == '__main__':
     unittest.main()

Reply via email to