summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Bishop <stuart.bishop@canonical.com>2021-03-22 18:56:09 +1100
committerStuart Bishop <stuart.bishop@canonical.com>2021-03-22 18:56:49 +1100
commitaed1838c4010780a5826c917794a53a0408dff39 (patch)
treebf316358eb93c7982aec1222fd57414186525a41
parentb3b0aef2dbb7e2ea921fdb6a00d00f68b52cb2c9 (diff)
parent80f6c97579ab727ad7ec10fbb32e866ae3c7cf0a (diff)
downloadpytz-git-aed1838c4010780a5826c917794a53a0408dff39.tar.gz
Update code generation to Python3
Merge branch 'print-function' of https://github.com/cclauss/pytz
-rw-r--r--gen_pot.py9
-rw-r--r--gen_tzinfo.py17
2 files changed, 14 insertions, 12 deletions
diff --git a/gen_pot.py b/gen_pot.py
index a2358d0..79c4e9d 100644
--- a/gen_pot.py
+++ b/gen_pot.py
@@ -1,3 +1,4 @@
+from __future__ import print_function
import sys
import os.path
import time
@@ -26,12 +27,12 @@ def main():
pot = open(pot_file_name, 'wb')
- print >> pot, boilerplate
+ print(boilerplate, file=pot)
for zone in allzones():
- print >> pot, 'msgid "%s"' % zone
- print >> pot, 'msgstr ""'
- print >> pot
+ print('msgid "%s"' % zone, file=pot)
+ print('msgstr ""', file=pot)
+ print(file=pot)
if __name__ == '__main__':
diff --git a/gen_tzinfo.py b/gen_tzinfo.py
index 02b9d56..0d1c9c8 100644
--- a/gen_tzinfo.py
+++ b/gen_tzinfo.py
@@ -2,6 +2,7 @@
'''
$Id: gen_tzinfo.py,v 1.21 2005/02/15 20:21:38 zenzen Exp $
'''
+from __future__ import print_function
import sys
import os
import os.path
@@ -123,21 +124,21 @@ def add_allzones(filename):
cz.append(zone)
cz.sort()
- print >> outf, 'all_timezones = \\'
+ print('all_timezones = \\', file=outf)
pprint(sorted(allzones()), outf)
- print >> outf, '''all_timezones = LazyList(
+ print('''all_timezones = LazyList(
tz for tz in all_timezones if resource_exists(tz))
- '''
- print >> outf, 'all_timezones_set = LazySet(all_timezones)'
+ ''', file=outf)
+ print('all_timezones_set = LazySet(all_timezones)', file=outf)
# Per lp:1835784 we can't afford to do this at import time
# print >> outf, '_all_timezones_lower_to_standard = dict((tz.lower(), tz) for tz in all_timezones)'
- print >> outf, 'common_timezones = \\'
+ print('common_timezones = \\', file=outf)
pprint(cz, outf)
- print >> outf, '''common_timezones = LazyList(
+ print('''common_timezones = LazyList(
tz for tz in common_timezones if tz in all_timezones)
- '''
- print >> outf, 'common_timezones_set = LazySet(common_timezones)'
+ ''', file=outf)
+ print('common_timezones_set = LazySet(common_timezones)', file=outf)
outf.close()