Mercurial > p > roundup > code
comparison roundup/init.py @ 5376:64b05e24dbd8
Python 3 preparation: convert print to a function.
Tool-assisted patch. It is possible that some "from __future__ import
print_function" are not in fact needed, if a file only uses print()
with a single string as an argument and so would work fine in Python 2
without that import.
| author | Joseph Myers <jsm@polyomino.org.uk> |
|---|---|
| date | Tue, 24 Jul 2018 09:54:52 +0000 |
| parents | 198b6e810c67 |
| children | 8bd93c8e98a6 |
comparison
equal
deleted
inserted
replaced
| 5375:1ad46057ae4a | 5376:64b05e24dbd8 |
|---|---|
| 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 17 # | 17 # |
| 18 """Init (create) a roundup instance. | 18 """Init (create) a roundup instance. |
| 19 """ | 19 """ |
| 20 from __future__ import print_function | |
| 20 __docformat__ = 'restructuredtext' | 21 __docformat__ = 'restructuredtext' |
| 21 | 22 |
| 22 import os, errno, email.parser | 23 import os, errno, email.parser |
| 23 | 24 |
| 24 | 25 |
| 130 tif = os.path.join(path, 'TEMPLATE-INFO.txt') | 131 tif = os.path.join(path, 'TEMPLATE-INFO.txt') |
| 131 if not os.path.exists(tif): | 132 if not os.path.exists(tif): |
| 132 return None | 133 return None |
| 133 | 134 |
| 134 if os.path.exists(os.path.join(path, 'config.py')): | 135 if os.path.exists(os.path.join(path, 'config.py')): |
| 135 print _("WARNING: directory '%s'\n" | 136 print(_("WARNING: directory '%s'\n" |
| 136 "\tcontains old-style template - ignored" | 137 "\tcontains old-style template - ignored" |
| 137 ) % os.path.abspath(path) | 138 ) % os.path.abspath(path)) |
| 138 return None | 139 return None |
| 139 | 140 |
| 140 # load up the template's information | 141 # load up the template's information |
| 141 try: | 142 try: |
| 142 f = open(tif) | 143 f = open(tif) |
