Comment 9 for bug 271680

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

Hello Martin,

> in http://bugs.debian.org/416204 and
> https://bugs.launchpad.net/bugs/271680 we requested that the
> python-dateutil package in Debian and Ubuntu should use the system
> tzdata files instead of the shipped obsolete copy. This will keep a
> single reference of the pretty volatile tzdata (which is updated
> regularly in stable releases) instead of spreading it over multiple
> packages.
>
> I made a patch which prefers /usr/share/zoneinfo/ over the internal
> tarball. In the Ubuntu package (just uploaded to intrepid) I don't
> ship the tarball any more, because we can rely on tzdata being
> present. The upstream patch merely prefers looking there first.

dateutil has always preferred the installed timezone information when
it is available. The documented way to ask for a timezone is via the
dateutil.tz.gettz() function, which will process the system's timezone
and give precedence to it. The embedded copy is only used if it is
available, and if the system one isn't found.

> Deleting the tarball breaks the test suite, and applying the patch
> makes it work again. Also, the change is pretty unintrusive, so I
> think I didn't screw it up too much.

The patch changes the behavior of dateutil.zoneinfo, which is the
interface for the embedded copy. It's semantically inappropriate to
make it look for information in the system, since its only purpose is
indeed being the embedded copy API, and the generic interface will
already look for the system timezone information before considering
the embedded one.

It's natural that the tests break if the timezone file isn't found,
since the unittests verify that the embedded functionality actually
works. That doesn't mean that the embedded copy has to be shipped,
though. For Ubuntu, I agree that it's more appropriate to not package
the tarball file, and simply add a requirement on the package to the
timezone information (which I believe is already installed by default
anyway).

Note, with the current python-dateutil:

>>> import dateutil.tz
>>> dateutil.tz
<module 'dateutil.tz' from '/var/lib/python-support/python2.5/dateutil/tz.pyc'>
>>> dateutil.tz.gettz("Brazil/East")
tzfile('/usr/share/zoneinfo/Brazil/East')