1616def print_usage (exit_code = 1 ):
1717 print ("Usage: makeStubs.py testDir stubDir [pom.xml]\n " ,
1818 "testDir: the directory containing the qltest to be stubbed.\n "
19- " Should contain an 'options' file pointing to 'stubdir '.\n "
20- " These files should be in the same format as a normal 'options' file.\n " ,
19+ " Should contain an 'options' file pointing to 'stubDir '.\n "
20+ " This file should be in the same format as a normal 'options' file.\n " ,
2121 "stubDir: the directory to output the generated stubs to\n " ,
2222 "pom.xml: a 'pom.xml' file that can be used to build the project\n " ,
2323 " If the test can be extracted without a 'pom.xml', this argument can be ommitted." )
@@ -33,6 +33,7 @@ def print_usage(exit_code=1):
3333testDir = os .path .normpath (sys .argv [1 ])
3434stubDir = os .path .normpath (sys .argv [2 ])
3535
36+
3637def check_dir_exists (path ):
3738 if not os .path .isdir (path ):
3839 print (path , "does not exist or is not a directory" )
@@ -82,19 +83,23 @@ def check_file_exists(path):
8283
8384if len (sys .argv ) == 4 :
8485 projectTestPkgDir = os .path .join (projectDir , "src" , "main" , "java" , "test" )
85- shutil .copytree (testDir , projectTestPkgDir , ignore = shutil .ignore_patterns ('*.testproj' ))
86+ shutil .copytree (testDir , projectTestPkgDir ,
87+ ignore = shutil .ignore_patterns ('*.testproj' ))
8688
8789 try :
8890 shutil .copyfile (sys .argv [3 ], os .path .join (projectDir , "pom.xml" ))
8991 except Exception as e :
90- print ("Failed to read project POM %s: %s" % (sys .argv [2 ], e ), file = sys .stderr )
92+ print ("Failed to read project POM %s: %s" %
93+ (sys .argv [2 ], e ), file = sys .stderr )
9194 sys .exit (1 )
9295else :
9396 # if `pom.xml` is omitted, simply copy the test directory to `projectDir`
94- shutil .copytree (testDir , projectDir , ignore = shutil .ignore_patterns ('*.testproj' ))
97+ shutil .copytree (testDir , projectDir ,
98+ ignore = shutil .ignore_patterns ('*.testproj' ))
9599
96100dbDir = os .path .join (workDir , "db" )
97101
102+
98103def print_javac_output ():
99104 logFiles = glob .glob (os .path .join (dbDir , "log" , "javac-output*" ))
100105
@@ -143,7 +148,7 @@ def run(cmd):
143148 results ['#select' ]['tuples' ]
144149 results ['noGeneratedStubs' ]['tuples' ]
145150 results ['multipleGeneratedStubs' ]['tuples' ]
146- except ValueError :
151+ except KeyError :
147152 print ('Unexpected JSON output - no tuples found' )
148153 exit (1 )
149154
0 commit comments