11#! py -3
22"""
3- Extract code examples from TIJ4 Refreshed. Extracts from plain text file.
3+ Extract code examples from TIJ Director's Cut plain text file.
44Creates Ant build.xml file for each subdirectory.
55"""
66from pathlib import Path
@@ -64,7 +64,7 @@ def extractExamples():
6464 codeListing .write ("\n " )
6565
6666
67- @CmdLine ("x" )
67+ # @CmdLine("x")
6868def clean ():
6969 "Remove ExtractedExamples directory"
7070 print ("Cleaning ..." )
@@ -132,7 +132,7 @@ def destDirs(pattern="**"):
132132
133133
134134
135- @CmdLine ("a" )
135+ # @CmdLine("a")
136136def copySupplementalFilesFromGithub ():
137137 "Copy supplemental files from Github repository to extracted examples"
138138 print ("Copying supplemental files from Github ..." )
@@ -339,23 +339,7 @@ def makeBuildFile(self):
339339 </exec>
340340"""
341341
342- # def addBatchCommand(target_dir, batch_file_name):
343- # with (destination/target_dir/"build.xml").open() as build:
344- # lines = build.readlines()
345- # for n, line in enumerate(lines):
346- # if "</target>" in line:
347- # lines.insert(n, exec.format(batch_file_name, batch_file_name))
348- # break
349- # with (destination/target_dir/"build.xml").open("w") as build:
350- # build.writelines(lines)
351-
352- # def addBatchFile(target_dir, batch_file_name, batch_file_text):
353- # with (destination/target_dir/batch_file_name).open('w') as ss:
354- # ss.write(batch_file_text)
355- # addBatchCommand(target_dir, batch_file_name)
356-
357-
358- @CmdLine ("m" )
342+ #@CmdLine("m")
359343def createAntFiles ():
360344 "Make ant files that don't exist"
361345 print ("Creating Ant Files ..." )
@@ -393,7 +377,7 @@ def extractAndCreateBuildFiles():
393377 run .write (r"python ..\Validate.py -e" + "\n " )
394378
395379
396- @CmdLine ('g' )
380+ # @CmdLine('g')
397381def generateAntClean ():
398382 "Generate directives for Ant-Clean.xml"
399383 others = set ([f .name for f in examples .rglob ("*" ) if not f .is_dir ()
@@ -408,11 +392,10 @@ def generateAntClean():
408392 for f in others :
409393 print (""" <exclude name="**/{}" />""" .format (f ))
410394
411- # pprint.pprint([f for f in others if "test" in f or "Test" in f])
412395
413- tagRE = re .compile ("{.*?}" , re .DOTALL )
414396
415397def findTags (lines ):
398+ tagRE = re .compile ("{.*?}" , re .DOTALL )
416399 topblock = []
417400 for line in lines :
418401 if line .startswith ("//" ):
@@ -442,4 +425,6 @@ def findAllCommentTags():
442425
443426
444427
445- if __name__ == '__main__' : CmdLine .run ()
428+ if __name__ == '__main__' :
429+ print (__doc__ )
430+ CmdLine .run ()
0 commit comments