public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Brian Inglis <Brian.Inglis@Shaw.ca>
To: cygwin@cygwin.com
Subject: Re: update pytz to 2023.2/2023b tzdata?
Date: Sun, 26 Mar 2023 18:13:31 -0600	[thread overview]
Message-ID: <5ec38def-6dd4-1b15-6058-2feda2f788cf@Shaw.ca> (raw)
In-Reply-To: <4d5cb9f4-7175-44b6-147f-0b0caa3dbad9@Shaw.ca>

[-- Attachment #1: Type: text/plain, Size: 2100 bytes --]

On 2023-03-26 14:45, Brian Inglis via Cygwin wrote:
> On 2023-03-07 22:11, Marco Atzeri wrote:
>> On 07.03.2023 22:35, marco atzeri wrote:
>>> On Tue, Mar 7, 2023 at 10:18 PM Brian Inglis wrote:
>>>> On 2022-03-20 10:00, Brian Inglis wrote:
>>>>> On 2021-12-21 09:06, Marco Atzeri wrote:
> 
>>>>>> python39-pytz                           2021.3-1
> 
>>>> Update needed to 2022g/2022.7.1 as a new Mexican zone was added since
>>>> 2021c/2021.3 due to Mexican changes conflicting with US practices, affecting
>>>> border towns:
> 
>> 2022.7.1 is up
> 
> Thanks Marco,
> 
> Looks like pytz needs another update as tzdata was updated twice this week!
> Some middle eastern governments just realized Ramadan was during DST ;^>
> 
> $ pytz-date.py "%Y %b %d %a %T %Z%z" Asia/Beirut
> 2023 Mar 26 Sun 20:41:45 UTC+0000       zoneinfo        UTC
> 2023 Mar 26 Sun 22:41:45 EET+0200       zoneinfo        Asia/Beirut
> 2023 Mar 26 Sun 23:41:45 EEST+0300      pytz            Asia/Beirut

I am unfamiliar with python and pytz, and I had a *local* pip install of pytz, 
which looks like it was overriding the Cygwin install.
After doing a local pip uninstall and Cygwin reinstall, with updated tzdata 
only, it appears that current pytz may now be giving the correct results:

$ ./pytz-date.py +"%Y %b %d %a %T %Z%z" Asia/Beirut
2023 Mar 27 Mon 00:05:57 UTC+0000       zoneinfo        UTC
2023 Mar 27 Mon 00:05:57 UTC+0000       pytz            UTC
2023 Mar 27 Mon 02:05:57 EET+0200       zoneinfo        Asia/Beirut
2023 Mar 27 Mon 02:05:57 EET+0200       pytz            Asia/Beirut

so an updated release may not be required?
There have been no zone changes, just DST rules.

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                 -- Antoine de Saint-Exupéry

[-- Attachment #2: pytz-date.py --]
[-- Type: text/plain, Size: 1245 bytes --]

#!/usr/bin/python
# pytz-date.py - print current UTC, zoneinfo and pytz date time
#                in optional format "+"$1 in zone $#

from datetime import datetime
from zoneinfo import ZoneInfo
from pytz import timezone
import pytz
import sys
import os

TZ          = "TZ"                      # env var
GMT         = "GMT"                     # ref zones
GMTP0       = "GMT+0"
GMTM0       = "GMT-0"
UTC         = "UTC"
refs        = [ UTC , GMT , GMTP0 , GMTM0 ]
FMT         = "%c %Z%z"
zi_fmt      = "%tzoneinfo%t"
pytz_fmt    = "%tpytz%t%t"

dt_fmt      = FMT
tz          = os.getenv( TZ, UTC)       # TZ env var else UTC
argc        = len( sys.argv )
argn        = 1

# $1 +fmt optional override
if argc > argn and sys.argv[argn][0] == "+":
    dt_fmt  = sys.argv[argn][1:]
    argn   += 1

# $# zone
if argc > argn:
    tz  = sys.argv[argn]

# zone ref UTC
zones = [ UTC ]
# add arg if not same as ref
if tz not in refs:
    zones = zones + [ tz ]

# print ref and arg with zoneinfo and pytz
for z in zones:
# TZ=z  date    +"f" - zoneinfo
        print( datetime.now( ZoneInfo( z )).strftime( dt_fmt + zi_fmt + z ))
# TZ=z  date    +"f" - pytz
        print( datetime.now().astimezone( timezone( z )).strftime( dt_fmt + pytz_fmt + z ))


      reply	other threads:[~2023-03-27  0:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-21 16:06 [ANNOUNCEMENT] Updated: python 3.9 packages Marco Atzeri via Cygwin-announce
2021-12-22 13:52 ` airplanemath
2021-12-23 20:00   ` Marco Atzeri
2021-12-24 10:57     ` Jon Turney
2021-12-24 11:16       ` Marco Atzeri
2021-12-24 13:53         ` Jon Turney
2021-12-23 20:34 ` Russell VT
2021-12-24  6:57   ` Marco Atzeri
2022-03-20 16:00 ` deprecate pytz? Brian Inglis
2023-03-07 21:18   ` deprecate pytz? or update pytz to 2022g/2022.7.1 Brian Inglis
2023-03-07 21:35     ` marco atzeri
2023-03-08  5:11       ` Marco Atzeri
2023-03-26 20:45         ` update pytz to 2023.2/2023b tzdata Brian Inglis
2023-03-27  0:13           ` Brian Inglis [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5ec38def-6dd4-1b15-6058-2feda2f788cf@Shaw.ca \
    --to=brian.inglis@shaw.ca \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).