eric5-api.py

branch
5_1_x
changeset 1344
54c50e65173f
parent 791
9ec2ac20e54e
child 1510
e75ecf2bd9dd
diff -r 142ad6decc3a -r 54c50e65173f eric5-api.py
--- a/eric5-api.py	Mon Sep 26 18:08:38 2011 +0200
+++ b/eric5-api.py	Sat Oct 01 17:14:40 2011 +0200
@@ -168,6 +168,7 @@
     for progLanguage in sorted(progLanguages):
         basename = ""
         apis = []
+        basesDict = {}
 
         supportedExtensions = \
             DocumentationTools.supportedExtensionsDictForApis[progLanguage]
@@ -180,6 +181,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):
@@ -240,6 +242,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
@@ -250,6 +253,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)
@@ -262,6 +268,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