[gtk-doc] depscan: python 2/3 compat
- From: Stefan Sauer <stefkost src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-doc] depscan: python 2/3 compat
- Date: Fri, 2 Jun 2017 06:55:01 +0000 (UTC)
commit 9863738f1573ab64d765c9f4ce668d2068d9e045
Author: Stefan Sauer <ensonic users sf net>
Date: Fri Jun 2 08:42:31 2017 +0200
depscan: python 2/3 compat
gtkdoc-depscan.in | 22 ++++++++++++----------
1 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/gtkdoc-depscan.in b/gtkdoc-depscan.in
index accc7d0..9bfaf30 100644
--- a/gtkdoc-depscan.in
+++ b/gtkdoc-depscan.in
@@ -1,5 +1,7 @@
#!@PYTHON@
+from __future__ import print_function
+
import gzip, os.path, re
from os import environ, popen, walk
@@ -40,7 +42,7 @@ class Book(object):
break
if not self.__catalog:
- raise IOError, 'No devhelp book found for "%s"' % name
+ raise IOError('No devhelp book found for "%s"' % name)
def __cmp__(self, other):
if isinstance(other, Book):
@@ -285,7 +287,7 @@ def summarize_matches(matches):
for filename, lineno, symbol in matches:
if not isinstance(symbol, Symbol):
if options.verbose:
- print '%s:%d: unknown symbol %s' % (filename, lineno, symbol)
+ print('%s:%d: unknown symbol %s' % (filename, lineno, symbol))
continue
since = '%s-%s' % (symbol.book.name, symbol.since)
@@ -308,7 +310,7 @@ if '__main__' == __name__:
options.books = default_books
def trace(message, *args):
- if options.verbose: print message % args
+ if options.verbose: print(message % args)
def parse_book(name):
try:
@@ -319,7 +321,7 @@ if '__main__' == __name__:
version = version and Symbol.VersionInfo(version)
return name, Book(name, options.dirs, version)
- except IOError, e:
+ except IOError as e:
print >>stderr, 'WARNING: %s.' % e
def scan_source_file(name):
@@ -328,7 +330,7 @@ if '__main__' == __name__:
try:
contents = __comment_regex.sub('', file(name).read())
- except IOError, e:
+ except IOError as e:
print >>stderr, e
if contents:
@@ -380,23 +382,23 @@ if '__main__' == __name__:
if options.summarize:
summary = summarize_matches(matches)
for since in sorted(summary.keys()):
- print '%s required for' % since
+ print('%s required for' % since)
for x in summary[since]:
- print ' %u %s' % (x[1], x[0])
+ print(' %u %s' % (x[1], x[0]))
else:
for filename, lineno, symbol in matches:
if isinstance(symbol, Symbol):
args = filename, lineno, symbol.book.name, symbol.since, symbol.name
- print '%s:%d: %s-%s required for %s' % args
+ print('%s:%d: %s-%s required for %s' % args)
elif options.verbose:
- print '%s:%d: unknown symbol %s' % (filename, lineno, symbol)
+ print('%s:%d: unknown symbol %s' % (filename, lineno, symbol))
if options.unknown:
unknown = [m[2].split('_')[0].lower() for m in unknown_symbols]
unknown = list(set(unknown))
unknown.sort()
- print 'unknown prefixes: %s' % ', '.join(unknown)
+ print('unknown prefixes: %s' % ', '.join(unknown))
raise SystemExit(matches and 1 or 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]