Package: yapps2
Version: 2.2.1-3
Severity: normal
Tags: patch pending

Dear maintainer,

I've prepared an NMU for yapps2 (versioned as 2.2.1-3.1) and uploaded it
to DELAYED/10.  Please feel free to tell me if I should delay it longer.

Regards,

-- 
Colin Watson                                       [[email protected]]
diff -u yapps2-2.2.1/debian/changelog yapps2-2.2.1/debian/changelog
--- yapps2-2.2.1/debian/changelog
+++ yapps2-2.2.1/debian/changelog
@@ -1,3 +1,14 @@
+yapps2 (2.2.1-3.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Drop Python 2 support (closes: #938864).
+  * Write __future__ import before preparser (closes: #911730).
+  * Convert Scanner.print_line_with_pointer to Python 3 print syntax
+    (closes: #911753).
+  * Port documentation and examples to Python 3 (closes: #911752).
+
+ -- Colin Watson <[email protected]>  Mon, 23 Dec 2019 22:05:40 +0000
+
 yapps2 (2.2.1-3) unstable; urgency=medium
 
   * yapps2 depends on python3-pkg-resources for the entry point wrapper
diff -u yapps2-2.2.1/debian/control yapps2-2.2.1/debian/control
--- yapps2-2.2.1/debian/control
+++ yapps2-2.2.1/debian/control
@@ -3,15 +3,15 @@
 Priority: optional
 Maintainer: Matthias Urlichs <[email protected]>
 Build-Depends: debhelper (>= 9~)
-Build-Depends-Indep: python-dev (>= 2.5.4-1~), python3-dev,
+Build-Depends-Indep: python3-dev,
   dh-python,
   hevea,
-  python-setuptools, python3-setuptools,
+  python3-setuptools,
 Standards-Version: 3.9.8
 
 Package: yapps2
 Architecture: all
-Depends: ${python:Depends}, python3-yapps (= ${binary:Version}), ${misc:Depends},
+Depends: ${python3:Depends}, python3-yapps (= ${binary:Version}), ${misc:Depends},
   python3-pkg-resources,
 Description: Yet Another Python Parser System
  YAPPS is an easy to use parser generator that is written in Python and
@@ -31,20 +31,6 @@
      - better error reporting
      - reads input incrementally
 
-Package: python-yapps
-Architecture: all
-Depends: ${python:Depends}, ${misc:Depends}
-Replaces: yapps2-runtime
-Conflicts: yapps2-runtime
-Description: Yet Another Python Parser System
- YAPPS is an easy to use parser generator that is written in Python and
- generates Python code.  There are several parser generator systems
- already available for Python, but this parser has different goals:
- Yapps is simple, very easy to use, and produces human-readable parsers.
- .
- This package contains the Python2 runtime support for parsers generated
- with yapps2.
-
 Package: python3-yapps
 Architecture: all
 Depends: ${python3:Depends}, ${misc:Depends}
reverted:
--- yapps2-2.2.1/debian/python-yapps.README
+++ yapps2-2.2.1.orig/debian/python-yapps.README
@@ -1,11 +0,0 @@
-The Debian Package python-yapps2
---------------------------------
-
-This package contains the new runtime Python code for the augmented
-yapps2 parser which is included in Debian.
-
-You need to depend on this package if you Debianize Python programs that
-contain a yapps2-built parser.
-
--- 
-Matthias Urlichs
reverted:
--- yapps2-2.2.1/debian/python-yapps2.dirs
+++ yapps2-2.2.1.orig/debian/python-yapps2.dirs
@@ -1 +0,0 @@
-usr/share/doc/python-yapps2
diff -u yapps2-2.2.1/debian/rules yapps2-2.2.1/debian/rules
--- yapps2-2.2.1/debian/rules
+++ yapps2-2.2.1/debian/rules
@@ -3,7 +3,7 @@
 export PYBUILD_NAME=yapps
 
 %:
-	dh $@ --with python2,python3 --buildsystem=pybuild
+	dh $@ --with python3 --buildsystem=pybuild
 
 override_dh_auto_build:
 	dh_auto_build
@@ -13,7 +13,6 @@
 override_dh_install:
 	mkdir -p debian/yapps2/usr/bin
 	mv debian/python3-yapps/usr/bin/yapps2 debian/yapps2/usr/bin
-	rm debian/python-yapps/usr/bin/yapps2
 	dh_install
 
 override_dh_auto_test:
diff -u yapps2-2.2.1/doc/yapps2.html yapps2-2.2.1/doc/yapps2.html
--- yapps2-2.2.1/doc/yapps2.html
+++ yapps2-2.2.1/doc/yapps2.html
@@ -554,7 +554,7 @@
 
 class MyX(Xparser.X):
     def printmsg(self):
-        print "Hello!"
+        print("Hello!")
 </pre>
 <!--TOC subsection id="sec15" Customizing Scanners-->
 <h3 id="sec15" class="subsection">4.2&#XA0;&#XA0;Customizing Scanners</h3><!--SEC END --><p>The generated parser class is not dependent on the generated scanner
@@ -645,7 +645,7 @@
       {{ start = self._scanner.pos }}
       a b c 
       {{ end = self._scanner.pos }}
-      {{ print 'Text is', self._scanner.input[start:end] }}
+      {{ print('Text is', self._scanner.input[start:end]) }}
 </pre>
 <!--TOC subsection id="sec20" Pre- and Post-Parser Code-->
 <h3 id="sec20" class="subsection">5.4&#XA0;&#XA0;Pre- and Post-Parser Code</h3><!--SEC END --><p>Sometimes the parser code needs to rely on helper variables,
only in patch2:
unchanged:
--- yapps2-2.2.1.orig/doc/yapps2.tex
+++ yapps2-2.2.1/doc/yapps2.tex
@@ -795,7 +795,7 @@
 
 class MyX(Xparser.X):
     def printmsg(self):
-        print "Hello!"
+        print("Hello!")
 \end{verbatim}
 
 \mysubsection{Customizing Scanners}
@@ -924,7 +924,7 @@
       {{ start = self._scanner.pos }}
       a b c 
       {{ end = self._scanner.pos }}
-      {{ print 'Text is', self._scanner.input[start:end] }}
+      {{ print('Text is', self._scanner.input[start:end]) }}
 \end{verbatim}
 
 \mysubsection{Pre- and Post-Parser Code}
only in patch2:
unchanged:
--- yapps2-2.2.1.orig/examples/calc.g
+++ yapps2-2.2.1/examples/calc.g
@@ -3,12 +3,12 @@
 def lookup(map, name):
     for x,v in map:  
         if x == name: return v
-    if not globalvars.has_key(name): print 'Undefined (defaulting to 0):', name
+    if name not in globalvars: print('Undefined (defaulting to 0):', name)
     return globalvars.get(name, 0)
 
 def stack_input(scanner,ign):
     """Grab more input"""
-    scanner.stack_input(raw_input(">?> "))
+    scanner.stack_input(input(">?> "))
 
 %%
 parser Calculator:
@@ -20,10 +20,10 @@
     token VAR: "[a-zA-Z_]+"
 
     # Each line can either be an expression or an assignment statement
-    rule goal:   expr<<[]>> END            {{ print '=', expr }}
+    rule goal:   expr<<[]>> END            {{ print('=', expr) }}
                                            {{ return expr }}
                | "set" VAR expr<<[]>> END  {{ globalvars[VAR] = expr }}
-                                           {{ print VAR, '=', expr }}
+                                           {{ print(VAR, '=', expr) }}
                                            {{ return expr }}
 
     # An expression is the sum and difference of factors
@@ -47,18 +47,18 @@
                  "in" expr<<V>>           {{ return expr }}
 %%
 if __name__=='__main__':
-    print 'Welcome to the calculator sample for Yapps 2.'
-    print '  Enter either "<expression>" or "set <var> <expression>",'
-    print '  or just press return to exit.  An expression can have'
-    print '  local variables:  let x = expr in expr'
+    print('Welcome to the calculator sample for Yapps 2.')
+    print('  Enter either "<expression>" or "set <var> <expression>",')
+    print('  or just press return to exit.  An expression can have')
+    print('  local variables:  let x = expr in expr')
     # We could have put this loop into the parser, by making the
     # `goal' rule use (expr | set var expr)*, but by putting the
     # loop into Python code, we can make it interactive (i.e., enter
     # one expression, get the result, enter another expression, etc.)
     while 1:
-        try: s = raw_input('>>> ')
+        try: s = input('>>> ')
         except EOFError: break
         if not s.strip(): break
         parse('goal', s)
-    print 'Bye.'
+    print('Bye.')
 
only in patch2:
unchanged:
--- yapps2-2.2.1.orig/examples/xml.g
+++ yapps2-2.2.1/examples/xml.g
@@ -54,13 +54,13 @@
              '<begin> middle </end>',
              '<begin> <nested attr=\'baz\' another="hey"> foo </nested> <nested> bar </nested> </begin>',
             ]
-    print
-    print '____Running tests_______________________________________'
+    print()
+    print('____Running tests_______________________________________')
     for test in tests:
-        print
+        print()
         try:
             parser = xml(xmlScanner(test))
             output = '%s ==> %s' % (repr(test), repr(parser.node()))
-        except (yappsrt.SyntaxError, AssertionError) as e:
+        except (runtime.SyntaxError, AssertionError) as e:
             output = '%s ==> FAILED ==> %s' % (repr(test), e)
-        print output
+        print(output)
only in patch2:
unchanged:
--- yapps2-2.2.1.orig/test.sh
+++ yapps2-2.2.1/test.sh
@@ -4,10 +4,10 @@
 trap 'echo ERROR' 0 
 
 export PYTHONPATH=$(pwd)
-for PY_G in python python3 ; do
+for PY_G in python3 ; do
 $PY_G ./yapps2 examples/expr.g examples/expr.py
 
-for PY_X in python python3 ; do
+for PY_X in python3 ; do
 test "$(echo "1+2*3+4" | $PY_X examples/expr.py goal)" = 11
 done
 
only in patch2:
unchanged:
--- yapps2-2.2.1.orig/yapps/parsetree.py
+++ yapps2-2.2.1/yapps/parsetree.py
@@ -270,9 +270,9 @@
 
     def generate_output(self):
         self.calculate()
+        self.write("from __future__ import print_function\n")
         self.write(self.preparser)
         self.write("# Begin -- grammar generated by Yapps\n")
-        self.write("from __future__ import print_function\n")
         self.write("import sys, re\n")
         self.write("from yapps import runtime\n")
         self.write("\n")
only in patch2:
unchanged:
--- yapps2-2.2.1.orig/yapps/runtime.py
+++ yapps2-2.2.1/yapps/runtime.py
@@ -175,7 +175,7 @@
         file,line,p = pos
         if file != self.filename:
             if self.stack: return self.stack.print_line_with_pointer(pos,length=length,out=out)
-            print >>out, "(%s: not in input buffer)" % file
+            print("(%s: not in input buffer)" % file, file=out)
             return
 
         text = self.input
@@ -198,7 +198,7 @@
                     break
                 spos = cr+1
         else:
-            print >>out, "(%s:%d not in input buffer)" % (file,origline)
+            print("(%s:%d not in input buffer)" % (file,origline), file=out)
             return
 
         # Now try printing part of the line
@@ -227,8 +227,8 @@
             p = p - 7
 
         # Now print the string, along with an indicator
-        print >>out, '> ',text
-        print >>out, '> ',' '*p + '^'
+        print('> ',text, file=out)
+        print('> ',' '*p + '^', file=out)
 
     def grab_input(self):
         """Get more input if possible."""
@@ -316,7 +316,7 @@
                     del self.tokens[0]
                 self.tokens.append(tok)
                 self.last_read_token = tok
-                # print repr(tok)
+                # print(repr(tok))
                 return tok
             else:
                 ignore = self.ignore[best_pat]

Reply via email to