eric5_api.py

changeset 1342
30226d5a7ffb
parent 945
8cd4d08fa9f6
child 1509
c0b5e693b0eb
--- a/eric5_api.py	Tue Sep 27 19:03:52 2011 +0200
+++ b/eric5_api.py	Fri Sep 30 19:08:38 2011 +0200
@@ -171,6 +171,7 @@
     for progLanguage in sorted(progLanguages):
         basename = ""
         apis = []
+        basesDict = {}
 
         supportedExtensions = \
             DocumentationTools.supportedExtensionsDictForApis[progLanguage]
@@ -183,6 +184,7 @@
             else:
                 root, ext = os.path.splitext(outputFileName)
                 outputFile = "{0}-{1}{2}".format(root, progLanguage.lower(), ext)
+        basesFile = os.path.splitext(outputFile)[0] + '.bas'
         
         for arg in args:
             if os.path.isdir(arg):
@@ -243,6 +245,7 @@
                             basename=basename, inpackage=inpackage)
                         apiGenerator = APIGenerator(module)
                         api = apiGenerator.genAPI(True, basePackage, includePrivate)
+                        bases = apiGenerator.genBases(includePrivate)
                     except IOError as v:
                         sys.stderr.write("{0} error: {1}\n".format(file, v[1]))
                         continue
@@ -253,6 +256,9 @@
                     for apiEntry in api:
                         if not apiEntry in apis:
                             apis.append(apiEntry)
+                    for basesEntry in bases:
+                        if bases[basesEntry]:
+                            basesDict[basesEntry] = bases[basesEntry][:]
                     sys.stdout.write("-- {0} -- {1} ok\n".format(progLanguage, file))
 
         outdir = os.path.dirname(outputFile)
@@ -265,6 +271,15 @@
         except IOError as v:
             sys.stderr.write("{0} error: {1}\n".format(outputFile, v[1]))
             sys.exit(3)
+        try:
+            out = open(basesFile, "w", encoding="utf-8", newline=newline)
+            for baseEntry in sorted(basesDict.keys()):
+                out.write("{0} {1}\n".format(
+                    baseEntry, " ".join(sorted(basesDict[baseEntry]))))
+            out.close()
+        except IOError as v:
+            sys.stderr.write("{0} error: {1}\n".format(basesFile, v[1]))
+            sys.exit(3)
     
     sys.stdout.write('\nDone.\n')
     sys.exit(0)

eric ide

mercurial