[Python-checkins] distutils2: more pytree.Base.next_sibling() lib2to3 compatibility fixes
tarek.ziade
python-checkins at python.org
Sun May 30 00:05:49 CEST 2010
tarek.ziade pushed 21e3531cc3ed to distutils2:
http://hg.python.org/distutils2/rev/21e3531cc3ed
changeset: 164:21e3531cc3ed
user: Nicolas Cadou <ncadou at cadou.ca>
date: Sat May 22 20:32:21 2010 -0400
summary: more pytree.Base.next_sibling() lib2to3 compatibility fixes
files: src/distutils2/converter/fixers/fix_imports.py, src/distutils2/converter/fixers/fix_setup_options.py
diff --git a/src/distutils2/converter/fixers/fix_imports.py b/src/distutils2/converter/fixers/fix_imports.py
--- a/src/distutils2/converter/fixers/fix_imports.py
+++ b/src/distutils2/converter/fixers/fix_imports.py
@@ -21,7 +21,7 @@
return
if not hasattr(imp, "next_sibling"):
- imp.next_sibling = imp.get_next_sibling
+ imp.next_sibling = imp.get_next_sibling()
while not hasattr(imp, 'value'):
imp = imp.children[0]
@@ -37,6 +37,8 @@
next = imp.next_sibling
while next is not None:
pattern.append(next.value)
+ if not hasattr(next, "next_sibling"):
+ next.next_sibling = next.get_next_sibling()
next = next.next_sibling
if pattern == ['import', 'setup']:
imp.value = 'distutils2.core'
diff --git a/src/distutils2/converter/fixers/fix_setup_options.py b/src/distutils2/converter/fixers/fix_setup_options.py
--- a/src/distutils2/converter/fixers/fix_setup_options.py
+++ b/src/distutils2/converter/fixers/fix_setup_options.py
@@ -52,6 +52,8 @@
if name.value in _OLD_NAMES:
name.value = _OLD_NAMES[name.value]
if name.value in _SEQUENCE_NAMES:
+ if not hasattr(sibling, "next_sibling"):
+ sibling.next_sibling = sibling.get_next_sibling()
right_operand = sibling.next_sibling
# replacing string -> list[string]
if right_operand.type == token.STRING:
--
Repository URL: http://hg.python.org/distutils2
More information about the Python-checkins
mailing list