diff options
-rwxr-xr-x | macro.py | 4 | ||||
-rwxr-xr-x | macro2m4.py | 6 |
2 files changed, 5 insertions, 5 deletions
@@ -1,6 +1,6 @@ #! /usr/bin/env python -from __future__ import with_statement + from contextlib import closing import re import os.path as path @@ -70,7 +70,7 @@ class Macro: # drop initial header (if present) header = re.sub(r"^\n*# =+\n#[^\n]*\n# =+\n(#\n)+", '', header, 1) # split buffer into lines and drop initial "# " prefix in the process - header = map(lambda l: l[2:], header.split('\n')) + header = [l[2:] for l in header.split('\n')] # set defaults self.authors = [] # parse each section in the remaining list diff --git a/macro2m4.py b/macro2m4.py index c1709ba..bcd27d6 100755 --- a/macro2m4.py +++ b/macro2m4.py @@ -54,12 +54,12 @@ m = Macro(m4File) for i in range(len(m.description)): para = m.description[i] if para[0][0].isspace(): - spaces = min(map(countSpaces, para)) + spaces = min(list(map(countSpaces, para))) if spaces > 1: - m.description[i] = map(lambda l: ' ' + l[spaces:], para) + m.description[i] = [' ' + l[spaces:] for l in para] url = "http://www.gnu.org/software/autoconf-archive/%s.html" % m.name lineLen = max(len(url) + 2, 75) -m.url = "# %s\n# %s\n# %s" % ('=' * lineLen, (' ' * ((lineLen - len(url)) / 2)) + url, '=' * lineLen) +m.url = "# %s\n# %s\n# %s" % ('=' * lineLen, (' ' * int((lineLen - len(url)) / 2)) + url, '=' * lineLen) if m.__dict__.get("obsolete"): m.obsolete = "# OBSOLETE MACRO\n#\n" + '\n'.join(map(formatParagraph, m.obsolete)) + "\n#\n" else: |