Example #1
0
def adjustPath(currentFileName, referencedFileName):
	currentFileName = normalizeFileName(currentFileName)
	referencedFileName = normalizeFileName(referencedFileName)

	adjustedPath=""

	shouldLeaveAsAbsolute = referencedFileName.startswith("/")
	shouldLeaveAsAbsolute = referencedFileName.startswith("/") or (("/" in referencedFileName) and not(referencedFileName.startswith("../")))

	if ( shouldLeaveAsAbsolute ):
		adjustedPath=referencedFileName
	else:
		currentPath=currentFileName.split("/")
		currentPath=currentPath[0:len(currentPath)-1]

		referencedFilePath=referencedFileName.split("/")
		mereReferencedFileName=referencedFilePath[len(referencedFilePath)-1]
		referencedFilePath=referencedFilePath[0:len(referencedFilePath)-1]

		for pathElement in referencedFilePath:
			if ( pathElement == ".." ):
				# if we can still peal of one directory from the currentPath
				if ( not(not currentPath) ):
					currentPath=currentPath[0:len(currentPath)-1]
				else:
					currentPath.append("..")
			else:
				currentPath.append(pathElement)

		for pathElement in currentPath:
			adjustedPath+=pathElement+"/"

		adjustedPath+=mereReferencedFileName

	return adjustedPath
Example #2
0
    def add(self, absoluteFilePath):
        normalizedFilePath = normalizeFileName(absoluteFilePath)
        if not normalizedFilePath in self.list:
            self.list.append(normalizedFilePath)
            return True

        return False
Example #3
0
	def add(self, absoluteFilePath):
		normalizedFilePath = normalizeFileName(absoluteFilePath)
		if not normalizedFilePath in self.list:
			self.list.append(normalizedFilePath)
			return True

		return False
Example #4
0
	def getIncludedFiles(self, includingFile):
		includedFiles = []

		normalizedIncludingFile=normalizeFileName(includingFile)

		if ( normalizedIncludingFile in self.dict ):
			includedFiles = self.dict[normalizedIncludingFile]

		return includedFiles
Example #5
0
    def getIncludedFiles(self, includingFile):
        includedFiles = []

        normalizedIncludingFile = normalizeFileName(includingFile)

        if (normalizedIncludingFile in self.dict):
            includedFiles = self.dict[normalizedIncludingFile]

        return includedFiles
Example #6
0
    def getTransitiveIncludedFiles(self, includingFile):
        includedFiles = []
        normalizedIncludingFile = normalizeFileName(includingFile)

        if (normalizedIncludingFile in self.dict):
            includedFiles = self.dict[normalizedIncludingFile]

        if not (includingFile in includedFiles):
            includedFiles.append(normalizedIncludingFile)

        return includedFiles
Example #7
0
	def getTransitiveIncludedFiles(self, includingFile):
		includedFiles = []
		normalizedIncludingFile=normalizeFileName(includingFile)

		if ( normalizedIncludingFile in self.dict ):
			includedFiles = self.dict[normalizedIncludingFile]

		if not( includingFile in includedFiles ):
			includedFiles.append(normalizedIncludingFile)


		return includedFiles
Example #8
0
def adjustPath(currentFileName, referencedFileName):
    currentFileName = normalizeFileName(currentFileName)
    referencedFileName = normalizeFileName(referencedFileName)

    adjustedPath = ""

    shouldLeaveAsAbsolute = referencedFileName.startswith("/")
    shouldLeaveAsAbsolute = referencedFileName.startswith("/") or (
        ("/" in referencedFileName)
        and not (referencedFileName.startswith("../")))

    if (shouldLeaveAsAbsolute):
        adjustedPath = referencedFileName
    else:
        currentPath = currentFileName.split("/")
        currentPath = currentPath[0:len(currentPath) - 1]

        referencedFilePath = referencedFileName.split("/")
        mereReferencedFileName = referencedFilePath[len(referencedFilePath) -
                                                    1]
        referencedFilePath = referencedFilePath[0:len(referencedFilePath) - 1]

        for pathElement in referencedFilePath:
            if (pathElement == ".."):
                # if we can still peal of one directory from the currentPath
                if (not (not currentPath)):
                    currentPath = currentPath[0:len(currentPath) - 1]
                else:
                    currentPath.append("..")
            else:
                currentPath.append(pathElement)

        for pathElement in currentPath:
            adjustedPath += pathElement + "/"

        adjustedPath += mereReferencedFileName

    return adjustedPath
Example #9
0
	def add(self, includingFile, includedFile):
		if ( includingFile == None ) or ( includedFile == None ):
			self.log.error("Preconditions violated: ",[includingFile,includedFile])
			return False

		added = False

		normalizedIncludingFile=normalizeFileName(includingFile)
		adjustedIncludedFile=adjustPath(normalizedIncludingFile,includedFile)

		if not(normalizedIncludingFile in self.dict) :
			self.dict[normalizedIncludingFile]=[]

		if not (adjustedIncludedFile in self.dict[normalizedIncludingFile]):
			self.dict[normalizedIncludingFile].append(adjustedIncludedFile)
			added = True

		return added
Example #10
0
    def add(self, includingFile, includedFile):
        if (includingFile == None) or (includedFile == None):
            self.log.error("Preconditions violated: ",
                           [includingFile, includedFile])
            return False

        added = False

        normalizedIncludingFile = normalizeFileName(includingFile)
        adjustedIncludedFile = adjustPath(normalizedIncludingFile,
                                          includedFile)

        if not (normalizedIncludingFile in self.dict):
            self.dict[normalizedIncludingFile] = []

        if not (adjustedIncludedFile in self.dict[normalizedIncludingFile]):
            self.dict[normalizedIncludingFile].append(adjustedIncludedFile)
            added = True

        return added
Example #11
0
	def hasKey(self, fileName):
		normalizedFileName=normalizeFileName(fileName)
		return (normalizedFileName in self.dict )
Example #12
0
	def getTransitiveIncludedFiles(self, includingFile):
		includedFiles = []
		normalizedIncludingFile=normalizeFileName(includingFile)
		self.getTransitiveIncludedFilesInternal(normalizedIncludingFile, includedFiles)
		return includedFiles
Example #13
0
 def hasKey(self, fileName):
     normalizedFileName = normalizeFileName(fileName)
     return (normalizedFileName in self.dict)
Example #14
0
 def getTransitiveIncludedFiles(self, includingFile):
     includedFiles = []
     normalizedIncludingFile = normalizeFileName(includingFile)
     self.getTransitiveIncludedFilesInternal(normalizedIncludingFile,
                                             includedFiles)
     return includedFiles