From be69a8c63365c6117ac7669b14c7d4798c574fda Mon Sep 17 00:00:00 2001 From: Paolo Prete Date: Mon, 26 Aug 2024 19:41:34 +0200 Subject: [PATCH] Fix os.rename() Windows issue. Add comptability with LP 2.25.15-19 --- NEWS.txt | 2 ++ lib/python/spontini_server_core.py | 10 +++++----- lib/supported_lilyponds.txt | 5 +++++ lib/version.txt | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/NEWS.txt b/NEWS.txt index 328b49e..365d967 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -2,6 +2,8 @@ Version 1.30 -------------- * Added autoformat/indent +* Fix os.rename() Windows issue +* Compatible with LilyPond 2.25.15 to 2.25.19 -------------- Version 1.25 diff --git a/lib/python/spontini_server_core.py b/lib/python/spontini_server_core.py index 9786b60..3ce3970 100644 --- a/lib/python/spontini_server_core.py +++ b/lib/python/spontini_server_core.py @@ -163,7 +163,7 @@ def addMaskToPdf(mask, pdf): maskPdf.stream.close() generatedPdf.stream.close() os.remove(pdf) - os.rename(pdf+"BAK", pdf) + os.replace(pdf+"BAK", pdf) def executeScript(clientInfo, scriptFile): @@ -445,7 +445,7 @@ def removeFilteredTknFromOutputFiles(fileName): checkIfIsChildFile(currFile, fileName, ".pdf") or \ checkIfIsChildFile(currFile, fileName, ".midi"): currFileRenamed = currFile[::-1].replace('DERETLIF-', '', 1)[::-1] - os.rename(os.path.join(wsDirPath, currFile), os.path.join(wsDirPath, currFileRenamed)) + os.replace(os.path.join(wsDirPath, currFile), os.path.join(wsDirPath, currFileRenamed)) try: os.remove(os.path.join(wsDirPath, fileName)) except: @@ -621,7 +621,7 @@ def doPostSync(message, request): if param3.strip() != "pdf": for currFile in os.listdir(wsDirPath): if checkIfIsChildFile(currFile, inputFileName, ".svg") or checkIfIsChildFile(currFile, inputFileNameNotFiltered, ".svg"): - os.rename(os.path.join(wsDirPath, currFile), + os.replace(os.path.join(wsDirPath, currFile), os.path.join(wsDirPath, currFile.replace(".svg", ".ljssvgswap"))) global lilyExecutableCmd @@ -677,7 +677,7 @@ def doPostSync(message, request): else: for currFile in os.listdir(wsDirPath): if checkIfIsChildFile(currFile, inputFileName, ".ljssvgswap") : - os.rename(os.path.join(wsDirPath, currFile), + os.replace(os.path.join(wsDirPath, currFile), os.path.join(wsDirPath, currFile.replace(".ljssvgswap", ".svg"))) status = "KO" log(clientInfo + p.stdout, "E") @@ -1186,7 +1186,7 @@ def doPostSync(message, request): except: pass - os.rename(os.path.join(wsDirPath, fileNameWOSuffix+"-cpy.pdf"), os.path.join(wsDirPath, fileNameWOSuffix+"-svgexport.pdf")) + os.replace(os.path.join(wsDirPath, fileNameWOSuffix+"-cpy.pdf"), os.path.join(wsDirPath, fileNameWOSuffix+"-svgexport.pdf")) log(clientInfo + "[generating PDF] Generated: " + os.path.join(wsDirPath, fileNameWOSuffix+"-svgexport.pdf"), "S") return sendCompleteResponse("OK") diff --git a/lib/supported_lilyponds.txt b/lib/supported_lilyponds.txt index 1b0c52c..30f2c3d 100644 --- a/lib/supported_lilyponds.txt +++ b/lib/supported_lilyponds.txt @@ -48,6 +48,11 @@ 2.25.12 2.25.13 2.25.14 +2.25.15 +2.25.16 +2.25.17 +2.25.18 +2.25.19 2.24.1 2.24.2 2.24.3 diff --git a/lib/version.txt b/lib/version.txt index 70d0d13..d0ec56e 100644 --- a/lib/version.txt +++ b/lib/version.txt @@ -1 +1 @@ -1.30_pre_alfa +1.30_alfa