File: 0006-python3.patch

package info (click to toggle)
pyxplot 0.9.2-15
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,312 kB
  • sloc: ansic: 50,373; xml: 1,339; python: 570; sh: 318; makefile: 90
file content (166 lines) | stat: -rw-r--r-- 7,202 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
From: Stuart Prescott <stuart@debian.org>
Date: Wed, 19 Feb 2020 13:36:39 +1100
Subject: python3

---
 Makefile.skel                     |  2 +-
 buildScripts/colorlistGenerate.py |  3 +--
 buildScripts/parser_data.py       | 15 +++++++--------
 doc/Makefile                      |  2 +-
 doc/makeFigureEps.py              |  4 ++--
 doc/makeFigureTex.py              |  2 +-
 doc/makeFragmentTex.py            |  4 ++--
 7 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/Makefile.skel b/Makefile.skel
index b96d3a6..74b7e72 100644
--- a/Makefile.skel
+++ b/Makefile.skel
@@ -33,7 +33,7 @@ BINDIR_PRIVATE=${DESTDIR}${USRDIR}/lib/pyxplot
 SRCDIR=${DESTDIR}${USRDIR}/share/pyxplot
 DOCDIR=${DESTDIR}${USRDIR}/share/doc/pyxplot
 MANDIR=${DESTDIR}${USRDIR}/share/man/man1
-PYTHON=python
+PYTHON=python3
 
 CWD=$(shell pwd)
 
diff --git a/buildScripts/colorlistGenerate.py b/buildScripts/colorlistGenerate.py
index b1a3901..dc5a0fe 100644
--- a/buildScripts/colorlistGenerate.py
+++ b/buildScripts/colorlistGenerate.py
@@ -98,8 +98,7 @@ for greylevel in range(0,101):
  color_list["grey%02d"%greylevel] = [0, 0, 0, float(100-greylevel)/100]
  color_list["gray%02d"%greylevel] = [0, 0, 0, float(100-greylevel)/100]
 
-color_names = color_list.keys()
-color_names.sort()
+color_names = sorted(color_list.keys())
 
 # Write ppl_colors.h
 output = open("src/settings/epsColors.h","w")
diff --git a/buildScripts/parser_data.py b/buildScripts/parser_data.py
index e21f974..9f95f91 100644
--- a/buildScripts/parser_data.py
+++ b/buildScripts/parser_data.py
@@ -28,16 +28,15 @@ def processVarTable(vt, directive, setOption):
  if '%' in directive: return
  key = "%s_%s"%(directive,setOption)
  globalVarTable[key] = vt
- for name,pos in vt.iteritems():
+ for name,pos in vt.items():
   if name not in globalVarNames: globalVarNames.append(name)
 
 def printVarTable():
  global globalVarNames,globalVarTable,f_h,f_c
- globalVarNames.sort()
+ globalVarNames = sorted(globalVarNames)
  for i in range(len(globalVarNames)):
    f_h.write("#define PARSE_INDEX_%s %d\n"%(sanitize(globalVarNames[i]),i))
- keys = globalVarTable.keys()
- keys.sort()
+ keys = sorted(globalVarTable.keys())
  for k in keys:
    d = globalVarTable[k]
    f_h.write("extern const int PARSE_TABLE_%s[];\n"%k)
@@ -124,7 +123,7 @@ for line in f_in:
       parts = [ "]" , word[2:] , "" , "1" ]
       listsizes.append(varcount)
       varcount=stack.pop()
-      for key,item in varnames.iteritems(): stack_varnames[-1]["%s_%s"%(key,varname)] = item
+      for key,item in varnames.items(): stack_varnames[-1]["%s_%s"%(key,varname)] = item
       varnames=stack_varnames.pop()
     if varname=='directive': # Directive names are stored for use in #defines to convert variable names into output slot numbers
       if parts[2]=="": directive = parts[0]
@@ -139,7 +138,7 @@ for line in f_in:
       if   (parts[0]=="%p"): varcount += 2 # Position vectors require 2 or 3 slots
       elif (parts[0]=="%P"): varcount += 3
       else                 : varcount += 1 # Varcount keeps track of the slot number to place the next variable in
-    elif (parts[0] in ["%p","%P"]): print "Danger in command %s: sharing position variable name with other variables of different lengths"%directive
+    elif (parts[0] in ["%p","%P"]): print("Danger in command %s: sharing position variable name with other variables of different lengths"%directive)
     outnum = varnames[varname]
     parts.append("%s"%outnum) # parts[4] = slot number
     if word.startswith("]:"):
@@ -152,10 +151,10 @@ for line in f_in:
   f_c.write("%d "%(varcount)) # First word on each statement definition line is the number of variables in the root slotspace
   f_c.write("%s\\n\\\n"%outline)
   processVarTable(vartable,directive,setoption)
-  for i,j in varnames.iteritems():
+  for i,j in varnames.items():
    if '%' not in directive:
     key = "PARSE_%s_%s%s"%(directive,setoption,sanitize(i))
-    if (key in includeKeys) and (includeKeys[key]!=j): print "Repetition of key %s"%key
+    if (key in includeKeys) and (includeKeys[key]!=j): print("Repetition of key %s"%key)
     includeKeys[key] = j
     f_h.write("#define %s %d\n"%(key,j)) # Write #defines to convert variable names into slot numbers
 
diff --git a/doc/Makefile b/doc/Makefile
index 1bed0a4..f279f0d 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -29,7 +29,7 @@ EX_FRAGDIR = $(FRAGDIR)/tex
 FIGFILES   = $(wildcard $(EXAMPLEDIR)/*.ppl)
 FRAGFILES  = $(wildcard $(FRAGDIR)/*.ppl)
 SOURCES    = $(wildcard *.tex)
-PYTHON     = python
+PYTHON     = python3
 
 all: $(EX_EPSDIR)/timestamp $(EX_TEXDIR)/timestamp $(EX_FRAGDIR)/timestamp \
      pyxplot-plain.ps pyxplot-plain.pdf pyxplot.pdf
diff --git a/doc/makeFigureEps.py b/doc/makeFigureEps.py
index 1039ead..45dc592 100644
--- a/doc/makeFigureEps.py
+++ b/doc/makeFigureEps.py
@@ -37,7 +37,7 @@ else      : files = glob.glob("examples/ex_*.ppl")
 files.sort()
 
 for fname in files:
-  print "Working on example <%s>..."%os.path.split(fname)[1]
+  print("Working on example <%s>..."%os.path.split(fname)[1])
   status = os.system("%s %s"%(pyxplot,fname))
   if (status): raise RuntimeError("pyxplot failed")
 
@@ -46,7 +46,7 @@ if not testing:
   files = glob.glob("examples/eps/*.eps")
   files.sort()
   for eps in files:
-    print "Converting example <%s> to pdf..."%os.path.split(eps)[1]
+    print("Converting example <%s> to pdf..."%os.path.split(eps)[1])
     pdf = re.sub(r"\.eps",".pdf",eps)
     #png = re.sub(r"\.eps",".png",eps)
     os.system("gs -dQUIET -dSAFER -P- -dBATCH -dNOPAUSE -dEPSCrop -sDEVICE=pdfwrite -sOutputFile=%s %s"%(pdf,eps))
diff --git a/doc/makeFigureTex.py b/doc/makeFigureTex.py
index f31b55a..3c0328d 100644
--- a/doc/makeFigureTex.py
+++ b/doc/makeFigureTex.py
@@ -79,7 +79,7 @@ def makeTeX(fname, counter, linelist):
 files = glob.glob("examples/ex_*.ppl")
 files.sort()
 for fname in files:
-  print "Converting example to latex <%s>..."%os.path.split(fname)[1]
+  print("Converting example to latex <%s>..."%os.path.split(fname)[1])
   buffer    = []
   buffering = False
   counter   = 1
diff --git a/doc/makeFragmentTex.py b/doc/makeFragmentTex.py
index a4e49b9..2e0cf3a 100644
--- a/doc/makeFragmentTex.py
+++ b/doc/makeFragmentTex.py
@@ -53,7 +53,7 @@ def line_texify(line,userInput):
 files = glob.glob("fragments/*.ppl")
 files.sort()
 for fname in files:
-  print "Converting fragment to latex <%s>..."%os.path.split(fname)[1]
+  print("Converting fragment to latex <%s>..."%os.path.split(fname)[1])
   out       = os.path.join("fragments","tex",os.path.split(fname)[1][:-4]+".tex")
   linecount = 0
   lines     = open(fname).readlines()
@@ -69,7 +69,7 @@ for fname in files:
       prompt = "......."
       continue
     prompt = "pyxplot"
-    sp = subprocess.Popen([pyxplot], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+    sp = subprocess.Popen([pyxplot], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='UTF-8')
     o  = sp.communicate(input="\n".join([ ll.strip() for ll in lines[0:i+1]])) # returns (stdout,stderr)
     if (len(o[1])>0): raise RuntimeError("pyxplot failed: %s"%o[1])
     olines = o[0].strip().split('\n')