rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
demoData["manifest"] = version.getDemoManifest(variant.name)
demoData["manifest"] = demoManifest
def buildAllDemos(self, buildTarget="build", demoBrowser=None, copyDemos=False): if demoBrowser: demoBrowser = os.path.abspath(demoBrowser) console.info("Generating demos for all known libraries") repositoryData = [] console.indent() for libraryName in self.libraries: library = self.libraries[libraryName] libraryData ...
self.copyHtmlFile(libraryName, versionName, variant.name, buildTarget, demoBrowser) demoData = self.getDemoData(libraryName, versionName, variant.name) versionData["tests"].append(demoData)
demoManifest = version.getDemoManifest(variant.name) demoBrowserBase = os.path.split(demoBrowser)[0] for qxVersion in qxVersions: self.copyHtmlFile(libraryName, versionName, variant.name, buildTarget, demoBrowserBase, qxVersion) demoData = self.getDemoData(libraryName, versionName, variant.name, qxVersion) versionData[...
def buildAllDemos(self, buildTarget="build", demoBrowser=None, copyDemos=False): if demoBrowser: demoBrowser = os.path.abspath(demoBrowser) console.info("Generating demos for all known libraries") repositoryData = [] console.indent() for libraryName in self.libraries: library = self.libraries[libraryName] libraryData ...
def copyHtmlFile(self, libraryName, versionName, variantName, demoVersion, demoBrowser, qxVersion, local=False):
def copyHtmlFile(self, libraryName, versionName, variantName, demoVersion, demoBrowser, qxVersion):
def copyHtmlFile(self, libraryName, versionName, variantName, demoVersion, demoBrowser, qxVersion, local=False): #get some needed info from the demobrowser's manifest dbManifest = getDataFromJsonFile(os.path.join(demoBrowser, "Manifest.json")) dbResourcePath = dbManifest["provides"]["resource"] dbNamespace = dbManifest...
targetDir = os.path.join(demoBrowser, demoVersion, "demo", libraryName, versionName, variantName, qxVersion)
targetDir = os.path.join(demoBrowser, demoVersion, "demo", libraryName, versionName, variantName) if qxVersion: targetDir = os.path.join(targetDir,qxVersion)
def copyHtmlFile(self, libraryName, versionName, variantName, demoVersion, demoBrowser, qxVersion, local=False): #get some needed info from the demobrowser's manifest dbManifest = getDataFromJsonFile(os.path.join(demoBrowser, "Manifest.json")) dbResourcePath = dbManifest["provides"]["resource"] dbNamespace = dbManifest...
console.info("Copying HTML file for demo %s %s %s %s to the demobrowser" %(libraryName,versionName,variantName,demoVersion))
console.info("Copying HTML file for demo %s %s %s %s (qx version %s) to the demobrowser" %(libraryName,versionName,variantName,demoVersion, qxVersion))
def copyHtmlFile(self, libraryName, versionName, variantName, demoVersion, demoBrowser, qxVersion, local=False): #get some needed info from the demobrowser's manifest dbManifest = getDataFromJsonFile(os.path.join(demoBrowser, "Manifest.json")) dbResourcePath = dbManifest["provides"]["resource"] dbNamespace = dbManifest...
if local: demoUrl = "/".join([variantName, demoVersion]) else: demoUrl = "../../../../" + self.getDemoUrl(demoBrowser, demoPath)
demoUrl = "../../../../../../" + self.getDemoUrl(demoBrowser, demoPath)
def copyHtmlFile(self, libraryName, versionName, variantName, demoVersion, demoBrowser, qxVersion, local=False): #get some needed info from the demobrowser's manifest dbManifest = getDataFromJsonFile(os.path.join(demoBrowser, "Manifest.json")) dbResourcePath = dbManifest["provides"]["resource"] dbNamespace = dbManifest...
"name": variant + "." + qxVersion + ".html",
"name" : variant + ".html",
def getDemoData(self, library, version, variant, qxVersion): demoDict = { "name": variant + "." + qxVersion + ".html", "nr": variant.capitalize(), "title": library + " " + version + " " + variant, "tags" : [ library, "qxVersion_" + qxVersion ] }
def _getSourceTree(self, cacheId): tradeSpaceForSpeed = False
def _getSourceTree(self, cacheId, tradeSpaceForSpeed):
def _getSourceTree(self, cacheId): tradeSpaceForSpeed = False
classVariants = getClassVariants(self.id, self.path, None, context["cache"], context["console"], generate=False)
classVariants = self.classVariants(generate=False)
def tree(self, variantSet={}): context = self.context tradeSpaceForSpeed = False # Caution: setting this to True seems to make builds slower, at least on some platforms!?
tree = self._getSourceTree(unoptCacheId) classVariants= getClassVariantsFromTree(tree, context["console"])
tree = self._getSourceTree(unoptCacheId, tradeSpaceForSpeed) classVariants= self._variantsFromTree(tree)
def tree(self, variantSet={}): context = self.context tradeSpaceForSpeed = False # Caution: setting this to True seems to make builds slower, at least on some platforms!?
opttree = self._getSourceTree(unoptCacheId)
opttree = self._getSourceTree(unoptCacheId, tradeSpaceForSpeed)
def tree(self, variantSet={}): context = self.context tradeSpaceForSpeed = False # Caution: setting this to True seems to make builds slower, at least on some platforms!?
classvariants = getClassVariantsFromTree(tree, self.context["console"])
classvariants = self._variantsFromTree(tree)
def classVariants(self, generate=True):
def _variantsFromTree(self, node): classvariants = set([]) variants = treeutil.findVariablePrefix(node, "qx.core.Variant") for variant in variants: if not variant.hasParentContext("call/operand"): continue variantMethod = treeutil.selectNode(variant, "identifier[4]/@name") if variantMethod not in ["select", "isSet", "...
def classVariants(self, generate=True):
def getClassVariantsFromTree(node, console): classvariants = set([]) variants = treeutil.findVariablePrefix(node, "qx.core.Variant") for variant in variants: if not variant.hasParentContext("call/operand"): continue variantMethod = treeutil.selectNode(variant, "identifier[4]/@name") if variantMethod not in ["select", ...
def projectClassVariantsToCurrent(classVariants, variantSet): res = {} for key in variantSet: if key in classVariants: res[key] = variantSet[key] return res
simulationOptions = self.getConfigSetting("testRun/simulationOptions", None)
simulationOptions = self.getConfigSetting("testRun/simulationOptions", []) simulationOptions.append("branch=%s" %self.getConfigSetting("testRun/branch", "unknown branch"))
def getSimulationConfig(self, autName, configKey, browserConf): self.log.info("Getting configuration for %s on %s" %(autName,browserConf["browserId"])) #currentAppConf = self.configuration["testRun"][configKey][autName] currentAppConf = self.getConfigSetting("testRun/%s/%s" %(configKey,autName)) simConf = { "javaBin" :...
u"QOOXDOO_VERSION" : getQooxdooVersion()
u"QOOXDOO_VERSION" : getQooxdooVersion(), u"USERNAME" : os.getenv("USERNAME"), u"HOME" : getUserHome("."),
def getQooxdooVersion(): versionFile = os.path.join(os.path.dirname(__file__), "../../../../version.txt") # TODO: get rid of hard-coded path version = codecs.open(versionFile,"r", "utf-8").read() version = version.strip() return version
depsItem = DependencyItem(className, classAttribute, self.id, node.get('line', -1))
def _analyzeClassDepsNode(self, node, loadtime, runtime, inFunction, variants):
console.warn("Skipping unknown class dependency: %s
console.debug("Skipping unknown class of dependency: %s dependencyItem.requestor, dependencyItem.line))
def getTransitiveDepsR(dependencyItem, variants, totalDeps):
console.warn("Skipping unknown class dependency: %s
console.debug("Skipping unknown definition of dependency: %s methodId, dependencyItem.requestor, dependencyItem.line))
def getTransitiveDepsR(dependencyItem, variants, totalDeps):
versionPath = os.path.dirname(manifestPath)
versionPath = os.path.abspath(os.path.dirname(manifestPath))
def getLibraries(self, manifests): console.info("Checking manifests to find valid libraries...") libraries = {} console.indent() for manifestPath in manifests: try: manifest = getDataFromJsonFile(manifestPath) except RuntimeError, e: console.error(repr(e)) if not "info" in manifest: console.warn("Manifest file %s has ...
for line in sourceFile: demoUrl = "../../../../../%s/%s/demo/%s/%s/" %(libraryName,versionName,variantName,demoVersion)
demoPath = os.path.join( self.libraries[libraryName][versionName].path, "demo", variantName, demoVersion) demoUrl = "../../../" + self.getDemoUrl(demoBrowser, demoPath) for line in sourceFile:
def copyHtmlFile(self, libraryName, versionName, variantName, demoVersion, demoBrowser): #get some needed info from the demobrowser's manifest dbManifest = getDataFromJsonFile(os.path.join(demoBrowser, "Manifest.json")) dbResourcePath = dbManifest["provides"]["resource"] dbNamespace = dbManifest["provides"]["namespace"...
console.info("Adding library %s version %s" %(libraryName,libraryVersion))
def getLibraries(self, manifests): console.info("Checking manifests to find valid libraries...") libraries = {} console.indent() for manifestPath in manifests: try: manifest = getDataFromJsonFile(manifestPath) except Exception, e: console.error(str(e)) if not "info" in manifest: console.warn("Manifest file %s has no '...
console.warn("Found additional manifest for version %s of library %s!" %(libraryVersion,libraryName))
console.write("") console.indent() console.error("Found additional manifest for version %s of library %s!" %(libraryVersion,libraryName)) console.outdent() console.write("")
def getLibraries(self, manifests): console.info("Checking manifests to find valid libraries...") libraries = {} console.indent() for manifestPath in manifests: try: manifest = getDataFromJsonFile(manifestPath) except Exception, e: console.error(str(e)) if not "info" in manifest: console.warn("Manifest file %s has no '...
"title": library + " " + version + " " + variant
"title": library + " " + version + " " + variant, "manifest" : self.libraries[library][version].getManifest()
def getDemoData(self, library, version, variant): demoDict = { "name": version + "-" + variant + ".html", "nr": variant.capitalize(), "tags": [library], "title": library + " " + version + " " + variant } qooxdooVersions = self.libraries[library][version].getManifest()["info"]["qooxdoo-versions"] for ver in qooxdooVers...
if True or item not in (x.name for x in load): load.append(dep)
load.append(dep)
def buildShallowDeps():
if True or item not in (x.name for x in run): run.append(dep)
run.append(dep)
def buildShallowDeps():
if version == "build": if not (self._job.get("compile-dist", False) or self._job.get("compile/type")=="build"): return packages = script.packagesSortedSimple() parts = script.parts boot = script.boot variants = script.variants classList = script.classes self._treeCompiler = treeCompiler self._classLis...
compType = self._job.get("compile/type", "") if compType not in ("build", "source"): return packages = script.packagesSortedSimple() parts = script.parts boot = script.boot variants = script.variants self._classList = script.classes self._treeCompiler = treeCompiler self._variants = variants c...
def mapCompileConfig(oldConf): newConf = ExtMap({}) if 'file' in oldConf: newConf.set("paths/file", oldConf['file']) if 'root' in oldConf: newConf.set("paths/app-root", oldConf['root']) if 'locales' in oldConf: newConf.set("code/locales", oldConf['locales']) if 'gzip' in oldConf: newConf.set("path/gzip", oldConf['gzip'...
if not (self._job.get("compile-source/file") or self._job.get("compile/type")=="source"): return
def mapCompileConfig(oldConf): newConf = ExtMap({}) if 'file' in oldConf: newConf.set("paths/file", oldConf['file']) if 'root' in oldConf: newConf.set("paths/app-root", oldConf['root']) if 'locales' in oldConf: newConf.set("code/locales", oldConf['locales']) if 'gzip' in oldConf: newConf.set("path/gzip", oldConf['gzip'...
compConf = self._job.get("compile-source") if compConf: self._console.warn("! DeprecationWarning: You are using deprecated config key 'compile-source'") compConf = mapCompileConfig(compConf) else: compConf = self._job.get("compile-options") compConf = ExtMap(compConf) packages = script.packagesSortedSimple() p...
def mapCompileConfig(oldConf): newConf = ExtMap({}) if 'file' in oldConf: newConf.set("paths/file", oldConf['file']) if 'root' in oldConf: newConf.set("paths/app-root", oldConf['root']) if 'locales' in oldConf: newConf.set("code/locales", oldConf['locales']) if 'gzip' in oldConf: newConf.set("path/gzip", oldConf['gzip'...
self._console.progress(pos, length)
self._console.progress(pos+1, length)
def reap_processes(wait=False): # reap the current processes (wait==False: if they are finished) #print "-- entering reap_processes with len: %d" % len(processes) reaped = False counter = 0 while True: for pos, pid in enumerate(processes.keys()): if not wait and pid.poll() == None: # None = process hasn't terminated ...
self._console.progress(pos, length)
self._console.progress(pos+1, length)
def compileClass(classId, pos): contA[pos] = (self.getCompiled(classId, variants, optimize, format))
self.filter = config
self.validator = LibraryValidator(config)
def __init__(self, repoDir, config=None): self.dir = os.path.abspath(repoDir) self.filter = config manifests = self.scanRepository() self.libraries = self.getLibraries(manifests)
if not self.isSelected(libraryName, libraryVersion, libraryType, libraryQxVersions):
if not self.validator.isValid(libraryType, libraryName, libraryVersion, libraryQxVersions):
def getLibraries(self, manifests): libraries = {} for manifestPath in manifests: try: manifest = getDataFromJsonFile(manifestPath) except RuntimeError, e: console.error(repr(e)) if not "info" in manifest: console.warn("Manifest file %s has no 'info' section, skipping the library." %manifestPath) continue libraryName ...
def isSelectedLibrary(self, libraryName): if not "libraries" in self.filter: return True wantedLibraries = self.filter["libraries"] if "*" in wantedLibraries or libraryName in wantedLibraries: return True else: return False def isSelectedVersion(self, libraryName, libraryVersion): if not "libraries" in self.filter: r...
def getLibraries(self, manifests): libraries = {} for manifestPath in manifests: try: manifest = getDataFromJsonFile(manifestPath) except RuntimeError, e: console.error(repr(e)) if not "info" in manifest: console.warn("Manifest file %s has no 'info' section, skipping the library." %manifestPath) continue libraryName ...
console.info("Building %s version of demo variant %s for library %s version %s" %(demoVersion,demoVariant, self.libraryName, self.versionName) )
console.info("Generating %s version of demo variant %s for library %s version %s" %(demoVersion,demoVariant, self.libraryName, self.versionName) )
def buildDemo(self, demoVariant = "default", demoVersion = "build"): if not self.hasDemoDir: console.error("Library %s version %s has no demo folder!" %(self.library.dir, self.dir)) return console.info("Building %s version of demo variant %s for library %s version %s" %(demoVersion,demoVariant, self.libraryName, self....
def __init__(self): pass
def __init__(self, console=DummyConsole()): self.__console = console
def __init__(self): pass
entryPath = os.path.join(sourceDir, entry)
def __copyDirToDir(self, sourceDir, targetDir): sourceDirName = os.path.basename(sourceDir) if sourceDirName in self.__exclude: return targetPath = os.path.join(targetDir, sourceDirName) if not os.path.isdir(targetPath): if self.__create: os.makedirs(targetPath) else: raise IOError(2, "No such directory: '%s'" %targetP...
loadDeps = set(x.name for x in classDeps['load']) for depsId in loadDeps:
loadDeps = [x.name for x in classDeps['load']] runDeps = [x.name for x in classDeps['run']] for depsId in loadDeps:
def verifyParts(self, partsMap, script): self._console.info("Verifying Parts...") self._console.indent() for part in partsMap.values(): self._console.info("Verifying: %s" % part.name) self._console.indent() # get set of current classes in this part classSet = set() classList = [] classPackage = [] for packageIdx, packa...
msg = "Unfullfilled load dependencies of class '%s'[%d]: '%s'" % (classId, packageIdx, depsId)
msg = "Unfullfilled dependency of class '%s'[%d]: '%s'" % (classId, packageIdx, depsId)
def verifyParts(self, partsMap, script): self._console.info("Verifying Parts...") self._console.indent() for part in partsMap.values(): self._console.info("Verifying: %s" % part.name) self._console.indent() # get set of current classes in this part classSet = set() classList = [] classPackage = [] for packageIdx, packa...
if classIdx < depsIdx:
if depsId in loadDeps and classIdx < depsIdx:
def verifyParts(self, partsMap, script): self._console.info("Verifying Parts...") self._console.indent() for part in partsMap.values(): self._console.info("Verifying: %s" % part.name) self._console.indent() # get set of current classes in this part classSet = set() classList = [] classPackage = [] for packageIdx, packa...
if isCommonAndGreaterPackage(searchId, package):
if (isCommonAndGreaterPackage(searchId, package) and hasNoDeps(searchPackage, package)):
def isCommonAndGreaterPackage(searchId, package): # the same package is not "greater" if package.id == searchId: return False # the next takes advantage of the fact that the package id encodes # the parts a package is used by. if another package id has the # same bits turned on, it is in the same packages. this is only...
if x in y.packageDeps:
if x not in y.packageDeps and y not in x.packageDeps: return 0 if x in y.packageDeps and y not in x.packageDeps:
def cmpFunc (x, y): if x.part_count != y.part_count: return cmp(x.part_count, y.part_count) else: if x in y.packageDeps: # y needs x, so x is "larger" (must be earlier) return 1 elif y in x.packageDeps: # other way round return -1 else: return 0
print defDepsItem if str(defDepsItem) == "qx.bom.element.Style pass
def getTransitiveDepsR(dependencyItem, variants, totalDeps):
def parseFragmentLead(content, fragment, tokens): pos = content.find(fragment) if pos > 0: parsePart(recoverEscape(content[0:pos]), tokens) return content[pos+len(fragment):] def hasLeadingContent(tokens): pos = len(tokens) - 1 while pos > 0: if tokens[pos]["type"] == "eol": break else: return True return False...
def parsePart(part, tokens=[]): global parseUniqueId global parseLine global parseColumn #tokens = [] element = "" for line in R_NEWLINE.split(part): if line == "\n": tokens.append({ "type" : "eol", "source" : "", "detail" : "", "line" : parseLine, "column" : parseColumn, "id" : parseUniqueId }) parseColumn = 1 parse...
return parseStream2(content, uniqueId) def parseStream2(content, uniqueId=""):
def parseStream(content, uniqueId=""): return parseStream2(content, uniqueId)
def parseStream1(content, uniqueId=""): global parseLine global parseColumn global parseUniqueId parseColumn = 1 parseLine = 1 parseUniqueId = uniqueId tokens = [] content = protectEscape(content) try: all = R_ALL.findall(content) except RuntimeError: msg = "Could not parse file %s" % uniqueId msg += "\nGeneral...
def hasLeadingContent(tokens): if not len(tokens): return False else: if tokens[-1]["type"] == "eol": return False
def restLineIsEmpty(scanner): try: toks = scanner.peek(2) except StopIteration: return True # TODO: this is a hack if (toks[0].name == 'nl' or (toks[0].name == 'white' and toks[1].name == 'nl')): return True else: return False
classInfo, modTime = cache.read(self.cacheId, self.path)
classInfo, modTime = cache.read(self.cacheId, self.path, memory=True)
def _getClassCache(self): cache = self.context["cache"] classInfo, modTime = cache.read(self.cacheId, self.path) if classInfo: return classInfo, modTime else: return {}, None
cache.write(self.cacheId, data)
cache.write(self.cacheId, data, memory=True)
def _writeClassCache(self, data): cache = self.context["cache"] cache.write(self.cacheId, data)
class DependencyItem(object): __slots__ = ('name', 'line') def __init__(self, name, line): self.name = name self.line = line
def sortClassesTopological(self, includeWithDeps, variants): # create graph object gr = graph.digraph()
libraryFilter = self.filter["*"]
libraryFilter = self.filter["libraries"]["*"]
def isSelectedVersion(self, libraryName, libraryVersion): if not "libraries" in self.filter: return True if "*" in self.filter["libraries"]: libraryFilter = self.filter["*"] else: libraryFilter = self.filter["libraries"][libraryName] if not "versions" in libraryFilter: return True wantedVersions = libraryFilter["vers...
classesFiltered = (c for c in classes if not excRegex.search(c))
classesFiltered = (c for c in classes if incRegex.search(c) and not excRegex.search(c))
def getFilteredClassList(classes, includePatt_, excludePatt_): # Although lint-check doesn't work with dependencies, we allow # '=' in class pattern for convenience; stripp those now intelli, explicit = self._splitIncludeExcludeList(includePatt_) includePatt = intelli + explicit intelli, explicit = self._splitIncludeEx...
self._console.debug("Checking %s" % classId)
def getFilteredClassList(classes, includePatt_, excludePatt_): # Although lint-check doesn't work with dependencies, we allow # '=' in class pattern for convenience; stripp those now intelli, explicit = self._splitIncludeExcludeList(includePatt_) includePatt = intelli + explicit intelli, explicit = self._splitIncludeEx...
def handleFunction(funcItem, name, commentAttributes, classNode, reportMissingDesc=True):
def handleFunction(funcItem, name, commentAttributes, classNode, reportMissingDesc=True, checkReturn=False):
def handleFunction(funcItem, name, commentAttributes, classNode, reportMissingDesc=True): node = tree.Node("method") node.set("name", name) if funcItem.type != "function": printDocError(funcItem, "'funcItem' is no function") return node # Read the parameters params = funcItem.getChild("params", False) if params and ...
def buildAllTestrunners(self, job="test"): console.indent() for libraryName, library in self.libraries.iteritems(): for versionName, libraryVersion in library.children.iteritems(): libraryVersion.buildTestrunner(job) console.outdent()
def storeData(self, path): if not os.path.isdir(path): os.makedirs(path) path = os.path.join(path, "demodata.json") storeDemoData(self.data, path)
def buildTestrunner(self, job="test"): console.info("Building Testrunner for %s %s... " %(self.parent.name, self.name)) if not (self.hasGenerator and self.hasUnitTests): console.write("Nothing to do.", "info") return rcode, output, errout = runGenerator(self.path, job) if rcode > 0: self.issues.append( {"testrunnerBui...
def _checkUnitTests(self): try: classPath = self.manifest["provides"]["class"] namespace = self.manifest["provides"]["namespace"] fullClassPath = os.path.join(self.path, classPath, namespace) testPath = os.path.join(fullClassPath, "test") if os.path.isdir(testPath): testPathContents = os.listdir(testPath) for entry in ...
elif job == "test": repository.buildAllTestrunners()
else: repository.runGeneratorForAll(job)
def main(): (options,args) = getComputedConf() config = None if options.configfile: config = getDataFromJsonFile(options.configfile) repository = Repository(options.workdir, config) if options.demobrowser: if not os.path.isabs(options.demobrowser): options.demobrowser = os.path.abspath(options.demobrowser) if optio...
filePath = os.path.join(os.path.dirname(self._job.get("compile-options/paths/file")), package.file)
filePath = self._config.absPath(self._job.get("compile-options/paths/file")) filePath = os.path.join(os.path.dirname(filePath), package.file)
def writePackages(self, packages, script):
classInfo, _ = cache.read(self.cacheId, self.path)
classInfo, modTime = cache.read(self.cacheId, self.path)
def _getClassCache(self): cache = self.context["cache"] classInfo, _ = cache.read(self.cacheId, self.path) if classInfo: return classInfo else: return {}
return classInfo
return classInfo, modTime
def _getClassCache(self): cache = self.context["cache"] classInfo, _ = cache.read(self.cacheId, self.path) if classInfo: return classInfo else: return {}
return {}
return {}, None
def _getClassCache(self): cache = self.context["cache"] classInfo, _ = cache.read(self.cacheId, self.path) if classInfo: return classInfo else: return {}
classinfo = self._getClassCache()
classinfo, _ = self._getClassCache()
def classVariants(self, generate=True):
if classinfo == None or 'svariants' not in classinfo:
if 'svariants' not in classinfo:
def classVariants(self, generate=True):
sourceMod = os.stat(sourceFile).st_mtime targetMod = os.stat(targetPath).st_mtime if targetMod > sourceMod:
if not self.__isNewerThan(sourceFile, targetPath):
def __copyFileToDir(self, sourceFile, targetDir): self.__console.debug("Copying file %s to directory %s." %(sourceFile, targetDir)) sourceFileName = os.path.basename(sourceFile) if sourceFileName in self.__exclude: return if not os.path.isdir(targetDir): if self.__create: self.__console.debug("Creating directory %s." ...
if root != libraryPath or name[0] == ".":
if name[0] == ".":
def getVersions(self, restrictions): versions = {} libraryPath = os.path.join(self.repository.dir, self.dir) for root, dirs, files in os.walk(libraryPath, topdown=True): for name in dirs[:]: console.indent() # only check direct subfolders of the library, ignore .svn etc. if root != libraryPath or name[0] == ".": dirs.r...
if False: ldeps = self.getMethodDeps(assembledId, assembled, variants) loadtime.extend([x for x in ldeps if x not in loadtime]) else: console.indent() ldeps = self.getMethodDeps1(depsItem, variants) loadtime.extend([x for x in ldeps if x not in loadtime]) console.outdent()
console.indent() ldeps = self.getMethodDeps(depsItem, variants) loadtime.extend([x for x in ldeps if x not in loadtime]) console.outdent()
def _analyzeClassDepsNode(self, node, loadtime, runtime, inFunction, variants):
def getMethodDeps(self, classId, methodNameFQ, variants): def findMethodName(classId, methodNameFQ): mo = re.match(r'(?u)^%s\.(.+)$' % classId, methodNameFQ) if mo and mo.group(1): return mo.group(1) else: return u'' def findMethod(tree, methodName): for node in treeutil.nodeIterator(tree, ["function"]): if node....
def getMethodDeps(self, classId, methodNameFQ, variants): # find the dependencies of a specific method # get the classId class, find the node of methodNameFQ, and extract its # dependencies (can only be runtime deps, since all inFunction) # return the deps
def getMethodDeps1(self, depsItem, variants):
def getMethodDeps(self, depsItem, variants):
def getMethodDeps1(self, depsItem, variants):
(fileDescriptor, tempPath) = tempfile.mkstemp(text=True)
(fileDescriptor, tempPath) = tempfile.mkstemp(text=True, dir=os.curdir)
def combine(self, combined, files, horizontal): self._console.indent() montage_cmd = "montage -geometry +0+0 -gravity NorthWest -tile %s -background None %s %s" if horizontal: orientation = "x1" else: orientation = "1x"
cmd = montage_cmd % (orientation, "@" + tempPath, combined)
cmd = montage_cmd % (orientation, "@" + os.path.basename(tempPath), combined)
def combine(self, combined, files, horizontal): self._console.indent() montage_cmd = "montage -geometry +0+0 -gravity NorthWest -tile %s -background None %s %s" if horizontal: orientation = "x1" else: orientation = "1x"
os.system(crop_cmd % (source_file, border[3], border[0], 0, 0, dest_file + "-tl.png")) os.system(crop_cmd % (source_file, width - border[3] - border[1], border[0], border[3], 0, dest_file + "-t.png")) os.system(crop_cmd % (source_file, border[1], border[0], width - border[1], 0, dest_file + "-tr.png")) os.system(crop_...
if border[0] > 0 and border[3] > 0: os.system(crop_cmd % (source_file, border[3], border[0], 0, 0, dest_file + "-tl.png")) if border[0] > 0: os.system(crop_cmd % (source_file, width - border[3] - border[1], border[0], border[3], 0, dest_file + "-t.png")) if border[0] > 0 and border[1] > 0: os.system(crop_cmd % (source_...
def slice(self, source, dest_prefix, border, trim_width):
os.system(crop_cmd % (source_file, border[1], height - border[0] - border[2], width - border[1], border[0], dest_file + "-r.png")) os.system(crop_cmd % (source_file, border[3], border[2], 0, height - border[2], dest_file + "-bl.png")) os.system(crop_cmd % (source_file, width- border[3] - border[1], border[2], border[3...
if border[1] > 0: os.system(crop_cmd % (source_file, border[1], height - border[0] - border[2], width - border[1], border[0], dest_file + "-r.png")) if border[2] > 0 and border[3] > 0: os.system(crop_cmd % (source_file, border[3], border[2], 0, height - border[2], dest_file + "-bl.png")) if border[2] > 0: os.system(cro...
def slice(self, source, dest_prefix, border, trim_width):
self._console.error("Found errornous API information. Please see above. Stopping!")
self._console.error("Found erroneous API information. Please see above. Stopping!")
def storeApi(self, include, apiPath): self._console.info("Generating API data...") self._console.indent()
def getScript(node, fileId, ):
def getScript(node, fileId, __memo=[None,None]): rootNode = findRoot(node) if __memo[0] == rootNode: script = __memo[1] else: script = Script(rootNode, fileId) __memo[0] = rootNode __memo[1] = script return script
def getScript(node, fileId, ): ## TODO: checking the root nodes is a fix, as they sometimes differ (prob. caching) #rootNode = findRoot(node) ##if _memo1_[0] == fileId: # replace with '_memo1_[0] == rootNode', to make it more robust, but slightly less performant #if _memo1_[0] == rootNode: # #print "-- re-using scop...
if not self.scopes: rootNode = findRoot(node) self.scopes = Script(rootNode, fileId) return self.scopes
def getScript(node, fileId, ): ## TODO: checking the root nodes is a fix, as they sometimes differ (prob. caching) #rootNode = findRoot(node) ##if _memo1_[0] == fileId: # replace with '_memo1_[0] == rootNode', to make it more robust, but slightly less performant #if _memo1_[0] == rootNode: # #print "-- re-using scop...
for otherClassId in package.classes: otherClassDeps = self._depLoader.getDeps(otherClassId, variants) if classId in (x.name for x in otherClassDeps["load"]): yield (packageId, classId, otherClassId, 'load') if classId in (x.name for x in otherClassDeps["run"]): yield (packageId, classId, otherClassId, 'run')
classDeps = self._depLoader.getDeps(classId, variants) for dep in classDeps["load"]: yield (packageId, dep.name, classId, 'load') for dep in classDeps["run"]: yield (packageId, dep.name, classId, 'run')
def lookupUsedByDeps(packages): for packageId, package in enumerate(packages): for classId in sorted(package.classes): for otherClassId in package.classes: otherClassDeps = self._depLoader.getDeps(otherClassId, variants) if classId in (x.name for x in otherClassDeps["load"]): yield (packageId, classId, otherClassId, 'l...
def depsToDotFile(depsLogConf, gr):
def depsToDotFile(classDepsIter, depsLogConf):
def depsToDotFile(depsLogConf, gr):
if useCompiledSize: fsize = self._treeCompiler.getCompiledSize(classId, variants, optimize, recompile=True) mode = 'compiled' else: fsize = self._classes[classId]['size'] mode = 'source' if fsize > sizes[mode][0]: color = "red" fontsize = 15 elif fsize > sizes[mode][1]: color = "green" fontsize = 13 else: color = "b...
if classId in self._classes: if useCompiledSize: fsize = self._treeCompiler.getCompiledSize(classId, variants, optimize, recompile=True) mode = 'compiled' else: fsize = self._classes[classId]['size'] mode = 'source' if fsize > sizes[mode][0]: color = "red" fontsize = 15 elif fsize > sizes[mode][1]: color = "green" f...
def getNodeAttribs(classId, useCompiledSize=False, optimize=[]): # return color according to size attribs = [] color = fontsize = None sizes = { # (big-threshold, medium-threshold) 'compiled' : (8000, 2000), 'source' : (20000, 5000) } if useCompiledSize: fsize = self._treeCompiler.getCompiledSize(classId, varian...
gr1 = createPrinterGraph(gr, depsLogConf)
phase = depsLogConf.get('phase', None) gr = graph.digraph() graphAddEdges(classDepsIter, gr, phase) gr1 = createPrinterGraph(gr, depsLogConf)
def createPrinterGraph(gr, depsLogConf): # create a helper graph for output format, mode = getFormatMode(depsLogConf) searchRoot = depsLogConf.get('dot/root') # get the root node for the spanning tree searchRadius = depsLogConf.get('dot/radius', None) if searchRadius: filter = graph.filters.radius(searchRadius) e...
if not gr.has_node(depId): continue
if not gr.has_node(classId): graphAddNode(gr, classId) if not gr.has_node(depId): graphAddNode(gr, depId)
def graphAddEdges(classDepsIter, gr, pLoadOrRun):
gr.add_node(cid, attrs=[("color", color)])
else: color = "blue" gr.add_node(cid, attrs=[("color", color)])
def graphAddNodes(gr, clsList): for cid in clsList: fsize = self._classes[cid]['size'] if fsize > 20000: color = "red" elif fsize > 5000: color = "green" else: color = "blue" gr.add_node(cid, attrs=[("color", color)]) return
for packageId, package in enumerate(packages): self._console.info("Package %s" % packageId) self._console.indent() for part in parts.values(): if package in part.packages: self._console.info("Part %s" % part.name) for classId in sorted(package.classes): self._console.info("Class: %s" % classId)
mainformat = depsLogConf.get('format', None) classDepsIter = lookupUsedByDeps(packages) if mainformat == 'dot': depsToDotFile(classDepsIter, depsLogConf) elif mainformat == 'json': depsToJsonFile(classDepsIter, depsLogConf) elif mainformat == 'flare': depsToFlareFile(classDepsIter, depsLogConf) elif mainformat == 'ter...
def usedByDeps(depsLogConf): for packageId, package in enumerate(packages): self._console.info("Package %s" % packageId) self._console.indent()
for otherClassId in package.classes: otherClassDeps = self._depLoader.getDeps(otherClassId, variants) if classId in (x.name for x in otherClassDeps["load"]): self._console.info("Used by: %s (load)" % otherClassId) if classId in (x.name for x in otherClassDeps["run"]): self._console.info("Used by: %s (run)" % otherCla...
for part in parts.values(): if package in part.packages: self._console.info("Part %s" % part.name) for classId in sorted(package.classes): self._console.info("Class: %s" % classId) self._console.indent() for otherClassId in package.classes: otherClassDeps = self._depLoader.getDeps(otherClassId, variants) if classId ...
def usedByDeps(depsLogConf): for packageId, package in enumerate(packages): self._console.info("Package %s" % packageId) self._console.indent()
self._console.outdent()
def usedByDeps(depsLogConf): for packageId, package in enumerate(packages): self._console.info("Package %s" % packageId) self._console.indent()
dset = depsLogConf.get('using/phase', None)
def usingDeps(depsLogConf):
gr = graph.digraph() graphAddNodes(gr, script.classes) graphAddEdges(lookupUsingDeps(packages), gr, dset) depsToDotFile(depsLogConf, gr)
depsToDotFile(classDepsIter, depsLogConf)
def usingDeps(depsLogConf):
depsToJsonFile(lookupUsingDeps(packages), depsLogConf)
depsToJsonFile(classDepsIter, depsLogConf)
def usingDeps(depsLogConf):
depsToFlareFile(lookupUsingDeps(packages), depsLogConf)
depsToFlareFile(classDepsIter, depsLogConf)
def usingDeps(depsLogConf):
depsToTerms(lookupUsingDeps(packages))
depsToTerms(classDepsIter)
def usingDeps(depsLogConf):
depsToConsole(lookupUsingDeps(packages))
depsToConsole(classDepsIter)
def usingDeps(depsLogConf):
temp = tempfile.NamedTemporaryFile(mode='r+t')
(fileDescriptor, tempPath) = tempfile.mkstemp(text=True) tempPath = os.path.normpath(tempPath) temp = os.fdopen(fileDescriptor, "w")
def combine(self, combined, files, horizontal): self._console.indent() montage_cmd = "montage -geometry +0+0 -gravity NorthWest -tile %s -background None %s %s" if horizontal: orientation = "x1" else: orientation = "1x"
temp.seek(0) cmd = montage_cmd % (orientation, "@" + os.path.normpath(temp.name), combined)
temp.close() cmd = montage_cmd % (orientation, "@" + tempPath, combined)
def combine(self, combined, files, horizontal): self._console.indent() montage_cmd = "montage -geometry +0+0 -gravity NorthWest -tile %s -background None %s %s" if horizontal: orientation = "x1" else: orientation = "1x"
temp.close()
os.unlink(tempPath)
def combine(self, combined, files, horizontal): self._console.indent() montage_cmd = "montage -geometry +0+0 -gravity NorthWest -tile %s -background None %s %s" if horizontal: orientation = "x1" else: orientation = "1x"
javaClassPath = self._job.get("simulate/java-classpath", False) if javaClassPath: javaClassPath = "-cp %s" %javaClassPath
classPathSeparator = ":" if util.getPlatformInfo()[0] == "Windows": classPathSeparator = ";" javaClassPath = "-cp " configClassPath = self._job.get("simulate/java-classpath", False) if configClassPath: javaClassPath += configClassPath qxSeleniumPath = self._job.get("simulate/qxselenium-path", False) javaClassPath += ...
def runSimulation(self): self._console.info("Running Simulation...") javaClassPath = self._job.get("simulate/java-classpath", False) if javaClassPath: javaClassPath = "-cp %s" %javaClassPath rhinoClass = self._job.get("simulate/rhino-class", False) runnerScript = self._job.get("simulate/simulator-script") cmd = "ja...
ldeps = self.getForeignDeps(depsItem, variants)
ldeps = self.getTransitiveDeps(depsItem, variants)
def _analyzeClassDepsNode(self, node, loadtime, runtime, inFunction, variants):
def getForeignDeps(self, depsItem, variants):
def getTransitiveDeps(self, depsItem, variants):
def getLeadingId(idStr): leadingId = idStr dotIdx = idStr.find('.') if dotIdx > -1: leadingId = idStr[:dotIdx] return leadingId
def getForeignDepsR(dependencyItem, variants, totalDeps):
def getTransitiveDepsR(dependencyItem, variants, totalDeps):
def getForeignDepsR(dependencyItem, variants, totalDeps): # We don't add the in-param to the global result classId = dependencyItem.name methodId= dependencyItem.attribute
downstreamDeps = getForeignDepsR(depsItem, variants, totalDeps.union(localDeps))
downstreamDeps = getTransitiveDepsR(depsItem, variants, totalDeps.union(localDeps))
def getForeignDepsR(dependencyItem, variants, totalDeps): # We don't add the in-param to the global result classId = dependencyItem.name methodId= dependencyItem.attribute
deps = getForeignDepsR(depsItem, variants, checkset)
deps = getTransitiveDepsR(depsItem, variants, checkset)
def getForeignDepsR(dependencyItem, variants, totalDeps): # We don't add the in-param to the global result classId = dependencyItem.name methodId= dependencyItem.attribute
def getForeignDeps1(self, depsItem, variants): def getForeignDepsR(depsItem, variants, totalDeps):
def getTransitiveDeps1(self, depsItem, variants): def getTransitiveDepsR(depsItem, variants, totalDeps): classId = dependencyItem.name methodId= dependencyItem.attribute console.debug("%s console.indent() mydeps = set() defClassId, attribNode = findClassForMethod(classId, methodId, variants) if not defClassId:...
def getForeignDepsR(dependencyItem, variants, totalDeps): # We don't add the in-param to the global result classId = dependencyItem.name methodId= dependencyItem.attribute
for depsItem in deps_rt: dclassid = depsItem.name dclassobj= self._classesObj[dclassid] ddeps = dclassobj.dependencies() methoddeps = lookup_methoddeps(depsItem.attribute, ddeps) for deps in methoddeps: downstream = getForeignDepsR(deps, variants) mydeps.update(downstream)
defDepsItem = DependencyItem(defClassId, methodId, classId) if defClassId != classId: resultAdd(defDepsItem, mydeps) if isinstance(attribNode, Node): defClassObj = self._classesObj [defClassId] shallowDeps = defClassObj.shallowdeps() methodDeps = shallowDeps.getAttributeDeps(methodId) for depsItem in methodDeps: ...
def getForeignDepsR(depsItem, variants, totalDeps): for depsItem in deps_rt: dclassid = depsItem.name dclassobj= self._classesObj[dclassid] ddeps = dclassobj.dependencies() methoddeps = lookup_methoddeps(depsItem.attribute, ddeps) for deps in methoddeps: downstream = getForeignDepsR(deps, variants) mydeps.update(downs...