sdispater / pendulum

Python datetimes made easy
https://pendulum.eustace.io
MIT License
6.12k stars 372 forks source link

Fix `pendulum.tz.timezones()` to use system tzdata #801

Open mgorny opened 5 months ago

mgorny commented 5 months ago

Fix the pendulum.tz.available_timezones() to use available_timezones() function instead of iterating over the files in tzdata package. This is more in line with PEP 615, as the system timezone functions will operate on system-provided tzdata when available, and use the tzdata package only if it's not available. Therefore, the previous code would yield a potentially different list of timezones than the system actually provides.

Furthermore, Gentoo provides a dummy tzdata package that does not provide any data, since Python always uses system tzdata. This change is necessary to make pendulum work again on Gentoo.

Fixes #769

Pull Request Check List

mgorny commented 3 months ago

Gentle ping.