Skip to content

Commit

Permalink
Fix os.rename() Windows issue. Add comptability with LP 2.25.15-19
Browse files Browse the repository at this point in the history
  • Loading branch information
Paolo Prete committed Aug 26, 2024
1 parent abcb8b6 commit be69a8c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
2 changes: 2 additions & 0 deletions NEWS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions lib/python/spontini_server_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down
5 changes: 5 additions & 0 deletions lib/supported_lilyponds.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion lib/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.30_pre_alfa
1.30_alfa

0 comments on commit be69a8c

Please sign in to comment.