Bug#1007255: khal: Emits warnings about deprecated localize tz method

2022-11-17 Thread Detlev Zundel
Package: khal
Version: 1:0.10.4~ds-4
Followup-For: Bug #1007255

So I finally also ran into this problem.  Upstream has a lot of issues around
the timezone warnings, but I especially looked at this one:

https://github.com/pimutils/khal/issues/1092

So it seems upstream has fixed the problem and indeed installing khal via pip
gives me a version 0.10.6.dev105+g5191ee8 running without problems:

dzu@krikkit:/opt/src/git/khal (master)$ pip install
git+https://github.com/pimutils/khal
Defaulting to user installation because normal site-packages is not writeable
Collecting git+https://github.com/pimutils/khal
  Cloning https://github.com/pimutils/khal to /tmp/pip-req-build-sthm81rz
  Running command git clone --filter=blob:none --quiet
https://github.com/pimutils/khal /tmp/pip-req-build-sthm81rz
  Resolved https://github.com/pimutils/khal to commit
5191ee88456b004d1d9d415045d57259ac6c03c8
 []
Successfully built khal
Installing collected packages: khal
Successfully installed khal-0.10.6.dev105+g5191ee8
dzu@krikkit:/opt/src/git/khal (master)$

So very likely an updated Debian package will also solve this problem.


-- System Information:
Debian Release: bookworm/sid
  APT prefers testing-debug
  APT policy: (500, 'testing-debug'), (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.0.0-2-amd64 (SMP w/8 CPU threads; PREEMPT)
Kernel taint flags: TAINT_WARN, TAINT_OOT_MODULE
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages khal depends on:
ii  python33.10.6-1
ii  python3-atomicwrites   1.4.1-1
ii  python3-click  8.0.3-1
ii  python3-click-log  0.3.2-1
ii  python3-configobj  5.0.6-5
ii  python3-dateutil   2.8.2-1
ii  python3-icalendar  4.0.3-5
ii  python3-packaging  21.3-1.1
ii  python3-pkg-resources  65.5.0-1
ii  python3-tz 2022.6-1
ii  python3-tzlocal4.2-1
ii  python3-urwid  2.1.2-2+b2
ii  python3-xdg0.27-3

Versions of packages khal recommends:
ii  python3-setproctitle  1.3.1-1+b1

Versions of packages khal suggests:
pn  khal-doc  

-- no debconf information



Bug#1007255: khal: Emits warnings about deprecated localize tz method

2022-04-03 Thread eingousef
Package: khal
Version: 1:0.10.4~ds-3
Followup-For: Bug #1007255
X-Debbugs-Cc: eingousef+debb...@rhizogen.es.eu.org

Dear Maintainer,

I would like to add that on my system at least, this error seems to
prevent the creation of an event via `khal new` if I dont explicitely
set the timezone :

$ khal new -a private_calendar '2022-04-10 09:00' "Test2" :: "test2" 
/usr/lib/python3/dist-packages/khal/icalendar.py:104: PytzUsageWarning: The 
localize method is no longer necessary, as this time zone supports the fold 
attribute (PEP 495). For more details on migrating to a PEP 495-compliant 
implementation, see 
https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html
  dtstart = timezone.localize(dtstart)
/usr/lib/python3/dist-packages/khal/icalendar.py:105: PytzUsageWarning: The 
localize method is no longer necessary, as this time zone supports the fold 
attribute (PEP 495). For more details on migrating to a PEP 495-compliant 
implementation, see 
https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html
  dtend = timezone.localize(dtend)
/usr/lib/python3/dist-packages/icalendar/parser.py:54: PytzUsageWarning: The 
zone attribute is specific to pytz's interface; please migrate to a new time 
zone provider. For more details on how to do so, see 
https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html
  if hasattr(dt.tzinfo, 'zone'):
/usr/lib/python3/dist-packages/icalendar/parser.py:55: PytzUsageWarning: The 
zone attribute is specific to pytz's interface; please migrate to a new time 
zone provider. For more details on how to do so, see 
https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html
  tzid = dt.tzinfo.zone  # pytz implementation
Traceback (most recent call last):
  File "/usr/bin/khal", line 5, in 
main_khal()
  File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in __call__
return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/decorators.py", line 26, in 
new_func
return f(get_current_context(), *args, **kwargs)
  File "/usr/lib/python3/dist-packages/khal/cli.py", line 388, in new
new_func(
  File "/usr/lib/python3/dist-packages/khal/controllers.py", line 355, in 
new_from_string
new_from_args(
  File "/usr/lib/python3/dist-packages/khal/controllers.py", line 381, in 
new_from_args
collection.new(event)
  File "/usr/lib/python3/dist-packages/khal/khalendar/khalendar.py", line 208, 
in new
event.href, event.etag = self._storages[calendar].upload(event)
  File "/usr/lib/python3/dist-packages/khal/khalendar/vdir.py", line 212, in 
upload
if not isinstance(item.raw, str):
  File "/usr/lib/python3/dist-packages/khal/khalendar/event.py", line 382, in 
raw
timezone = create_timezone(tzinfo, self.start)
  File "/usr/lib/python3/dist-packages/khal/khalendar/event.py", line 858, in 
create_timezone
for one, two in iter(tz._tzinfos.items())
AttributeError: '_PytzShimTimezone' object has no attribute '_tzinfos'

When setting the timezone it works as expected :

$ khal new -a private_calendar '2022-04-10 09:00 Europe/Paris' "Test2" :: 
"test2"

Regards,

-- System Information:
Debian Release: bookworm/sid
  APT prefers testing
  APT policy: (990, 'testing'), (980, 'stable-updates'), (980, 'stable'), (500, 
'stable-security'), (500, 'oldstable-updates'), (500, 'oldoldstable'), (500, 
'oldstable'), (90, 'experimental'), (90, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.16.0-5-amd64 (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: OpenRC (via /run/openrc), PID 1: init
LSM: AppArmor: enabled

Versions of packages khal depends on:
ii  python33.9.8-1
ii  python3-atomicwrites   1.4.0-2
ii  python3-click  8.0.3-1
ii  python3-click-log  0.2.1-2
ii  python3-configobj  5.0.6-5
ii  python3-dateutil   2.8.1-6
ii  python3-icalendar  4.0.3-4
ii  python3-pkg-resources  59.6.0-1.2
ii  python3-tz 2022.1-1
ii  python3-tzlocal4.1-1
ii  python3-urwid  2.1.2-2+b1
ii  python3-xdg0.27-2

Versions of packages khal recommends:
ii  python3-setproctitle  1.2.2-2+b1

Versions of packages khal suggests:
ii  khal-doc  1:0.10.4~ds-3

-- no debconf information


Bug#1007255: khal: Emits warnings about deprecated localize tz method

2022-03-14 Thread Guillem Jover
Source: khal
Source-Version: 1:0.10.4~ds-3
Severity: important
Tags: upstream

Hi!

This package started to emit deprecation warnings once the python3-tzlocal
got updated few days ago to version 4.1-1 (which depends transitively on
python3-pytz-deprecation-shim).

When running something like «khal calendar» one now gets this
screenful of warnings:

  ,--- khal calendar ---
  /usr/lib/python3/dist-packages/khal/controllers.py:256: PytzUsageWarning: The 
localize method is no longer necessary, as this time zone supports the fold 
attribute (PEP 495). For more details on migrating to a PEP 495-compliant 
implementation, see 
https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html
original_start = conf['locale']['local_timezone'].localize(start)
  /usr/lib/python3/dist-packages/khal/controllers.py:177: PytzUsageWarning: The 
localize method is no longer necessary, as this time zone supports the fold 
attribute (PEP 495). For more details on migrating to a PEP 495-compliant 
implementation, see 
https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html
start_local = locale['local_timezone'].localize(start)
  /usr/lib/python3/dist-packages/khal/controllers.py:178: PytzUsageWarning: The 
localize method is no longer necessary, as this time zone supports the fold 
attribute (PEP 495). For more details on migrating to a PEP 495-compliant 
implementation, see 
https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html
end_local = locale['local_timezone'].localize(end)
  /usr/lib/python3/dist-packages/khal/khalendar/event.py:541: PytzUsageWarning: 
The localize method is no longer necessary, as this time zone supports the fold 
attribute (PEP 495). For more details on migrating to a PEP 495-compliant 
implementation, see 
https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html
start_local_datetime = self._locale['local_timezone'].localize(
  /usr/lib/python3/dist-packages/khal/khalendar/event.py:543: PytzUsageWarning: 
The localize method is no longer necessary, as this time zone supports the fold 
attribute (PEP 495). For more details on migrating to a PEP 495-compliant 
implementation, see 
https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html
end_local_datetime = self._locale['local_timezone'].localize(
  /usr/lib/python3/dist-packages/khal/khalendar/event.py:546: PytzUsageWarning: 
The localize method is no longer necessary, as this time zone supports the fold 
attribute (PEP 495). For more details on migrating to a PEP 495-compliant 
implementation, see 
https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html
day_start = self._locale['local_timezone'].localize(
  /usr/lib/python3/dist-packages/khal/khalendar/event.py:549: PytzUsageWarning: 
The localize method is no longer necessary, as this time zone supports the fold 
attribute (PEP 495). For more details on migrating to a PEP 495-compliant 
implementation, see 
https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html
day_end = self._locale['local_timezone'].localize(
  /usr/lib/python3/dist-packages/khal/khalendar/khalendar.py:162: 
PytzUsageWarning: The localize method is no longer necessary, as this time zone 
supports the fold attribute (PEP 495). For more details on migrating to a PEP 
495-compliant implementation, see 
https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html
self._backend.get_localized_calendars(localize(start), localize(end)),
  `---

Thanks,
Guillem