[Checkins] SVN: Sandbox/janwijbrand/importchecker/src/importchecker/importchecker.py Small change to make the importchecker work with python 2.5,

Jan-Wijbrand Kolman janwijbrand at gmail.com
Tue May 6 06:30:27 EDT 2008


Log message for revision 86497:
  Small change to make the importchecker work with python 2.5,

Changed:
  U   Sandbox/janwijbrand/importchecker/src/importchecker/importchecker.py

-=-
Modified: Sandbox/janwijbrand/importchecker/src/importchecker/importchecker.py
===================================================================
--- Sandbox/janwijbrand/importchecker/src/importchecker/importchecker.py	2008-05-06 10:28:10 UTC (rev 86496)
+++ Sandbox/janwijbrand/importchecker/src/importchecker/importchecker.py	2008-05-06 10:30:26 UTC (rev 86497)
@@ -75,7 +75,9 @@
     def visitFrom(self, stmt):
         """Will be called for 'from foo import bar' statements
         """
-        module_name, names = stmt.asList()
+        # XXX take first two items of statement list as in Python 2.5 this
+        # list contains more information items.
+        module_name, names = stmt.asList()[:2]
         if module_name == '__future__':
             # we don't care what's imported from the future
             return
@@ -289,9 +291,9 @@
         return result
 
 
-def main():
+def main(path=None):
     try:
-        path = sys.argv[1]
+        path = path or sys.argv[1]
     except IndexError:
         print "No path supplied"
         sys.exit(1)
@@ -325,4 +327,3 @@
 
 if __name__ == '__main__':
     main()
-



More information about the Checkins mailing list