~mortenoh/+junk/dhis2-detailed-import-export

« back to all changes in this revision

Viewing changes to gis/dhis-gis-geostat/mfbase/openlayers/tools/oldot.py

  • Committer: larshelge at gmail
  • Date: 2009-03-03 16:46:36 UTC
  • Revision ID: larshelge@gmail.com-20090303164636-2sjlrquo7ib1gf7r
Initial check-in

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import re
 
2
import os    
 
3
def run():
 
4
    sourceDirectory = "../lib/OpenLayers"    
 
5
    allFiles = []
 
6
    SUFFIX_JAVASCRIPT = ".js"
 
7
    ## Find all the Javascript source files
 
8
    for root, dirs, files in os.walk(sourceDirectory):
 
9
        for filename in files:
 
10
            if filename.endswith(SUFFIX_JAVASCRIPT) and not filename.startswith("."):
 
11
                filepath = os.path.join(root, filename)[len(sourceDirectory)+1:]
 
12
                filepath = filepath.replace("\\", "/")
 
13
                data = open(os.path.join(sourceDirectory, filepath)).read()
 
14
                parents = re.search("OpenLayers.Class\((.*?){", data, 
 
15
                      re.DOTALL)
 
16
                if parents:
 
17
                    parents = [x.strip() for x in parents.group(1).strip().strip(",").split(",")]
 
18
                else: 
 
19
                    parents = []
 
20
                cls = "OpenLayers.%s" % filepath.strip(".js").replace("/", ".")
 
21
                allFiles.append([cls, parents])
 
22
    return allFiles
 
23
print """
 
24
digraph name {
 
25
  fontname = "Helvetica"
 
26
  fontsize = 8
 
27
  K = 0.6
 
28
 
 
29
  node [
 
30
    fontname = "Helvetica"
 
31
    fontsize = 8
 
32
    shape = "plaintext"
 
33
  ]
 
34
"""
 
35
 
 
36
for i in run():
 
37
    print i[0].replace(".", "_")
 
38
    for item in i[1]:
 
39
        if not item: continue
 
40
        print "%s -> %s" % (i[0].replace(".","_"), item.replace(".", "_"))
 
41
    print "; "
 
42
 
 
43
print """}"""