Skip to content

Commit 14a2524

Browse files
Francois Budinthewtex
authored andcommitted
BUG: Missing binary Examples folder
`RunExamples` has been moved from `ITKSoftwareGuide/SoftwareGuide/Examples` to a CMake `ExternalProject_Add`. This means that the subfolder `ITKSoftwareGuide/SoftwareGuide/Examples` is not created a configure time anymore. When Examples are parsed to be converted to `tex` files, the parser fails to write the generated `tex` file as the output folder does not exist.
1 parent ab408e3 commit 14a2524

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

SoftwareGuide/Examples/ParseCxxExamples.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python
22
import sys
33
import os
4+
import errno
45
import re
56
import shlex
67
import subprocess
@@ -156,6 +157,15 @@ def GetPreambleString(examplefilename):
156157

157158
thisCodeBlocks = ParseOneFile(inputfilename)
158159

160+
try:
161+
path = os.path.dirname(outputfilename)
162+
os.makedirs(path)
163+
except OSError as exc: # Python >2.5
164+
if exc.errno == errno.EEXIST and os.path.isdir(path):
165+
pass
166+
else:
167+
raise
168+
159169
outPtr = open(outputfilename, 'w')
160170
outPtr.write(GetPreambleString(inputfilename))
161171
for cb in thisCodeBlocks:

0 commit comments

Comments
 (0)