Author: Michael R. Crusoe <crusoe@debian.org>
Description: python3 conversion
--- seqan2.orig/manual/source/Infrastructure/Manage/WriteAppTests.rst
+++ seqan2/manual/source/Infrastructure/Manage/WriteAppTests.rst
@@ -173,7 +173,7 @@
 
 .. code-block:: python
 
-   #!/usr/bin/env python2
+   #!/usr/bin/env python3
    """Execute the tests for upcase.
 
    The golden test outputs are generated by the script generate_outputs.sh.
--- seqan2.orig/util/py_lib/seqan/fixgcov/app.py
+++ seqan2/util/py_lib/seqan/fixgcov/app.py
@@ -16,7 +16,7 @@
 License:   3-clause BSD (see LICENSE)
 """
 
-from __future__ import with_statement
+
 
 __author__ = 'Manuel Holtgrewe <manuel.holtgrewe@fu-berlin.de>'
 
@@ -97,7 +97,7 @@
         if not _hasFileLocation(node):
             return False
         # Try to hit cache.
-        if self.cache.has_key(node.location.file.name):
+        if node.location.file.name in self.cache:
             return self.cache[node.location.file.name]
         # Check whether node's location is below the include directories.  It is
         # only visited if this is the case.
@@ -137,7 +137,7 @@
         # print args
         tu = index.parse(filename, args=args)
         if self.options.verbosity >= 1:
-            print 'Translation unit: %s.' % tu.spelling
+            print('Translation unit: %s.' % tu.spelling)
         return self._recurse(tu.cursor)
 
     @classmethod
@@ -207,17 +207,17 @@
         # lines with compound statements in all included files are written to
         # the location file.
         if options.verbosity >= 1:
-            print >>sys.stderr, 'Building Locations'
+            print('Building Locations', file=sys.stderr)
         if options.verbosity >= 2:
-            print >>sys.stderr, '=================='
+            print('==================', file=sys.stderr)
 
         # Fire off AST traversal.
         if options.verbosity >= 1:
-            print >>sys.stderr, 'AST Traversal'
+            print('AST Traversal', file=sys.stderr)
         node_visitor = CollectCompoundStatementNodeVisitor(options)
         for src in options.source_files:
             if options.verbosity >= 2:
-                print >>sys.stderr, '  Compilation Unit', src
+                print('  Compilation Unit', src, file=sys.stderr)
             AstTraverser.visitFile(src, node_visitor, options)
 
         # Convert locations into points.
@@ -229,7 +229,7 @@
 
         # Write out the source locations.
         if options.verbosity >= 1:
-            print >>sys.stderr, 'Writing out locations to', options.location_file
+            print('Writing out locations to', options.location_file, file=sys.stderr)
         with open(options.location_file, 'wb') as f:
             pickle.dump(locations, f)
 
@@ -240,20 +240,20 @@
     if options.gcov_files:
         # If no source files and gcov files are given then
         if options.verbosity >= 1:
-            print >>sys.stderr, 'Updating gcov Results'
+            print('Updating gcov Results', file=sys.stderr)
         if options.verbosity >= 2:
-            print >>sys.stderr, '====================='
+            print('=====================', file=sys.stderr)
 
         if not options.source_files:
             if options.verbosity >= 1:
-                print >>sys.stderr, 'Loading locations from', options.location_file
+                print('Loading locations from', options.location_file, file=sys.stderr)
             with open(options.location_file, 'rb') as f:
                 locations = pickle.load(f)
 
         for filename in options.gcov_files:
             filename = os.path.abspath(filename)
             if options.verbosity >= 2:
-                print >>sys.stderr, 'Processing', filename
+                print('Processing', filename, file=sys.stderr)
             with open(filename, 'rb') as f:
                 lines = f.readlines()
             pos0 = lines[0].find(':')
@@ -268,9 +268,9 @@
                 txt = line[pos1 + 1:]
                 if txt.startswith('Source:'):
                     source = os.path.abspath(txt[len('Source:'):].strip())
-                    if not locations.has_key(source):
+                    if source not in locations:
                         if options.verbosity >= 2:
-                            print >>sys.stderr, '  Skipping.'
+                            print('  Skipping.', file=sys.stderr)
                         skip = True
                         break
                 if not source or lineno == 0:
--- seqan2.orig/util/py_lib/seqan/pyclangcheck/app.py
+++ seqan2/util/py_lib/seqan/pyclangcheck/app.py
@@ -7,7 +7,7 @@
 License:   3-clause BSD (see LICENSE)
 """
 
-from __future__ import with_statement
+
 
 __author__ = 'Manuel Holtgrewe <manuel.holtgrewe@fu-berlin.de>'
 
@@ -19,9 +19,9 @@
 
 import clang.cindex as ci
 
-import simple_checks
-import violations
-import rules
+from . import simple_checks
+from . import violations
+from . import rules
 
 def _hasFileLocation(node):
     """Return True if node has a file lcoation."""
@@ -51,7 +51,7 @@
         self.cache = {}
 
     def get(self, path):
-        if self.cache.has_key(path):
+        if path in self.cache:
             return self.cache[path]
         with open(path, 'rb') as f:
             fcontents = f.readlines()
@@ -106,7 +106,7 @@
                     txt = '<multiline>'
                 else:
                     txt = ''.join(lines).replace('\n', '\\n')
-                print '  ' * len(self.stack), 'Entering', node.kind, node._kind_id, node.spelling, 'txt="%s"' % txt, "%s-%s" % (start, end)
+                print('  ' * len(self.stack), 'Entering', node.kind, node._kind_id, node.spelling, 'txt="%s"' % txt, "%s-%s" % (start, end))
         violations = []
         for rule in self.rules:
             if rule.allowVisit(node):
@@ -155,7 +155,7 @@
         if not _hasFileLocation(node):
             return False
         # Try to hit cache.
-        if self.cache.has_key(node.location.file.name):
+        if node.location.file.name in self.cache:
             return self.cache[node.location.file.name]
         # Check whether the file is blocked.
         if node.location.file.name in self.blocked_files:
@@ -291,7 +291,7 @@
         res = AstTraverser.visitFile(filename, node_visitor, options)
         node_visitor.seenToBlocked()
         elapsed = datetime.datetime.now() - start
-        print >>sys.stderr, '  took', elapsed.seconds, 's'
+        print('  took', elapsed.seconds, 's', file=sys.stderr)
         if res:
             break
 
@@ -310,7 +310,7 @@
     # Print violations.
     # ========================================================================
 
-    print 'VIOLATIONS'
+    print('VIOLATIONS')
     vs.update(node_visitor.violations)
     printer = violations.ViolationPrinter(options.ignore_nolint,
                                           options.show_source)
--- seqan2.orig/util/py_lib/seqan/pyclangcheck/rules.py
+++ seqan2/util/py_lib/seqan/pyclangcheck/rules.py
@@ -7,8 +7,8 @@
 
 import clang.cindex as ci
 
-import app
-import violations
+from . import app
+from . import violations
 
 RULE_NAMING_CONSTANT = 'naming.constant'
 RULE_NAMING_STRUCT = 'naming.struct'
@@ -173,7 +173,7 @@
             return True
         if not app._hasFileLocation(node):
             return False
-        if self.cache.has_key(node.location.file.name):
+        if node.location.file.name in self.cache:
             return self.cache[node.location.file.name]
         # Check whether node's location is below the include directories or one
         # of the source files.
--- seqan2.orig/util/py_lib/seqan/pyclangcheck/simple_checks.py
+++ seqan2/util/py_lib/seqan/pyclangcheck/simple_checks.py
@@ -98,7 +98,7 @@
                 match = re.match(RE_TODO, comment)
                 if match:
                     if len(match.group(1)) > 1:
-                        print comment
+                        print(comment)
                         v = violations.SimpleRuleViolation(
                             RULE_TODO_ONE_SPACE, filename, cstart.line,
                             cstart.column, RULE_TEXT_TODO_ONE_SPACE)
--- seqan2.orig/util/py_lib/seqan/pyclangcheck/violations.py
+++ seqan2/util/py_lib/seqan/pyclangcheck/violations.py
@@ -54,7 +54,7 @@
     def hasNolint(self, filename, lineno):
         filename = os.path.abspath(filename)
         # Ensure that the nolint lines are registered in self.locations[filename].
-        if not self.locations.has_key(filename):
+        if filename not in self.locations:
             line_set = set()
             with open(filename, 'rb') as f:
                 line_no = 0
@@ -80,12 +80,12 @@
         for k in sorted(vs.keys()):
             violation = vs[k]
             if self.ignore_nolint or not self.nolints.hasNolint(violation.file, violation.line):
-                print violation
+                print(violation)
                 line = self.file_cache.get(violation.file)[violation.line - 1]
                 if self.show_source:
-                    print line.rstrip()
-                    print '%s^' % (' ' * (violation.column - 1))
-                    print
+                    print(line.rstrip())
+                    print('%s^' % (' ' * (violation.column - 1)))
+                    print()
             previous = violation
-        print 'Total: %d violations' % len(vs)
+        print('Total: %d violations' % len(vs))
 
--- seqan2.orig/dox/run.sh.in
+++ seqan2/dox/run.sh.in
@@ -1,3 +1,3 @@
 #!/bin/bash
 # Run doxygen-style documentation system.
-rm -f dddoc_cache.bin && python2 ../util/bin/dox.py -ldd ../ -ldd ../extras -ldd ../docs2/concepts -ldd ../docs2/pages --debug -b ../
+rm -f dddoc_cache.bin && python3 ../util/bin/dox.py -ldd ../ -ldd ../extras -ldd ../docs2/concepts -ldd ../docs2/pages --debug -b ../
