MCPcopy
hub / github.com/KhronosGroup/Vulkan-Docs / writeBlock

Method writeBlock

scripts/syncgenerator.py:53–72  ·  view source on GitHub ↗

Generate an include file. - directory - subdirectory to put file in - basename - base name of the file - contents - contents of the file (Asciidoc boilerplate aside)

(self, basename, contents)

Source from the content-addressed store, hash-verified

51 OutputGenerator.endFile(self)
52
53 def writeBlock(self, basename, contents):
54 """Generate an include file.
55
56 - directory - subdirectory to put file in
57 - basename - base name of the file
58 - contents - contents of the file (Asciidoc boilerplate aside)"""
59
60 filename = f"{self.genOpts.directory}/{basename}"
61 self.logMsg('diag', '# Generating include file:', filename)
62 dirname = os.path.dirname(filename)
63 if not os.path.exists(dirname):
64 os.makedirs(dirname)
65 with open(filename, 'w', encoding='utf-8') as fp:
66 write(self.genOpts.conventions.warning_comment, file=fp)
67
68 if len(contents) > 0:
69 for str in contents:
70 write(str, file=fp)
71 else:
72 self.logMsg('diag', '# No contents for:', filename)
73
74 def genSyncStage(self, stageinfo):
75 OutputGenerator.genSyncStage(self, stageinfo)

Callers 4

writeFlagDefinitionsMethod · 0.95
supportedAccessTypesMethod · 0.95
pipelineOrderingMethod · 0.95

Calls 2

writeFunction · 0.90
logMsgMethod · 0.80

Tested by

no test coverage detected