Fri, 23 Aug 2019 20:08:33 +0200
eric6_api: added the -i switch to ignore the existence of builtin modules when creating API files.
--- a/docs/changelog Fri Aug 23 17:14:44 2019 +0200 +++ b/docs/changelog Fri Aug 23 20:08:33 2019 +0200 @@ -11,6 +11,9 @@ - API Files: -- added API files for BBC micro:bit MicroPython and updated the PyQt5 API files +- API Generator: + -- added the -i switch to ignore the existence of builtin modules when + creating API files Version 19.8: - bug fixes
--- a/eric6/APIs/Python3/eric6.api Fri Aug 23 17:14:44 2019 +0200 +++ b/eric6/APIs/Python3/eric6.api Fri Aug 23 20:08:33 2019 +0200 @@ -10679,7 +10679,7 @@ eric6.Utilities.ModuleParser._rb_getnext?8 eric6.Utilities.ModuleParser.find_module?4(name, path, extensions) eric6.Utilities.ModuleParser.getTypeFromTypeName?4(name) -eric6.Utilities.ModuleParser.readModule?4(module, path=None, inpackage=False, basename="", extensions=None, caching=True) +eric6.Utilities.ModuleParser.readModule?4(module, path=None, inpackage=False, basename="", extensions=None, caching=True, ignoreBuiltinModules=False) eric6.Utilities.ModuleParser.resetParsedModule?4(module, basename="") eric6.Utilities.ModuleParser.resetParsedModules?4() eric6.Utilities.MouseUtilities.MouseButtonModifier2String?4(modifiers, button)
--- a/eric6/Documentation/Source/eric6.Utilities.ModuleParser.html Fri Aug 23 17:14:44 2019 +0200 +++ b/eric6/Documentation/Source/eric6.Utilities.ModuleParser.html Fri Aug 23 20:08:33 2019 +0200 @@ -899,7 +899,7 @@ <hr /><hr /> <a NAME="readModule" ID="readModule"></a> <h2>readModule</h2> -<b>readModule</b>(<i>module, path=None, inpackage=False, basename="", extensions=None, caching=True</i>) +<b>readModule</b>(<i>module, path=None, inpackage=False, basename="", extensions=None, caching=True, ignoreBuiltinModules=False</i>) <p> Function to read a module file and parse it. </p><p> @@ -929,6 +929,10 @@ <dd> flag indicating that the parsed module should be cached (boolean) +</dd><dt><i>ignoreBuiltinModules</i></dt> +<dd> +flag indicating to ignore the builtin modules + (boolean) </dd> </dl><dl> <dt>Returns:</dt>
--- a/eric6/Utilities/ModuleParser.py Fri Aug 23 17:14:44 2019 +0200 +++ b/eric6/Utilities/ModuleParser.py Fri Aug 23 20:08:33 2019 +0200 @@ -1468,7 +1468,7 @@ def readModule(module, path=None, inpackage=False, basename="", - extensions=None, caching=True): + extensions=None, caching=True, ignoreBuiltinModules=False): """ Function to read a module file and parse it. @@ -1486,6 +1486,8 @@ source file extensions (list of strings) @param caching flag indicating that the parsed module should be cached (boolean) + @param ignoreBuiltinModules flag indicating to ignore the builtin modules + (boolean) @return reference to a Module object containing the parsed module information (Module) """ @@ -1529,7 +1531,7 @@ # we've seen this module before... return _modules[modname] - if module in sys.builtin_module_names: + if not ignoreBuiltinModules and module in sys.builtin_module_names: # this is a built-in module mod = Module(modname, None, None) if caching:
--- a/eric6/eric6_api.py Fri Aug 23 17:14:44 2019 +0200 +++ b/eric6/eric6_api.py Fri Aug 23 20:08:33 2019 +0200 @@ -71,6 +71,8 @@ print(" This option may be repeated multiple times.") print(" -h or --help") print(" Show this help and exit.") + print(" -i or --ignore") + print(" Ignore the set of builtin modules") print(" -l language or --language=language") print(" Generate an API file for the given programming language.") print(" Supported programming languages are:") @@ -128,9 +130,9 @@ try: opts, args = getopt.getopt( - sys.argv[1:], "b:e:hl:o:pRrt:Vx:", + sys.argv[1:], "b:e:hil:o:pRrt:Vx:", ["base=", "eol=", "exclude=", "exclude-file=", "extension=", - "help", "language=", "output=", "private", "recursive", + "help", "ignore", "language=", "output=", "private", "recursive", "version", ]) except getopt.error: usage() @@ -145,6 +147,7 @@ progLanguages = [] extensions = [] newline = None + ignoreBuiltinModules = False for k, v in opts: if k in ["-o", "--output"]: @@ -157,6 +160,8 @@ excludePatterns.append(v) elif k in ["-h", "--help"]: usage() + elif k in ["-i", "--ignore"]: + ignoreBuiltinModules = True elif k in ["-V", "--version"]: version() elif k in ["-t", "--extension"]: @@ -272,7 +277,8 @@ try: module = Utilities.ModuleParser.readModule( file, - basename=basename, inpackage=inpackage) + basename=basename, inpackage=inpackage, + ignoreBuiltinModules=ignoreBuiltinModules) apiGenerator = APIGenerator(module) api = apiGenerator.genAPI(True, basePackage, includePrivate)