mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Make scripts python3 compatible
Again using 2to3 and manual checking
This commit is contained in:
parent
73a5e423bd
commit
d0aa7d24ab
@ -296,19 +296,31 @@ def main(argv, contributors):
|
||||
if len(argv) != 4:
|
||||
error(usage(argv[0]))
|
||||
|
||||
txt_credits_data = unicode(as_txt_credits(contributors)).encode("utf-8")
|
||||
if sys.version_info[0] < 3:
|
||||
txt_credits_data = unicode(as_txt_credits(contributors)).encode("utf-8")
|
||||
else:
|
||||
txt_credits_data = str(as_txt_credits(contributors)).encode("utf-8")
|
||||
txt_credits = open(argv[1], "w")
|
||||
txt_credits.write(txt_credits_data)
|
||||
|
||||
php_credits_data = unicode(as_php_credits(contributors, argv[2])).encode("utf-8")
|
||||
if sys.version_info[0] < 3:
|
||||
php_credits_data = unicode(as_php_credits(contributors, argv[2])).encode("utf-8")
|
||||
else:
|
||||
php_credits_data = str(as_php_credits(contributors, argv[2])).encode("utf-8")
|
||||
php_credits = open(argv[2], "w")
|
||||
php_credits.write(php_credits_data)
|
||||
|
||||
php_blanket_data = unicode(as_php_blanket(contributors, argv[3])).encode("utf-8")
|
||||
if sys.version_info[0] < 3:
|
||||
php_blanket_data = unicode(as_php_blanket(contributors, argv[3])).encode("utf-8")
|
||||
else:
|
||||
php_blanket_data = str(as_php_blanket(contributors, argv[3])).encode("utf-8")
|
||||
php_blanket = open(argv[3], "w")
|
||||
php_blanket.write(php_blanket_data)
|
||||
|
||||
warning_data = unicode(collate_incomplete(contributors) + '\n').encode("utf-8")
|
||||
if sys.version_info[0] < 3:
|
||||
warning_data = unicode(collate_incomplete(contributors) + '\n').encode("utf-8")
|
||||
else:
|
||||
warning_data = str(collate_incomplete(contributors) + '\n').encode("utf-8")
|
||||
sys.stderr.write(warning_data)
|
||||
|
||||
|
||||
|
@ -58,7 +58,7 @@ output = open(sys.argv[2], 'w')
|
||||
os.chdir(from_dir)
|
||||
|
||||
found = False
|
||||
for line in input.xreadlines():
|
||||
for line in input:
|
||||
if found and not emptyline.match(line) and not commentline.match(line):
|
||||
# The contents of the final line containing the file name
|
||||
# are ' X <file name>', where X = 0 or 1.
|
||||
|
@ -146,7 +146,7 @@ def legacy_extract_metrics_info(log_file):
|
||||
# Unable to open the file, but do nothing here because
|
||||
# the calling function will act on the value of 'success'.
|
||||
warning('Warning in legacy_extract_metrics_info! Unable to open "%s"' % log_file)
|
||||
warning(`sys.exc_type` + ',' + `sys.exc_value`)
|
||||
warning(repr(sys.exc_info()[0]) + ',' + repr(sys.exc_info()[1]))
|
||||
|
||||
if success == 0:
|
||||
error("Failed to extract metrics info from %s" % log_file)
|
||||
@ -193,7 +193,7 @@ def extract_resolution(log_file, dpi):
|
||||
|
||||
except:
|
||||
warning('Warning in extract_resolution! Unable to open "%s"' % log_file)
|
||||
warning(`sys.exc_type` + ',' + `sys.exc_value`)
|
||||
warning(repr(sys.exc_info()[0]) + ',' + repr(sys.exc_info()[1]))
|
||||
|
||||
# This is safe because both fontsize and magnification have
|
||||
# non-zero default values.
|
||||
@ -214,7 +214,7 @@ def legacy_latex_file(latex_file, fg_color, bg_color):
|
||||
# Unable to open the file, but do nothing here because
|
||||
# the calling function will act on the value of 'success'.
|
||||
warning('Warning in legacy_latex_file! Unable to open "%s"' % latex_file)
|
||||
warning(`sys.exc_type` + ',' + `sys.exc_value`)
|
||||
warning(repr(sys.exc_info()[0]) + ',' + repr(sys.exc_info()[1]))
|
||||
|
||||
for line in f.readlines():
|
||||
if success:
|
||||
|
@ -168,7 +168,7 @@ def run_command_win32(cmd):
|
||||
if hr != winerror.ERROR_IO_PENDING:
|
||||
data = data + buffer
|
||||
|
||||
except pywintypes.error, e:
|
||||
except pywintypes.error as e:
|
||||
if e.args[0] != winerror.ERROR_BROKEN_PIPE:
|
||||
error = 1
|
||||
break
|
||||
@ -406,6 +406,6 @@ def check_latex_log(log_file):
|
||||
|
||||
except:
|
||||
warning('check_latex_log: Unable to open "%s"' % log_file)
|
||||
warning(`sys.exc_type` + ',' + `sys.exc_value`)
|
||||
warning(repr(sys.exc_info()[0]) + ',' + repr(sys.exc_info()[1]))
|
||||
|
||||
return error_pages
|
||||
|
Loading…
Reference in New Issue
Block a user