Commit 0b94b421 authored by Daniel Armbruster's avatar Daniel Armbruster Committed by thomas.forbriger
Browse files

correction

This is a legacy commit from before 2015-05-18.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 4385
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent f070f15e
......@@ -85,7 +85,7 @@ def getSubDirectories(path, regexes, followLinks=False):
matching = set(dir for dir in subDirs if None != re.match(regex, dir))
subDirs -= matching
except OSError as err:
raise CsFileError(83, "[Errno "+str(err.errno)+"] "+err.strerror+": " \
raise CsFileError(88, "[Errno "+str(err.errno)+"] "+err.strerror+": " \
+err.filename)
else:
return subDirs
......@@ -133,7 +133,7 @@ class CsFile:
Read a checksumfile.
"""
if not os.access(self.filedir, os.F_OK):
raise CsFileError(134, "Invalid directory path.")
raise CsFileError(136, "Invalid directory path.")
path = os.path.join(self.filedir, BASENAME+CSSUFFIX)
# no checksumfile available -> create new file
if os.access(self.filedir, os.F_OK) and not os.path.isfile(path):
......@@ -141,7 +141,7 @@ class CsFile:
try:
csfile = open(path, 'w')
except IOError as err:
raise CsFileError(142, "[Errno "+str(err.errno)+"] "+err.strerror+": " \
raise CsFileError(144, "[Errno "+str(err.errno)+"] "+err.strerror+": " \
+err.filename)
else:
csfile.close()
......@@ -153,7 +153,7 @@ class CsFile:
self.__cslines = [CsLine(line.split(), self.srcdir) \
for line in csfile if len(line.rstrip()) and line[0] != '#']
except IOError as err:
raise CsFileError(154, "[Errno "+str(err.errno)+"] "+err.strerror+": " \
raise CsFileError(156, "[Errno "+str(err.errno)+"] "+err.strerror+": " \
+err.filename)
else:
csfile.close()
......@@ -175,9 +175,9 @@ class CsFile:
if isinstance(csline, CsLine):
csfile.write(str(csline) + '\n')
else:
raise CsFileError(197, "Argument must be of type CsLine.")
raise CsFileError(178, "Argument must be of type CsLine.")
except IOError as err:
raise CsFileError(199, "[Errno "+str(err.errno)+"] "+err.strerror+": " \
raise CsFileError(180, "[Errno "+str(err.errno)+"] "+err.strerror+": " \
+err.filename)
else:
self.logger.debug("Finished appending to checksumfile '%s'", path)
......@@ -189,7 +189,7 @@ class CsFile:
checksum file in current directory.
"""
if not isinstance(regexes, list):
raise CsFileError(211, "Pass regular expressions in a list.")
raise CsFileError(192, "Pass regular expressions in a list.")
self.logger.debug("Updating checksumfile ...")
# fetch cslines in current csfile
self.read()
......@@ -201,13 +201,15 @@ class CsFile:
if os.path.isfile(os.path.join(self.srcdir, file)))
# exclude files matching regexes
regexes.append(BASENAME+CSSUFFIX)
regexes.append(BASENAME+RESULTSUFFIX+r'\.[1-2]'|BASENAME+RESULTSUFFIX)
regexes.append(BASENAME+RESULTSUFFIX)
regexes.append(BASENAME+RESULTSUFFIX+r'\.[1-2]')
for regex in regexes:
matching = set(file for file in newFiles \
if None != re.match(regex, file))
newFiles -= matching
regexes.remove(BASENAME+CSSUFFIX)
regexes.remove(BASENAME+RESULTSUFFIX+r'\.[1-2]'|BASENAME+RESULTSUFFIX)
regexes.append(BASENAME+RESULTSUFFIX)
regexes.remove(BASENAME+RESULTSUFFIX+r'\.[1-2]')
# exclude registered files
newFiles -= registeredFiles
# generate cslines of newFiles
......@@ -307,7 +309,7 @@ class CsLine:
self.creationLocationChecksum = ''
self.creationDateChecksum = ''
else:
CsFileError(325, "Invalid argument(s).")
CsFileError(312, "Invalid argument(s).")
def generate(self, chunkSize):
"""
......@@ -327,7 +329,7 @@ class CsLine:
data = file.read(blockSize)
self.checksum = hashfunc.hexdigest()
except IOError as err:
raise CsFileError(344, "[Errno "+str(err.errno)+"] "+err.strerror+": " \
raise CsFileError(332, "[Errno "+str(err.errno)+"] "+err.strerror+": " \
+err.filename)
else:
file.close()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment