diff options
Diffstat (limited to 'fonts/gentium-tug/source/type1/afmcreator.py')
-rwxr-xr-x | fonts/gentium-tug/source/type1/afmcreator.py | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/fonts/gentium-tug/source/type1/afmcreator.py b/fonts/gentium-tug/source/type1/afmcreator.py index bc44f1cd85..7d81f9f7a1 100755 --- a/fonts/gentium-tug/source/type1/afmcreator.py +++ b/fonts/gentium-tug/source/type1/afmcreator.py @@ -1,22 +1,18 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 # This file is part of the Gentium package for TeX. # It is licensed under the Expat License, see doc//README for details. -import os, sys +import os +import sys creatortext = "Comment Creator: TeX Users Group\n" tempname = "temp.afm" -fin = open(sys.argv[1], "r") -fout = open(tempname, "w") -while True: - s = fin.readline() - if s == "": break # end of file - fout.write(s) - if s.find("Comment Creation Date") == 0 : - fout.write(creatortext) # Creator after Creation Date -fin.close() -fout.close() +with open(sys.argv[1], "r") as fin, open(tempname, "w") as fout: + for line in fin: + fout.write(line) + if line.startswith("Comment Creation Date"): + fout.write(creatortext) # Creator after Creation Date os.rename(tempname, sys.argv[1]) |