Activity log for bug #1373960

Date Who What changed Old value New value Message
2014-09-25 14:09:33 mm bug added bug
2014-09-25 14:18:02 mm description pytz should provide a simple way to set a different 'zoneinfo' directory for the timezone files. This could be used to switch to the installed OS files or in my case to easier switch zoneinfo versions. One solution could be to change in the open_resource(name) function in __init__.py the filename = os.path.join(os.path.dirname(__file__), 'zoneinfo', *name_parts) to filename = os.path.join(zoneinfo_dir, *name_parts) and insert on module level zoneinfo_dir = os.path.join(os.path.dirname(__file__), 'zoneinfo') In this way, the user of might zoneinfo_dir = os.environ.get('TZDATADIR', os.path.join(os.path.dirname(__file__), 'zoneinfo') ) pytz should provide a simple way to set a different 'zoneinfo' directory for the timezone files. This could be used to switch to the installed OS files or in my case to easier switch zoneinfo versions. One solution could be to change in the open_resource(name) function in __init__.py :     filename = os.path.join(os.path.dirname(__file__), 'zoneinfo', *name_parts) to     filename = os.path.join(zoneinfo_dir, *name_parts) and insert on module level     zoneinfo_dir = os.path.join(os.path.dirname(__file__), 'zoneinfo') In this way, the calling program is able to set the directory to a different one: import pytz pytz.zoneinfo_dir = '/usr/share/zoneinfo' Another option could be to evaluate an environment variable e.g. TZDATADIR and use its string as zoneinfo directory     zoneinfo_dir = os.environ.get('TZDATADIR', os.path.join(os.path.dirname(__file__), 'zoneinfo') ) A change would support the question discussed in https://answers.launchpad.net/pytz/+question/236068
2015-05-12 12:08:37 Stuart Bishop pytz: status New Triaged
2016-11-03 10:56:53 Andriy Pylypenko attachment added pytz_zoneinfo_dir.diff https://bugs.launchpad.net/pytz/+bug/1373960/+attachment/4771765/+files/pytz_zoneinfo_dir.diff
2017-10-30 14:00:04 Stuart Bishop pytz: status Triaged Fix Committed
2017-10-30 14:18:21 Stuart Bishop pytz: status Fix Committed Fix Released