/[papo]/papo/tools/py2dot/py2dot.py
ViewVC logotype

Diff of /papo/tools/py2dot/py2dot.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by apronotti, Thu Jul 25 19:33:49 2002 UTC revision 1.2 by apronotti, Mon Sep 16 22:24:18 2002 UTC
# Line 5  import os.path Line 5  import os.path
5  import sys  import sys
6  import re  import re
7    
 if len(sys.argv) == 3:  
     path = sys.argv[1]  
     outFile = sys.argv[2]  
 elif len(sys.argv) == 2:  
     if sys.argv[1] == '--help' or sys.argv[1] == '-h':  
         print ""  
         print "      uso: py2dot.py [directorio-a-procesar[archivo-destino]] "  
         print "      ejemplo: py2dot /dir test.dot"  
         print ""  
         sys.exit(0)  
     path = sys.argv[1]  
     outFile = 'outfile.dot'  
 else:  
     path = './'  
     outFile = 'outfile.dot'  
   
   
 initialDir =  os.path.abspath(os.curdir)  
8  def surfDirs(path):  def surfDirs(path):
9      if not path.endswith('/'): path = path + '/'      if not path.endswith('/'): path = path + '/'
10      dirs = os.listdir(path)      dirs = os.listdir(path)
# Line 31  def surfDirs(path): Line 13  def surfDirs(path):
13              os.chdir(path+iterFile)              os.chdir(path+iterFile)
14              surfDirs(path+iterFile)              surfDirs(path+iterFile)
15    
16          
17          if iterFile.endswith('.py'):          if iterFile.endswith('.py'):
18              file = open(path+iterFile)              file = open(path+iterFile)
19              line = file.readline()              line = file.readline()
# Line 60  def surfDirs(path): Line 43  def surfDirs(path):
43                  line = file.readline()                  line = file.readline()
44              file.close()              file.close()
45    
46    
47    
48    # Main program
49    
50    if len(sys.argv) == 3:
51        path = sys.argv[1]
52        outFile = sys.argv[2]
53    elif len(sys.argv) == 2:
54        if sys.argv[1] == '--help' or sys.argv[1] == '-h':
55            print ""
56            print "      uso: py2dot.py [directorio-a-procesar[archivo-destino]] "
57            print "      ejemplo: py2dot /dir test.dot"
58            print ""
59            sys.exit(0)
60        if sys.argv[1].startswith('./'):
61            path = os.path.abspath(os.curdir) + sys.argv[1][1:]
62        else:
63            path = sys.argv[1]
64        outFile = 'outfile.dot'
65    else:
66        path = os.path.abspath(os.curdir)
67        outFile = 'outfile.dot'
68    
69    
70    initialDir = os.path.abspath(os.curdir)
71    
72    
73  classes = {}  classes = {}
74  surfDirs(path)  surfDirs(path)
75    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26