rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
return st.replace('\\', r'\\')\ .replace('\t', r'\t')\
return st.replace('\t', r'\t')\
def escape(st): """ Escape special chars and return the given string *st*. **Examples**: >>> escape('\\t and \\n and \\r and " and \\\\') '\\\\t and \\\\n and \\\\r and \\\\" and \\\\\\\\' """ return st.replace('\\', r'\\')\ .replace('\t', r'\t')\ .replace('\r', r'\r')\ .replace('\n', r'\n')\ .replace('\"', r'\"')
.replace('\"', r'\"')
def escape(st): """ Escape special chars and return the given string *st*. **Examples**: >>> escape('\\t and \\n and \\r and " and \\\\') '\\\\t and \\\\n and \\\\r and \\\\" and \\\\\\\\' """ return st.replace('\\', r'\\')\ .replace('\t', r'\t')\ .replace('\r', r'\r')\ .replace('\n', r'\n')\ .replace('\"', r'\"')
return st.replace(r'\"', '"').replace(r'\\', '\\')
return st
def unescape(st): """ Unescape special chars and return the given string *st*. **Examples**: >>> unescape('\\\\t and \\\\n and \\\\r and \\\\" and \\\\\\\\') '\\t and \\n and \\r and " and \\\\' >>> unescape(r'\\n') '\\n' >>> unescape(r'\\\\n') '\\\\n' """ raw_strings = [ (r'\\n', r'\n', '\n'), (r'\\r', r'\r', '\r'),...
and self.context['jobconf'].get("dependencies/follow-static-initializers", False)
def followCallDeps(self, node, fileId, className): if (className and className in self._classesObj # we have a class id and className != fileId and self.context['jobconf'].get("dependencies/follow-static-initializers", False) and ( node.hasParentContext("keyvalue/value/call/operand") # it's a method call as map value...
def replaceWithNamespace(imguri, liburi, libns): pre,libsfx,imgsfx = Path.getCommonPrefix(liburi, imguri) if imgsfx[0] == os.sep: imgsfx = imgsfx[1:] imgshorturi = os.path.join("${%s}" % libns, imgsfx) return imgshorturi
def replaceWithNamespace(imguri, liburi, libns): pre,libsfx,imgsfx = Path.getCommonPrefix(liburi, imguri) if imgsfx[0] == os.sep: imgsfx = imgsfx[1:] # strip leading '/' imgshorturi = os.path.join("${%s}" % libns, imgsfx) return imgshorturi
def normalizeImgUri(uriFromMetafile, trueCombinedUri, combinedUriFromMetafile): (uriFromMetafile, trueCombinedUri, combinedUriFromMetafile) = map(os.path.normpath, (uriFromMetafile, trueCombinedUri, combinedUriFromMetafile)) trueUriPrefix, mappedUriPrefix, _ = Path.getCommonSuffix(trueCombinedUri, combinedUriFromMeta...
def extractAssetPart(libresuri, imguri): pre,libsfx,imgsfx = Path.getCommonPrefix(libresuri, imguri) # split libresuri from imguri if imgsfx[0] == os.sep: imgsfx = imgsfx[1:] # strip leading '/' return imgsfx # use the bare img suffix as its asset Id
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("Could not read manifest file %s" %manifestPath) console.indent() console.e...
self.hasDemoDir = False
self.checkStructure()
def __init__(self, versionName, libraryName, path): self.versionName = versionName self.libraryName = libraryName self.path = path self.hasDemoDir = False self.demoVariants = self.getDemoVariants() self.demoBuildStatus = {} self.checkStructure()
self.checkStructure()
def __init__(self, versionName, libraryName, path): self.versionName = versionName self.libraryName = libraryName self.path = path self.hasDemoDir = False self.demoVariants = self.getDemoVariants() self.demoBuildStatus = {} self.checkStructure()
def runGenerator(self, job, subPath=None, cwd=False):
def runGenerator(self, job, subPath=None):
def runGenerator(self, job, subPath=None, cwd=False): if not self.hasGenerator: raise Exception("%s %s has no generate.py script!" %(self.libraryName, self.versionName)) path = self.path if subPath: path = os.path.join(path, subPath) startPath = os.getcwd() os.chdir(path) cmd = "python generate.py %s" %job rcode, outpu...
cacheId = "messages-%s-%s" % (self.path, variantsId) messages, _ = cache.readmulti(cacheId, self.path)
classInfo, cacheModTime = self._getClassCache() messages = classInfo[cacheId] if cacheId in classInfo else None
# this duplicates codef from Locale.getTranslation
cache.writemulti(cacheId, messages)
classInfo[cacheId] = messages self._writeClassCache(classInfo)
# this duplicates codef from Locale.getTranslation
args = ['-s', '-u', '-x'] + [",".join(self.skip_list)] + [srcPath, targPath]
args = ['-s', '-x'] + [",".join(self.skip_list)] + [srcPath, targPath]
def _copyResources(self, srcPath, targPath): # targPath *has* to be directory -- there is now way of telling a # non-existing target file from a non-existing target directory :-) generator = self #generator._console.debug("_copyResource: %s => %s" % (srcPath, targPath)) copier = copytool.CopyTool(generator._console) a...
resourcePart = Path.getCommonPrefix(libObj._resourcePath, resource)[2]
resourcePart = resource[lib_prefix_len:]
def isSkipFile(f): if [x for x in map(lambda x: re.search(x, f), ignoredFiles) if x!=None]: return True else: return False
input = clippedImages.keys()
input = sorted(clippedImages.keys())
def getClippedImagesDict(imageSpec): "create a dict with the clipped image file path as key, and an ImgInfoFmt object as value" imgDict = {} inputStruct = imageSpec['input'] for group in inputStruct: prefixSpec = group.get('prefix') prefix, altprefix = extractFromPrefixSpec(prefixSpec) if prefix: prefix = self._config....
variantGroup = firstParam.get("value"); if not variantGroup in variantMap.keys(): return False
variantKey = firstParam.get("value"); if not variantKey in variantMap.keys(): return False
def processVariantSelect(callNode, variantMap): ''' processes qx.core.Variant.select blocks; destructive! re-writes the AST tree passed in [callNode] by replacing choices with the suitable branch. ''' if callNode.type != "call": return False params = callNode.getChild("params") if len(params.children) != 2: log("Warni...
if key == variantMap[variantGroup]:
if key == variantMap[variantKey]:
def processVariantSelect(callNode, variantMap): ''' processes qx.core.Variant.select blocks; destructive! re-writes the AST tree passed in [callNode] by replacing choices with the suitable branch. ''' if callNode.type != "call": return False params = callNode.getChild("params") if len(params.children) != 2: log("Warni...
raise RuntimeError(makeLogMessage("Error", "Variantoptimizer: No default case found for (%s:%s) at" % (variantGroup, fullKey), callNode))
raise RuntimeError(makeLogMessage("Error", "Variantoptimizer: No default case found for (%s:%s) at" % (variantKey, fullKey), callNode))
def processVariantSelect(callNode, variantMap): ''' processes qx.core.Variant.select blocks; destructive! re-writes the AST tree passed in [callNode] by replacing choices with the suitable branch. ''' if callNode.type != "call": return False params = callNode.getChild("params") if len(params.children) != 2: log("Warni...
variantGroup = firstParam.get("value"); if not variantGroup in variantMap.keys():
variantKey = firstParam.get("value"); if not variantKey in variantMap.keys():
def processVariantIsSet(callNode, variantMap): ''' processes qx.core.Variant.isSet() calls; destructive! re-writes the AST tree passed in [callNode] by replacing choices with the suitable branch ''' if callNode.type != "call": return False params = callNode.getChild("params") if len(params.children) != 2: log("Warning...
inlineIfStatement(loop, __variantMatchKey(variantValue, variantMap, variantGroup))
inlineIfStatement(loop, __variantMatchKey(variantValue, variantMap, variantKey))
def processVariantIsSet(callNode, variantMap): ''' processes qx.core.Variant.isSet() calls; destructive! re-writes the AST tree passed in [callNode] by replacing choices with the suitable branch ''' if callNode.type != "call": return False params = callNode.getChild("params") if len(params.children) != 2: log("Warning...
if __variantMatchKey(variantValue, variantMap, variantGroup):
if __variantMatchKey(variantValue, variantMap, variantKey):
def processVariantIsSet(callNode, variantMap): ''' processes qx.core.Variant.isSet() calls; destructive! re-writes the AST tree passed in [callNode] by replacing choices with the suitable branch ''' if callNode.type != "call": return False params = callNode.getChild("params") if len(params.children) != 2: log("Warning...
constantNode.set("value", str(__variantMatchKey(variantValue, variantMap, variantGroup)).lower())
constantNode.set("value", str(__variantMatchKey(variantValue, variantMap, variantKey)).lower())
def processVariantIsSet(callNode, variantMap): ''' processes qx.core.Variant.isSet() calls; destructive! re-writes the AST tree passed in [callNode] by replacing choices with the suitable branch ''' if callNode.type != "call": return False params = callNode.getChild("params") if len(params.children) != 2: log("Warning...
default_json = os.path.join('tool', 'default.json')
default_json = 'tool' + '/' + 'default.json'
def CreateNewDemoJson(): source = "" build = "" scategories = {} bcategories = {} fJSON = "./config.demo.new.json" # Pre-processing JSON = open(fJSON,"w") JSON.write('// This file is dynamically created by the generator!\n') JSON.write('{\n') # top-level includes default_json = os.path.join('tool', 'default.json') as...
def getAssets(self, assetMacros=None):
def getAssets(self, assetMacros={}):
def getAssets(self, assetMacros=None):
if res.find('${')>-1 and assetMacros:
if res.find('${')>-1:
def getAssets(self, assetMacros=None):
console.warn("Empty replacement of macro '%s' in asset spec." % themekey)
console.warn("Warning: (%s): Cannot replace macro '%s' in
def expMacRec(rsc): if rsc.find('${')==-1: return [rsc] result = [] nres = rsc[:] mo = re.search(r'\$\{(.*?)\}',rsc) if mo: themekey = mo.group(1) if themekey in assetMacros: # create an array with all possibly variants for this replacement iresult = [] for val in assetMacros[themekey]: iresult.append(nres.replace('${'...
def packagesOfFilesX(fileUri, packages): file = os.path.basename(fileUri) loader_with_boot = self._job.get("packages/loader-with-boot", True) for packageId, package in enumerate(packages): if loader_with_boot: suffix = packageId - 1 if suffix < 0: suffix = "" else: suffix = packageId packageFileName = self._resolveFi...
def packagesOfFiles(fileUri, packages): # returns list of lists, each containing destination file name of the corresp. part # npackages = [['script/gui-0.js'], ['script/gui-1.js'],...] npackages = [] file = os.path.basename(fileUri) if self._job.get("packages/loader-with-boot", True): totalLen = len(packages) else: tot...
bootContent = self.generateBootCode(parts, filepackages, boot, script, compConf, variants, settings, bootPackage, globalCodes, compileType, plugCodeFile, format)
bootContent = generateBootCode(parts, filepackages, boot, script, compConf, variants, settings, bootPackage, globalCodes, compileType, plugCodeFile, format)
def packagesOfFilesX(fileUri, packages): # returns list of lists, each containing destination file name of the corresp. package # npackages = [['script/gui-0.js'], ['script/gui-1.js'],...] file = os.path.basename(fileUri) loader_with_boot = self._job.get("packages/loader-with-boot", True) for packageId, package in enum...
bootContent = self.generateBootCode(parts, filepackages, boot, script, compConf, variants={}, settings={}, bootCode=None, globalCodes=globalCodes, version=compileType, decodeUrisFile=plugCodeFile, format=format)
bootContent = generateBootCode(parts, filepackages, boot, script, compConf, variants={}, settings={}, bootCode=None, globalCodes=globalCodes, version=compileType, decodeUrisFile=plugCodeFile, format=format)
def packagesOfFilesX(fileUri, packages): # returns list of lists, each containing destination file name of the corresp. package # npackages = [['script/gui-0.js'], ['script/gui-1.js'],...] file = os.path.basename(fileUri) loader_with_boot = self._job.get("packages/loader-with-boot", True) for packageId, package in enum...
def generateBootCode(self, parts, packages, boot, script, compConf, variants, settings, bootCode, globalCodes, version="source", decodeUrisFile=None, format=False): def partsMap(script): partData = {} packages = script.packagesSortedSimple() for part in script.parts: partData[part] = script.parts[part].packagesAsI...
def incorporateCombinedImages(filteredResources, combinedImages): for combId, combImg in combinedImages.items(): # combImg.embeds = {resId : ImgFmt} filteredResourceIds = filteredResources.keys() for embId in requiredEmbeds(combImg, filteredResourceIds): # patch simle image info lib = filteredResources[embId].lib ...
self._treeLoader = TreeLoader(self._classes, self._cache, self._console)
def printVariantInfo(variantSetNum, variants, variantSets, variantData): if len(variantSets) < 2: # only log when more than 1 set return variantStr = simplejson.dumps(variants,ensure_ascii=False) self._console.head("Processing variant set %s/%s" % (variantSetNum+1, len(variantSets)))
self._codeGenerator.runPrettyPrinting(classList, self._treeLoader)
self._codeGenerator.runPrettyPrinting(classList, self._classesObj)
def printVariantInfo(variantSetNum, variants, variantSets, variantData): if len(variantSets) < 2: # only log when more than 1 set return variantStr = simplejson.dumps(variants,ensure_ascii=False) self._console.head("Processing variant set %s/%s" % (variantSetNum+1, len(variantSets)))
buildcmd = os.path.join(buildConf["stageDir"], target + "application", "trunk", "demo", "default", "generate.py")
buildcmd += os.path.join(buildConf["stageDir"], target + "application", "trunk", "demo", "default", "generate.py")
def buildSkeletonApps(self, buildConf): self.log("Building skeleton applications") if not os.path.isdir(buildConf["buildLogDir"]): self.log("Creating build log directory %s" %buildConf["buildLogDir"]) os.mkdir(buildConf["buildLogDir"]) for target in sorted(buildConf["targets"]): self.buildStatus[target] = { "BuildErr...
buildcmd = os.path.join(buildConf["stageDir"], target + "application", "generate.py")
buildcmd += os.path.join(buildConf["stageDir"], target + "application", "generate.py")
def buildSkeletonApps(self, buildConf): self.log("Building skeleton applications") if not os.path.isdir(buildConf["buildLogDir"]): self.log("Creating build log directory %s" %buildConf["buildLogDir"]) os.mkdir(buildConf["buildLogDir"]) for target in sorted(buildConf["targets"]): self.buildStatus[target] = { "BuildErr...
def _analyzeClassDepsNode(self, node, loadtime, runtime, inFunction, variants):
def _analyzeClassDepsNode(self, node, loadtime, runtime, inFunction, variants, recurse=True):
def _analyzeClassDepsNode(self, node, loadtime, runtime, inFunction, variants):
console.debug("Looking for rundeps in call to '%s' of '%s'(%d)" % (assembled, self.id, depsItem.line)) console.indent() ldeps = self.getTransitiveDeps(depsItem, variants) loadtime.extend([x for x in ldeps if x not in loadtime]) console.outdent()
if recurse: console.debug("Looking for rundeps in call to '%s' of '%s'(%d)" % (assembled, self.id, depsItem.line)) console.indent() ldeps = self.getTransitiveDeps(depsItem, variants) loadtime.extend([x for x in ldeps if x not in loadtime]) console.outdent()
def _analyzeClassDepsNode(self, node, loadtime, runtime, inFunction, variants):
analyzeNodeDeps (self.tree(variants), classDeps)
analyzeNodeDeps (self.tree(variants), classDeps, False)
def buildShallowDeps(variants):
def analyzeNodeDeps(node, fileDeps):
def analyzeNodeDeps(node, fileDeps, inFunction):
def analyzeNodeDeps(node, fileDeps):
nodeDeps = getNodeDeps(node) fileDeps.data['require'].extend(nodeDeps)
nodeDeps = getNodeDeps(node, inFunction) field = 'use' if inFunction else 'require' fileDeps.data[field].extend(nodeDeps) elif node.type == "body" and node.parent.type == "function": inFunction = True
def analyzeNodeDeps(node, fileDeps):
analyzeNodeDeps (child, fileDeps)
analyzeNodeDeps (child, fileDeps, inFunction)
def analyzeNodeDeps(node, fileDeps):
nodeDeps = getNodeDeps (classMap[tkey][key]) classMapObj.data[tkey][key] = nodeDeps
classMapObj.data[tkey][key] = processValueNode(classMap[tkey][key])
def analyzeClassMap(classMap): classMapObj = ClassMap() for tkey in classMap: if isinstance(classMap[tkey], types.DictType): classMapObj.data[tkey] = {} for key in classMap[tkey]: nodeDeps = getNodeDeps (classMap[tkey][key]) classMapObj.data[tkey][key] = nodeDeps elif isinstance(classMap[tkey], Node): nodeDeps = getN...
nodeDeps = getNodeDeps (classMap[tkey]) classMapObj.data[tkey] = nodeDeps
classMapObj.data[tkey] = processValueNode(classMap[tkey])
def analyzeClassMap(classMap): classMapObj = ClassMap() for tkey in classMap: if isinstance(classMap[tkey], types.DictType): classMapObj.data[tkey] = {} for key in classMap[tkey]: nodeDeps = getNodeDeps (classMap[tkey][key]) classMapObj.data[tkey][key] = nodeDeps elif isinstance(classMap[tkey], Node): nodeDeps = getN...
def getNodeDeps(node): if treeutil.isQxDefine(node)[0]: return []
def getNodeDeps(node, inFunction=True):
def getNodeDeps(node): # make sure we don't dive into class maps, which is handled upstream if treeutil.isQxDefine(node)[0]: return [] ltime = rtime = [] # distinction is in the depsItems that populate this array self._analyzeClassDepsNode(node, ltime, rtime, True, variants) # we force inFunction, to not track recursi...
self._analyzeClassDepsNode(node, ltime, rtime, True, variants)
self._analyzeClassDepsNode(node, ltime, rtime, inFunction, variants, recurse=False)
def getNodeDeps(node): # make sure we don't dive into class maps, which is handled upstream if treeutil.isQxDefine(node)[0]: return [] ltime = rtime = [] # distinction is in the depsItems that populate this array self._analyzeClassDepsNode(node, ltime, rtime, True, variants) # we force inFunction, to not track recursi...
javaClassPath = "-cp "
javaClassPath = "-cp" argv.extend((javaBin, javaClassPath))
def runSimulation(self): self._console.info("Running Simulation...") javaBin = "java" javaClassPath = "-cp " configClassPath = self._job.get("simulate/java-classpath", []) qxSeleniumPath = self._job.get("simulate/qxselenium-path", False) if qxSeleniumPath: configClassPath.append(qxSeleniumPath) classPathSeparator = "...
javaClassPath += classPathSeparator.join(configClassPath)
argv.append(classPathSeparator.join(configClassPath))
def runSimulation(self): self._console.info("Running Simulation...") javaBin = "java" javaClassPath = "-cp " configClassPath = self._job.get("simulate/java-classpath", []) qxSeleniumPath = self._job.get("simulate/qxselenium-path", False) if qxSeleniumPath: configClassPath.append(qxSeleniumPath) classPathSeparator = "...
cmd = "%s %s %s %s" %(javaBin, javaClassPath, rhinoClass, runnerScript)
argv.extend((rhinoClass, runnerScript)) cmd = " ".join(textutil.quoteCommandArgs(argv))
def runSimulation(self): self._console.info("Running Simulation...") javaBin = "java" javaClassPath = "-cp " configClassPath = self._job.get("simulate/java-classpath", []) qxSeleniumPath = self._job.get("simulate/qxselenium-path", False) if qxSeleniumPath: configClassPath.append(qxSeleniumPath) classPathSeparator = "...
raise RuntimeError, "No such job: \"%s\"" % jobname
raise RuntimeError, "No such job: \"%s\"" % jobName
def _resolveExtends(self, jobNames): for jobName in jobNames: job = self.getJob(jobName) if not job: raise RuntimeError, "No such job: \"%s\"" % jobname else: job.resolveExtend(cfg=self) return jobNames # return list unchanged
Selects a node using a XPath like path expresseion.
Selects a node using a XPath like path expression.
def selectNode(node, path): """ Selects a node using a XPath like path expresseion. This function returns None if no matching node was found. Warning: This function usys a depth first search without backtracking!! ".." navigates to the parent node "nodeName" navigates to the first child node of type nodeN...
global cnt depsi = [None] def foo(): deps = buildShallowDeps() depsi[0] = buildTransitiveDeps(deps) cache.writemulti(cacheId, depsi[0]) import cProfile foo() cnt += 1 deps = depsi[0]
deps = buildShallowDeps() deps = buildTransitiveDeps(deps) cache.writemulti(cacheId, deps)
def transitiveDepsAreFresh(depsStruct, cacheModTime): if cacheModTime is None: # TODO: this can currently only occur with a Cache.memcache result return False for dep in depsStruct["load"]: if dep.requestor != self.id: # this was included through a recursive traversal if dep.name in self._classesObj: classObj = self._...
def generateResourceInfoCode(self, script, settings, libs, format=False): def extractAssetPart(libresuri, imguri): pre,libsfx,imgsfx = Path.getCommonPrefix(libresuri, imguri) if imgsfx[0] == os.sep: imgsfx = imgsfx[1:] return imgsfx def addResourceToPackages(script, classToAssetHints, assetId, simpleResVal=None,...
def generateResourceInfoCode(self, script, settings, libs, format=False):
console.warn ("Circular class dependencies")
raise RuntimeError("Circular class dependencies")
def sortClassesRecurser(classId, available, variants, result, path): if classId in result: return
def packagesOfFiles(fileUri, packages): npackages = [] file = os.path.basename(fileUri) if self._job.get("packages/loader-with-boot", True): totalLen = len(packages) else: totalLen = len(packages) + 1 for packageId, packageFileName in enumerate(self.packagesFileNames(file, totalLen, classPackagesOnly=True)): npackages....
def generateBootScript(globalCodes, script, bootPackage="", compileType="build"):
filepackages = packagesOfFiles(fileUri, packages)
filepackages = [(x.file,) for x in packages]
def packagesOfFiles(fileUri, packages): npackages = [] file = os.path.basename(fileUri) if self._job.get("packages/loader-with-boot", True): totalLen = len(packages) else: totalLen = len(packages) + 1 for packageId, packageFileName in enumerate(self.packagesFileNames(file, totalLen, classPackagesOnly=True)): npackages....
loadPackage = Package(0) loadPackage.compiled = loaderCode packages.insert(0, loadPackage) for package, fileName in zip(packages, self.packagesFileNames(script.baseScriptPath, len(packages))): package.file = fileName
packages[0].compiled = loaderCode
def mergeTranslationMaps(transMaps): poData = {} cldrData = {}
package.hash = hash
if self._job.get("compile-options/paths/scripts-add-hash", False): package.file = self._fileNameWithHash(package.file, package.hash)
def generateI18NParts(self, script, globalCodes):
filetool.save(approot+"/data/resource/" + res + ".json", json.dumpsCode(resinfo)) return
return resinfo
def createResourceInfo(res, resval): resinfo = [ { "target": "resource", "data": { res : resval }} ] filetool.save(approot+"/data/resource/" + res + ".json", json.dumpsCode(resinfo)) return
createResourceInfo(res, allresources[res])
resinfos[res] = createResourceInfo(res, allresources[res])
def copyResource(res): filetool.directory(approot+"/resource/"+os.path.dirname(res)) shutil.copy("source/resource/"+res, approot+"/resource/"+res) return
Optionally, a dictionary containing library/directory names as keys and a list of library version names/subdirectories can be provided, e.g. myRepo = Repository("/foo/bar", { "Simulator" : ["trunk"], "HtmlArea" : ["0.5"] })
Optionally, specific libraries or versions thereof can be selected using a configuration dictionary - see config.demo.json in the contrib demobrowser for an example.
def __init__(self, repoDir, config=None): """Create a new repository instance by scanning a directory containing qooxdoo libraries. By default, all libraries found will be included. Optionally, a dictionary containing library/directory names as keys and a list of library version names/subdirectories can be provided, e....
console.indent()
def getLibraries(self, processLibs): console.info("Processing repository in %s" %self.dir) libraries = {} for root, dirs, files in os.walk(self.dir, topdown=True): for name in dirs[:]: # ignore subdirectories and SVN cruft if root != self.dir or name[0] == ".": dirs.remove(name) console.outdent() continue # only proce...
console.outdent()
def getLibraries(self, processLibs): console.info("Processing repository in %s" %self.dir) libraries = {} for root, dirs, files in os.walk(self.dir, topdown=True): for name in dirs[:]: # ignore subdirectories and SVN cruft if root != self.dir or name[0] == ".": dirs.remove(name) console.outdent() continue # only proce...
libraries[name] = lib console.outdent()
libraries[name] = lib
def getLibraries(self, processLibs): console.info("Processing repository in %s" %self.dir) libraries = {} for root, dirs, files in os.walk(self.dir, topdown=True): for name in dirs[:]: # ignore subdirectories and SVN cruft if root != self.dir or name[0] == ".": dirs.remove(name) console.outdent() continue # only proce...
status = {"buildError" : False}
status = version.buildDemo(variant, demoVersion)
def buildAllDemos(self, demoVersion="build", demoBrowser=None): demoData = [] for libraryName in self.libraries: library = self.libraries[libraryName] libraryData = { "classname": libraryName, "tests": [] } validDemo = False for versionName in library.versions: version = library.versions[versionName] if not version.h...
def __init__(self, repository = None, libraryDir = None, libraryVersions = [] ):
def __init__(self, repository = None, libraryDir = None, restrictions = None):
def __init__(self, repository = None, libraryDir = None, libraryVersions = [] ): if not (libraryDir and repository): raise RuntimeError, "Repository and library directory must be defined!" self.repository = repository self.dir = libraryDir self.path = os.path.join(self.repository.dir, self.dir) self.versions = self.get...
self.versions = self.getVersions(libraryVersions) def getVersions(self, libraryVersions):
self.versions = self.getVersions(restrictions) def getVersions(self, restrictions):
def __init__(self, repository = None, libraryDir = None, libraryVersions = [] ): if not (libraryDir and repository): raise RuntimeError, "Repository and library directory must be defined!" self.repository = repository self.dir = libraryDir self.path = os.path.join(self.repository.dir, self.dir) self.versions = self.get...
if len(libraryVersions) > 0 and not libraryVersions[0] == "*": if name in libraryVersions: console.info("Processing selected version %s" %name) try: libVersion = LibraryVersion(self, name) versions[name] = libVersion except Exception, e: console.warn("%s version %s not added: %s" %(self.dir,name,e.message)) elif name =...
if self.isValidVersion(name, libraryPath, restrictions): console.info("Processing library version %s" %name)
def getVersions(self, libraryVersions): 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] == ".": dir...
configJson = statusFile.read()
configJson = configFile.read()
def main(): (options,args) = getComputedConf() config = None if options.configfile: configFile = codecs.open(options.configfile, 'r', 'utf-8') configJson = statusFile.read() config = json.loads(configJson) repository = Repository(options.workdir, config) if options.joblist: jobs = options.joblist.split(",") for job ...
if (className and className in self._classesObj and className != fileId and self.context['jobconf'].get("dependencies/follow-static-initializers", False) and node.hasParentContext("keyvalue/value/call/operand")
if (className and className in self._classesObj and className != fileId and self.context['jobconf'].get("dependencies/follow-static-initializers", False) and ( node.hasParentContext("keyvalue/value/call/operand") or node.hasParentContext("keyvalue/value/instantiation/expression/call/operand") )
def followCallDeps(self, node, fileId, className): if (className and className in self._classesObj and # we have a class id className != fileId and self.context['jobconf'].get("dependencies/follow-static-initializers", False) and #node.hasParentContext("call/operand") # it's a method call node.hasParentContext("...
match = re.compile("\/viewvc\/qooxdoo-contrib\?view\=rev\&amp;revision\=([0-9]+)").search(line)
match = self.revisionpatt.search(line)
def getRevision(self, contrib): # returns: (updatedFromInternet?, currentRevision) rev_url = "http://qooxdoo-contrib.svn.sourceforge.net/viewvc/qooxdoo-contrib/trunk/qooxdoo-contrib/%s/" % contrib data = urllib.urlopen(rev_url) for line in data: match = re.compile("\/viewvc\/qooxdoo-contrib\?view\=rev\&amp;revision\=([...
depsItem = DependencyItem(className, classAttribute, self.id, node.get('line', -1))
depsItem = DependencyItem(className, classAttribute, self.id, node.get('line', -1), isLoadDep=not inFunction)
def _analyzeClassDepsNode(self, node, loadtime, runtime, inFunction, variants, recurse=True):
def findClassForMethod(clazzId, methodId, variants): def classHasOwnMethod(classAttribs, methId): candidates = {} candidates.update(classAttribs.get("members",{})) candidates.update(classAttribs.get("statics",{})) if "construct" in classAttribs: candidates.update(dict((("construct", classAttribs.get("construct")),))) ...
def getTransitiveDeps(self, depsItem, variants):
defClassId, attribNode = findClassForMethod(classId, methodId, variants)
defClassId, attribNode = self.findClassForMethod(classId, methodId, variants)
def getTransitiveDepsR(dependencyItem, variants, totalDeps): # We don't add the in-param to the global result classId = dependencyItem.name methodId= dependencyItem.attribute
resultAdd(defDepsItem, localDeps)
self.resultAdd(defDepsItem, localDeps)
def getTransitiveDepsR(dependencyItem, variants, totalDeps): # We don't add the in-param to the global result classId = dependencyItem.name methodId= dependencyItem.attribute
if resultAdd(depsItem, localDeps):
if self.resultAdd(depsItem, localDeps):
def getTransitiveDepsR(dependencyItem, variants, totalDeps): # We don't add the in-param to the global result classId = dependencyItem.name methodId= dependencyItem.attribute
def dependencies1(self, variants):
def dependencies2(self, variants):
def dependencies1(self, variants):
result.add(dep)
if dep.name not in map(attrgetter("name"),result): result.add(dep)
def getLoadDeps(clsDepsObj): result = set(clsDepsObj.data['require']) if not "auto-require" in (x.name for x in clsDepsObj.data['ignore']): for dep in clsDepsObj.dependencyIterator(): if dep.isLoadDep: if dep in clsDepsObj.data['optional']: pass elif dep in clsDepsObj.data['require']: console.warn("%s: #require(%s) is ...
elif dep in loadDeps:
elif dep.name in map(attrgetter("name"),loadDeps):
def getRunDeps(clsDepsObj, loadDeps=[]): result = set(clsDepsObj.data ['use']) if not "auto-use" in (x.name for x in clsDepsObj.data ['ignore']): for dep in clsDepsObj.dependencyIterator (): if not dep.isLoadDep: if dep in clsDepsObj.data ['optional']: pass elif dep in loadDeps: pass elif dep in clsDepsObj.data ['use']...
result.add(dep)
if dep.name not in map(attrgetter("name"),result): result.add(dep)
def getRunDeps(clsDepsObj, loadDeps=[]): result = set(clsDepsObj.data ['use']) if not "auto-use" in (x.name for x in clsDepsObj.data ['ignore']): for dep in clsDepsObj.dependencyIterator (): if not dep.isLoadDep: if dep in clsDepsObj.data ['optional']: pass elif dep in loadDeps: pass elif dep in clsDepsObj.data ['use']...
recdeps = self.getTransitiveDeps1(dep)
recdeps = self.getTransitiveDeps1(dep, variants)
def getRunDeps(clsDepsObj, loadDeps=[]): result = set(clsDepsObj.data ['use']) if not "auto-use" in (x.name for x in clsDepsObj.data ['ignore']): for dep in clsDepsObj.dependencyIterator (): if not dep.isLoadDep: if dep in clsDepsObj.data ['optional']: pass elif dep in loadDeps: pass elif dep in clsDepsObj.data ['use']...
def getTransitiveDepsR(depsItem, variants, totalDeps):
def getTransitiveDepsR(dependencyItem, variants, totalDeps):
def getTransitiveDepsR(depsItem, variants, totalDeps): # We don't add the in-param to the global result classId = dependencyItem.name methodId= dependencyItem.attribute
mydeps = set()
dependItem = copy.copy(dependencyItem) dependItem.isLoadDep = True mydeps = set((dependItem,))
def getTransitiveDepsR(depsItem, variants, totalDeps): # We don't add the in-param to the global result classId = dependencyItem.name methodId= dependencyItem.attribute
defClassId, attribNode = findClassForMethod(classId, methodId, variants)
defClassId, attribNode = self.findClassForMethod(classId, methodId, variants)
def getTransitiveDepsR(depsItem, variants, totalDeps): # We don't add the in-param to the global result classId = dependencyItem.name methodId= dependencyItem.attribute
defDepsItem = DependencyItem(defClassId, methodId, classId) if defClassId != classId: resultAdd(defDepsItem, mydeps)
if defClassId != classId: defDepsItem = DependencyItem(defClassId, methodId, classId, isLoadDep=True) else: defDepsItem = dependItem
def getTransitiveDepsR(depsItem, variants, totalDeps): # We don't add the in-param to the global result classId = dependencyItem.name methodId= dependencyItem.attribute
shallowDeps = defClassObj.shallowdeps() methodDeps = shallowDeps.getAttributeDeps(methodId)
shallowDeps, _ = defClassObj.shallowDependencies(variants) methodDeps = shallowDeps.getAttributeDeps(defClassId + '
def getTransitiveDepsR(depsItem, variants, totalDeps): # We don't add the in-param to the global result classId = dependencyItem.name methodId= dependencyItem.attribute
rdeps = getTransitiveDepsR(depsItem, variants)
rdeps = getTransitiveDepsR(depsItem, variants, totalDeps)
def getTransitiveDepsR(depsItem, variants, totalDeps): # We don't add the in-param to the global result classId = dependencyItem.name methodId= dependencyItem.attribute
def processValueNode(node):
def processValueNode(valuenode):
def processValueNode(node): # this is actually better than the checks from followCallDeps() # TODO: recursive deps: every call that is not inFunction!? inFunction = True if node.type == "function" else False nodedeps = getNodeDeps (node, inFunction) return nodedeps
data = data['classes'][classId]
data = data['classes'][classId].data
def getAttributeDeps(self, attrib): # attrib="qx.Class#define" res = None data = self.data # top level if attrib.find('#')== -1: res = data[attrib] # class map else: classId, attribId = attrib.split('#', 1) data = data['classes'][classId] if attribId in data: res = data[attribId] else: for submap in ('statics', 'memb...
def buildAllDemos(self, selectedVariant=None):
def buildAllDemos(self):
def buildAllDemos(self, selectedVariant=None): demoData = [] if self.config: if "demobrowser" in self.config: demoBrowser = True for libraryName in self.libraries: library = self.libraries[libraryName] libraryData = { "classname": libraryName, "tests": [] } validDemo = False for versionName in library.versions: versio...
if (selectedVariant and selectedVariant != variant) or (variant == "source" or variant == "build"):
if variant == "source" or variant == "build":
def buildAllDemos(self, selectedVariant=None): demoData = [] if self.config: if "demobrowser" in self.config: demoBrowser = True for libraryName in self.libraries: library = self.libraries[libraryName] libraryData = { "classname": libraryName, "tests": [] } validDemo = False for versionName in library.versions: versio...
cacheId = "messages-%s-%s" % (self.path, variantsId)
cacheId = "messages-%s" % (variantsId,)
# this duplicates codef from Locale.getTranslation
if hint.regex.search(res.id):
if hint.regex.match(res.id):
def mapResourcesToClasses(self, libs, classes): # Resource list resources = [] for libObj in libs: resources.extend(libObj.getResources()) # weightedness of same res id through order of script.libraries # remove unwanted files exclpatt = re.compile("\.(?:meta|py)$", re.I) for res in resources[:]: if exclpatt.search(re...
if hint.regex.search(embed.id):
if hint.regex.match(embed.id):
def mapResourcesToClasses(self, libs, classes): # Resource list resources = [] for libObj in libs: resources.extend(libObj.getResources()) # weightedness of same res id through order of script.libraries # remove unwanted files exclpatt = re.compile("\.(?:meta|py)$", re.I) for res in resources[:]: if exclpatt.search(re...
tempPath = os.path.normpath(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"
copier.parse_args(['-c', '-s', '-x', '.svn', srcPath, targPath])
args = ['-c', '-s', '-x'] + [",".join(self.skip_list)] + [srcPath, targPath] copier.parse_args(args)
def _copyResources(self, srcPath, targPath): # targPath *has* to be directory -- there is now way of telling a # non-existing target file from a non-existing target directory :-) generator = self #generator._console.debug("_copyResource: %s => %s" % (srcPath, targPath)) copier = robocopy.PyRobocopier(generator._consol...
copier = robocopy.PyRobocopier(generator._console) args = ['-c', '-s', '-x'] + [",".join(self.skip_list)] + [srcPath, targPath]
copier = copytool.CopyTool(generator._console) args = ['-s', '-u', '-x'] + [",".join(self.skip_list)] + [srcPath, targPath]
def _copyResources(self, srcPath, targPath): # targPath *has* to be directory -- there is now way of telling a # non-existing target file from a non-existing target directory :-) generator = self #generator._console.debug("_copyResource: %s => %s" % (srcPath, targPath)) #copier = copytool.CopyTool(generator._console) ...
self.config = config
def __init__(self, repoDir, config=None): """Create a new repository instance by scanning a directory containing qooxdoo libraries. By default, all libraries found will be included. Optionally, a dictionary containing library/directory names as keys and a list of library version names/subdirectories can be provided, e....
self.dir = os.path.join(os.getcwd(), self.dir)
self.dir = os.path.abspath(self.dir)
def __init__(self, repoDir, config=None): """Create a new repository instance by scanning a directory containing qooxdoo libraries. By default, all libraries found will be included. Optionally, a dictionary containing library/directory names as keys and a list of library version names/subdirectories can be provided, e....
def buildAllDemos(self):
def buildAllDemos(self, demoVersion="build", demoBrowser=False):
def buildAllDemos(self): demoData = [] if self.config: if "demobrowser" in self.config: demoBrowser = True for libraryName in self.libraries: library = self.libraries[libraryName] libraryData = { "classname": libraryName, "tests": [] } validDemo = False for versionName in library.versions: version = library.versions[v...
if self.config: if "demobrowser" in self.config: demoBrowser = True
def buildAllDemos(self): demoData = [] if self.config: if "demobrowser" in self.config: demoBrowser = True for libraryName in self.libraries: library = self.libraries[libraryName] libraryData = { "classname": libraryName, "tests": [] } validDemo = False for versionName in library.versions: version = library.versions[v...
status = version.buildDemo(variant)
status = version.buildDemo(variant, demoVersion)
def buildAllDemos(self): demoData = [] if self.config: if "demobrowser" in self.config: demoBrowser = True for libraryName in self.libraries: library = self.libraries[libraryName] libraryData = { "classname": libraryName, "tests": [] } validDemo = False for versionName in library.versions: version = library.versions[v...