Make generateSingleHeader.py Python 2.7 compatible

This commit is contained in:
Martin Hořeňovský 2017-06-06 16:32:45 +02:00
parent 6583284731
commit b6d9976fbb

View File

@ -36,8 +36,11 @@ for arg in sys.argv[1:]:
print( "\n** Unrecognised argument: " + arg + " **\n" ) print( "\n** Unrecognised argument: " + arg + " **\n" )
exit(1) exit(1)
# ensure that the output directory exists
os.makedirs(os.path.dirname(outputPath), exist_ok = True) # ensure that the output directory exists (hopefully no races)
outDir = os.path.dirname(outputPath)
if not os.path.exists(outDir):
os.makedirs(outDir)
out = open( outputPath, 'w' ) out = open( outputPath, 'w' )
ifdefs = 0 ifdefs = 0
implIfDefs = -1 implIfDefs = -1