X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2F__init__.py;h=9a4a846ed54b7d8bce23b4609cd9e062f45a2cc0;hb=7366f56ee2827c206d480bae8d40c25eb292b89a;hp=a45cbc53548306eed3051d67056251f0cedc2616;hpb=107552854ce17709e5953955d2514079a72035e6;p=tools%2Fsat.git diff --git a/src/__init__.py b/src/__init__.py index a45cbc5..9a4a846 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -55,8 +55,13 @@ KNOWNFAILURE_STATUS = "KF" TIMEOUT_STATUS = "TIMEOUT" class SatException(Exception): - """rename Exception Class""" - pass + """sat exception class""" + def message(self, arg): + if sys.version_info[0] >= 3: + # message method is not available for python 3.8+ + return super().msg(arg) + else: + return super(SatException,self).message(arg) def ensure_path_exists(p): """Create a path if not existing @@ -451,7 +456,7 @@ def find_file_in_lpath(file_name, lpath, additional_dir = ""): return os.path.join(dir_complete, file_name) return False -def find_file_in_ftppath(file_name, ftppath, installation_dir, logger): +def find_file_in_ftppath(file_name, ftppath, installation_dir, logger, additional_dir = ""): """\ Find in all ftp servers in ftppath the file called file_name If it is found then return the destination path of the file @@ -490,8 +495,20 @@ def find_file_in_ftppath(file_name, ftppath, installation_dir, logger): for directory in ftp_archive_split[1:]: logger.write(" Change directory to %s\n" % directory, 3) ftp.cwd(directory) + if additional_dir: + ftp.cwd(additional_dir) except: logger.error("while connecting to ftp server %s\n" % ftp_server) + continue + + try: # get md5 file if it exists + file_name_md5=file_name + ".md5" + destination_md5=destination + ".md5" + if ftp.size(file_name_md5) > 0: + with open(destination_md5,'wb') as dest_file_md5: + ftp.retrbinary("RETR "+file_name_md5, dest_file_md5.write) + except: + pass try: if ftp.size(file_name) > 0: @@ -502,7 +519,6 @@ def find_file_in_ftppath(file_name, ftppath, installation_dir, logger): return destination except: logger.error("File not found in ftp_archive %s\n" % ftp_server) - pass return False