def packagestubs(packagename, outputdir="", extensions=("py", "pypredef", "pi"), exclude=None): import pymel.util as util packagemod = __import__(packagename, globals(), locals(), [], -1) for modname, mod, ispkg in util.subpackages(packagemod): print modname, ":" contents = stubs.docmodule(mod) for extension in extensions: basedir = os.path.join(outputdir, extension) if extension == "pypredef": curfile = os.path.join(basedir, modname) else: curfile = os.path.join(basedir, *modname.split(".")) if ispkg: curfile = os.path.join(curfile, "__init__") curfile = curfile + os.extsep + extension curdir = os.path.dirname(curfile) if not os.path.isdir(curdir): os.makedirs(curdir) print "\t ...writing %s" % curfile f = open(curfile, "w") if not exclude or not re.match(exclude, modname): f.write(contents) f.close()
def packagestubs(packagename, outputdir='', extensions=('py', 'pypredef', 'pi'), exclude=None): import pymel.util as util packagemod = __import__(packagename, globals(), locals(), [], -1) for modname, mod, ispkg in util.subpackages(packagemod): contents = stubs.docmodule(mod) for extension in extensions: basedir = os.path.join(outputdir, extension) if extension == 'pypredef': curfile = os.path.join(basedir, modname) else: curfile = os.path.join(basedir, *modname.split('.') ) if ispkg: curfile = os.path.join(curfile, '__init__' ) curfile = curfile + os.extsep + extension curdir = os.path.dirname(curfile) if not os.path.isdir(curdir): os.makedirs(curdir) print modname, curfile f = open( curfile, 'w' ) if not exclude or not re.match( exclude, modname ): f.write( contents ) f.close()
def packagestubs(packagename, outputdir='', extensions=('py', 'pypredef', 'pi'), exclude=None): import pymel.util as util packagemod = __import__(packagename, globals(), locals(), [], -1) for modname, mod, ispkg in util.subpackages(packagemod): print modname, ":" contents = stubs.docmodule(mod) for extension in extensions: basedir = os.path.join(outputdir, extension) if extension == 'pypredef': curfile = os.path.join(basedir, modname) else: curfile = os.path.join(basedir, *modname.split('.')) if ispkg: curfile = os.path.join(curfile, '__init__') curfile = curfile + os.extsep + extension curdir = os.path.dirname(curfile) if not os.path.isdir(curdir): os.makedirs(curdir) print "\t ...writing %s" % curfile f = open(curfile, 'w') if not exclude or not re.match(exclude, modname): f.write(contents) f.close()
def initAE(): try: pkg = __import__('AETemplates') except ImportError: return False except Exception: import traceback traceback.print_exc() return False else: # import subpackages for data in subpackages(pkg): pass return True
def packagestubs(packagename, outputdir="", extension="py", exclude=None): packagemod = __import__(packagename, globals(), locals(), [], -1) for modname, mod, ispkg in util.subpackages(packagemod): curpath = os.path.join(outputdir, *modname.split(".")) if ispkg: if not os.path.exists(curpath): os.mkdir(curpath) curfile = os.path.join(curpath, "__init__" + os.extsep + extension) else: curfile = curpath + os.extsep + extension print modname, curfile f = open(curfile, "w") if not exclude or not re.match(exclude, modname): f.write(stubs.docmodule(mod)) f.close()