Skip to content

Commit ddefc07

Browse files
committed
source and destinationPath can change during post processes
1 parent 804fdb4 commit ddefc07

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

Batch.roboFontExt/lib/batchGenerators/batchTools.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ def __call__(self, sourcePath, destinationPath):
156156
newSourceDestinationPath = callback(sourcePath, destinationPath)
157157
if newSourceDestinationPath:
158158
sourcePath, destinationPath = newSourceDestinationPath
159+
return sourcePath, destinationPath
159160

160161
def __del__(self):
161162
self.callbacks = None
@@ -257,11 +258,11 @@ def generatePaths(
257258
)
258259
sourcePath = os.path.join(fontDir, tempFileName)
259260
destinationPath = os.path.join(fontDir, fileName)
260-
postProcessCallback(
261+
sourcePath, destinationPath = postProcessCallback(
261262
sourcePath,
262263
destinationPath
263264
)
264-
if os.path.exists(sourcePath):
265+
if os.path.exists(sourcePath) and sourcePath != destinationPath:
265266
shutil.copyfile(sourcePath, destinationPath)
266267
os.remove(sourcePath)
267268

Batch.roboFontExt/lib/batchGenerators/variableFontsGenerator/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,11 +429,11 @@ def build(root, generateOptions, settings, progress, report):
429429

430430
sourcePath = os.path.join(fontDir, tempFileName)
431431
destinationPath = os.path.join(fontDir, fileName)
432-
postProcessCallback(
432+
sourcePath, destinationPath = postProcessCallback(
433433
sourcePath,
434434
destinationPath
435435
)
436-
if os.path.exists(sourcePath):
436+
if os.path.exists(sourcePath) and sourcePath != destinationPath:
437437
shutil.copyfile(sourcePath, destinationPath)
438438
os.remove(sourcePath)
439439

Batch.roboFontExt/lib/batchGenerators/webFontsGenerator/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
cssFormatExtMap = {
1818
".otf": "opentype",
1919
".ttf": "truetype",
20-
".woff": "woff"
20+
".woff": "woff",
21+
".woff2": "woff2"
2122

2223
}
2324

0 commit comments

Comments
 (0)