Blame SOURCES/texlive-2017-xepersian-python.patch

4ea8c1
diff -up doc/xelatex/xepersian/dkun-0.3.py.than doc/xelatex/xepersian/dkun-0.3.py
4ea8c1
--- doc/xelatex/xepersian/dkun-0.3.py.than	2018-05-07 11:52:01.795308478 +0200
4ea8c1
+++ doc/xelatex/xepersian/dkun-0.3.py	2018-05-07 11:53:32.984620222 +0200
4ea8c1
@@ -1,4 +1,4 @@
4ea8c1
-#! /usr/bin/env python
4ea8c1
+#! /usr/bin/python
4ea8c1
 
4ea8c1
 #########################################
4ea8c1
 #	General Public License          #
4ea8c1
@@ -311,7 +311,7 @@ def dk_adjust_shaping(text, i):
4ea8c1
 	try:
4ea8c1
 		u = table_DK_UN[current][0]
4ea8c1
 	except KeyError:
4ea8c1
-		print 'ERROR: unmapped character'
4ea8c1
+		print('ERROR: unmapped character')
4ea8c1
 		return u''
4ea8c1
 
4ea8c1
 	#if you don't want shaping remove the following comment
4ea8c1
@@ -407,7 +407,7 @@ def needs_english_wrapper(part):
4ea8c1
 
4ea8c1
 # Main body of the program 
4ea8c1
 if len(sys.argv) <= 2:
4ea8c1
-	print 'usage: python dkun in_filename out_filename'
4ea8c1
+	print('usage: python dkun in_filename out_filename')
4ea8c1
 	exit(0)
4ea8c1
 
4ea8c1
 filename = sys.argv[1]
4ea8c1
@@ -416,13 +416,13 @@ outfile = sys.argv[2]
4ea8c1
 try:
4ea8c1
 	f = open(filename, 'r')
4ea8c1
 except IOError:
4ea8c1
-	print "Can not open the input file: " + filename
4ea8c1
+	print("Can not open the input file: " + filename)
4ea8c1
 	exit(0)
4ea8c1
 
4ea8c1
 try:
4ea8c1
 	of = codecs.open(outfile, encoding='utf-8', mode='w')
4ea8c1
 except IOError:
4ea8c1
-	print "Can not open the output file: " + outfile
4ea8c1
+	print("Can not open the output file: " + outfile)
4ea8c1
 	exit(0)
4ea8c1
 
4ea8c1
 line_number = 0
4ea8c1
diff -up doc/xelatex/xepersian/dkun-0.4.py.than doc/xelatex/xepersian/dkun-0.4.py
4ea8c1
--- doc/xelatex/xepersian/dkun-0.4.py.than	2018-05-07 11:53:54.187692708 +0200
4ea8c1
+++ doc/xelatex/xepersian/dkun-0.4.py	2018-05-07 11:54:32.272822907 +0200
4ea8c1
@@ -1,4 +1,4 @@
4ea8c1
-#! /usr/bin/env python
4ea8c1
+#! /usr/bin/python
4ea8c1
 
4ea8c1
 #########################################
4ea8c1
 #	General Public License          #
4ea8c1
@@ -311,7 +311,7 @@ def dk_adjust_shaping(text, i):
4ea8c1
 	try:
4ea8c1
 		u = table_DK_UN[current][0]
4ea8c1
 	except KeyError:
4ea8c1
-		print 'ERROR: unmapped character'
4ea8c1
+		print('ERROR: unmapped character')
4ea8c1
 		return u''
4ea8c1
 
4ea8c1
 	#if you don't want shaping remove the following comment
4ea8c1
@@ -407,7 +407,7 @@ def needs_english_wrapper(part):
4ea8c1
 
4ea8c1
 # Main body of the program 
4ea8c1
 if len(sys.argv) <= 2:
4ea8c1
-	print 'usage: python dkun in_filename out_filename'
4ea8c1
+	print('usage: python dkun in_filename out_filename')
4ea8c1
 	exit(0)
4ea8c1
 
4ea8c1
 filename = sys.argv[1]
4ea8c1
@@ -416,13 +416,13 @@ outfile = sys.argv[2]
4ea8c1
 try:
4ea8c1
 	f = open(filename, 'r')
4ea8c1
 except IOError:
4ea8c1
-	print "Can not open the input file: " + filename
4ea8c1
+	print("Can not open the input file: " + filename)
4ea8c1
 	exit(0)
4ea8c1
 
4ea8c1
 try:
4ea8c1
 	of = codecs.open(outfile, encoding='utf-8', mode='w')
4ea8c1
 except IOError:
4ea8c1
-	print "Can not open the output file: " + outfile
4ea8c1
+	print("Can not open the output file: " + outfile)
4ea8c1
 	exit(0)
4ea8c1
 
4ea8c1
 line_number = 0
4ea8c1
diff -up doc/xelatex/xepersian/ftxe-0.12.py.than doc/xelatex/xepersian/ftxe-0.12.py
4ea8c1
--- doc/xelatex/xepersian/ftxe-0.12.py.than	2018-05-07 11:54:55.163901164 +0200
4ea8c1
+++ doc/xelatex/xepersian/ftxe-0.12.py	2018-05-07 11:57:58.063526433 +0200
4ea8c1
@@ -1,3 +1,5 @@
4ea8c1
+#! /usr/bin/python
4ea8c1
+
4ea8c1
 #  This program is free software: you can redistribute it and/or modify
4ea8c1
 #  it under the terms of the GNU General Public License as published by
4ea8c1
 #  the Free Software Foundation, either version 3 of the License, or
4ea8c1
@@ -488,7 +490,7 @@ def read_size(input,index,last_index):
4ea8c1
 			dim_index = pt_index
4ea8c1
 	next_cmd = input.find(u'\\', index)
4ea8c1
 	if (next_cmd == -1 and dim_index == -1):
4ea8c1
-		print "Error in parsing \epsfxsize command at " + str(line_number) + "\n"
4ea8c1
+		print("Error in parsing \epsfxsize command at " + str(line_number) + "\n")
4ea8c1
 		return -1
4ea8c1
 	elif (next_cmd == -1 or (dim_index != -1 and next_cmd > dim_index)):
4ea8c1
 		epsfxsize = input[index:dim_index+2]
4ea8c1
@@ -499,7 +501,7 @@ def read_size(input,index,last_index):
4ea8c1
 			end_cmd += 1
4ea8c1
 		return end_cmd
4ea8c1
 	else:
4ea8c1
-		print "Error in parsing \epsfxsize command at " + str(line_number) + "\n"
4ea8c1
+		print("Error in parsing \epsfxsize command at " + str(line_number) + "\n")
4ea8c1
 		return -1
4ea8c1
 
4ea8c1
 
4ea8c1
@@ -567,7 +569,7 @@ def generate_farsitex_cmds_file(helper_f
4ea8c1
 	try:
4ea8c1
 		of = codecs.open(helper_filename, encoding='utf-8', mode='w')
4ea8c1
 	except IOError:
4ea8c1
-		print "Can not open the output file: " + helper_filename
4ea8c1
+		print("Can not open the output file: " + helper_filename)
4ea8c1
 		exit(0)
4ea8c1
 	of.write(preamble)
4ea8c1
 	of.close
4ea8c1
@@ -875,7 +877,7 @@ def convert_file(f, of, convert_cmds):
4ea8c1
 
4ea8c1
 	for line in f:
4ea8c1
 		line_number += 1
4ea8c1
-		print line_number,
4ea8c1
+		print (line_number)
4ea8c1
 		output_line = u''
4ea8c1
 		line_len = len(line)
4ea8c1
 		
4ea8c1
@@ -888,7 +890,7 @@ def convert_file(f, of, convert_cmds):
4ea8c1
 		# check line-direction character
4ea8c1
 		line_direction_rtl = (line[0] == '<')
4ea8c1
 		if (line[0] != '>') and (line[0] != '<'):
4ea8c1
-			print "FORMAT ERROR AT LINE: " + str(line_number)
4ea8c1
+			print("FORMAT ERROR AT LINE: " + str(line_number))
4ea8c1
 			exit(0)
4ea8c1
 	
4ea8c1
 		i = 1
4ea8c1
@@ -970,11 +972,11 @@ def convert_file(f, of, convert_cmds):
4ea8c1
 	# end of file processing
4ea8c1
 
4ea8c1
 def print_usage():
4ea8c1
-	print 'usage: python ftxe-0-11 [-r] [-s] [-x] [-u] in_filename1 in_filename2'
4ea8c1
-	print '-r: (DEFAULT) recursively consider files included in the given files'
4ea8c1
-	print '-s: do not recursively consider files'
4ea8c1
-	print '-x: (DEFAULT) insert xepersian related commands'
4ea8c1
-	print '-u: only convert to unicode'
4ea8c1
+	print('usage: python ftxe-0-11 [-r] [-s] [-x] [-u] in_filename1 in_filename2')
4ea8c1
+	print('-r: (DEFAULT) recursively consider files included in the given files')
4ea8c1
+	print('-s: do not recursively consider files')
4ea8c1
+	print('-x: (DEFAULT) insert xepersian related commands')
4ea8c1
+	print('-u: only convert to unicode')
4ea8c1
 
4ea8c1
 ###################################
4ea8c1
 # Begin of main body of the program
4ea8c1
@@ -1011,7 +1013,7 @@ while (options_index < len(sys.argv)):
4ea8c1
 	options_index += 1
4ea8c1
 
4ea8c1
 if (len(filenames) == 0):
4ea8c1
-	print 'error: no input filename is specified!'
4ea8c1
+	print('error: no input filename is specified!')
4ea8c1
 	print_usage()
4ea8c1
 	exit(0)
4ea8c1
 	
4ea8c1
@@ -1026,17 +1028,17 @@ while (index < len(filenames)):
4ea8c1
 	else: 
4ea8c1
 		outfile = filename + '.tex'
4ea8c1
 
4ea8c1
-	print '\n\nConverting "' + filename + '" into "' + outfile + '"'
4ea8c1
+	print('\n\nConverting "' + filename + '" into "' + outfile + '"')
4ea8c1
 	try:
4ea8c1
 		f = open(filename, 'r')
4ea8c1
 	except IOError:
4ea8c1
-		print "Can not open the input file: " + filename
4ea8c1
+		print("Can not open the input file: " + filename)
4ea8c1
 		exit(0)
4ea8c1
 
4ea8c1
 	try:
4ea8c1
 		of = codecs.open(outfile, encoding='utf-8', mode='w')
4ea8c1
 	except IOError:
4ea8c1
-		print "Can not open the output file: " + outfile
4ea8c1
+		print("Can not open the output file: " + outfile)
4ea8c1
 		exit(0)
4ea8c1
 
4ea8c1
 	convert_file(f, of, convert_xepersian)
4ea8c1
diff -up doc/xelatex/xepersian/undk-0.6.py.than doc/xelatex/xepersian/undk-0.6.py
4ea8c1
--- doc/xelatex/xepersian/undk-0.6.py.than	2018-05-07 11:58:18.706597005 +0200
4ea8c1
+++ doc/xelatex/xepersian/undk-0.6.py	2018-05-07 11:59:18.079799981 +0200
4ea8c1
@@ -1,4 +1,4 @@
4ea8c1
-#! /usr/bin/env python
4ea8c1
+#! /usr/bin/python
4ea8c1
 #########################################
4ea8c1
 #	General Public License          #
4ea8c1
 #	Author:	Mostafa Vahedi          #
4ea8c1
@@ -328,7 +328,7 @@ def find_form(line, i):
4ea8c1
 def map_char_unicode_DK(c, form):
4ea8c1
 	try:
4ea8c1
 		n = table_UN_DK[c][0]
4ea8c1
-        except KeyError:
4ea8c1
+	except KeyError:
4ea8c1
 		return c.encode('latin-1')
4ea8c1
 	if (n == 1):
4ea8c1
 		return table_UN_DK[c][1]
4ea8c1
@@ -371,7 +371,7 @@ def is_farsi_numerical(c):
4ea8c1
 
4ea8c1
 # Main body of the program 
4ea8c1
 if len(sys.argv) <= 2:
4ea8c1
-	print 'usage: python undk in_filename out_filename'
4ea8c1
+	print('usage: python undk in_filename out_filename')
4ea8c1
 	exit(0)
4ea8c1
 
4ea8c1
 filename = sys.argv[1]
4ea8c1
@@ -380,13 +380,13 @@ outfile = sys.argv[2]
4ea8c1
 try:
4ea8c1
 	f = codecs.open(filename, 'r', 'utf-8')
4ea8c1
 except IOError:
4ea8c1
-	print "Can not open the input file: " + filename
4ea8c1
+	print("Can not open the input file: " + filename)
4ea8c1
 	exit(0)
4ea8c1
 
4ea8c1
 try:
4ea8c1
 	of = open(outfile, 'w')
4ea8c1
 except IOError:
4ea8c1
-	print "Can not open the output file: " + outfile
4ea8c1
+	print("Can not open the output file: " + outfile)
4ea8c1
 	exit(0)
4ea8c1
 
4ea8c1
 # this is an option
4ea8c1
@@ -425,7 +425,7 @@ for line in f:
4ea8c1
 					this_line += auto_english_part[::-1]
4ea8c1
 					auto_english_part = ''
4ea8c1
 					inAutoEnglish = 0
4ea8c1
-					print 'Warning: mixed Auto-English and Forced-English'
4ea8c1
+					print('Warning: mixed Auto-English and Forced-English')
4ea8c1
 				if (inFarsiNumber == 1):
4ea8c1
 					this_line += number_part[::-1]
4ea8c1
 					number_part = ''
4ea8c1
diff -up doc/xelatex/xepersian/unldk-0.2.py.than doc/xelatex/xepersian/unldk-0.2.py
4ea8c1
--- doc/xelatex/xepersian/unldk-0.2.py.than	2018-05-07 11:59:41.522880125 +0200
4ea8c1
+++ doc/xelatex/xepersian/unldk-0.2.py	2018-05-07 12:00:21.999018500 +0200
4ea8c1
@@ -1,4 +1,4 @@
4ea8c1
-#! /usr/bin/env python
4ea8c1
+#! /usr/bin/python
4ea8c1
 #########################################
4ea8c1
 #	General Public License          #
4ea8c1
 #	Author:	Mostafa Vahedi          #
4ea8c1
@@ -328,7 +328,7 @@ def find_form(line, i):
4ea8c1
 def map_char_unicode_DK(c, form):
4ea8c1
 	try:
4ea8c1
 		n = table_UN_DK[c][0]
4ea8c1
-        except KeyError:
4ea8c1
+	except KeyError:
4ea8c1
 		return c.encode('latin-1')
4ea8c1
 	if (n == 1):
4ea8c1
 		return table_UN_DK[c][1]
4ea8c1
@@ -364,7 +364,7 @@ def is_farsi_numerical(c):
4ea8c1
 
4ea8c1
 # Main body of the program 
4ea8c1
 if len(sys.argv) <= 2:
4ea8c1
-	print 'usage: python unldk in_filename out_filename'
4ea8c1
+	print('usage: python unldk in_filename out_filename')
4ea8c1
 	exit(0)
4ea8c1
 
4ea8c1
 filename = sys.argv[1]
4ea8c1
@@ -373,13 +373,13 @@ outfile = sys.argv[2]
4ea8c1
 try:
4ea8c1
 	f = codecs.open(filename, 'r', 'utf-8')
4ea8c1
 except IOError:
4ea8c1
-	print "Can not open the input file: " + filename
4ea8c1
+	print("Can not open the input file: " + filename)
4ea8c1
 	exit(0)
4ea8c1
 
4ea8c1
 try:
4ea8c1
 	of = open(outfile, 'w')
4ea8c1
 except IOError:
4ea8c1
-	print "Can not open the output file: " + outfile
4ea8c1
+	print("Can not open the output file: " + outfile)
4ea8c1
 	exit(0)
4ea8c1
 
4ea8c1
 inFarsi = 0