16
16
def print_usage (exit_code = 1 ):
17
17
print ("Usage: makeStubs.py testDir stubDir [pom.xml]\n " ,
18
18
"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 " ,
21
21
"stubDir: the directory to output the generated stubs to\n " ,
22
22
"pom.xml: a 'pom.xml' file that can be used to build the project\n " ,
23
23
" 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):
33
33
testDir = os .path .normpath (sys .argv [1 ])
34
34
stubDir = os .path .normpath (sys .argv [2 ])
35
35
36
+
36
37
def check_dir_exists (path ):
37
38
if not os .path .isdir (path ):
38
39
print (path , "does not exist or is not a directory" )
@@ -82,19 +83,23 @@ def check_file_exists(path):
82
83
83
84
if len (sys .argv ) == 4 :
84
85
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' ))
86
88
87
89
try :
88
90
shutil .copyfile (sys .argv [3 ], os .path .join (projectDir , "pom.xml" ))
89
91
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 )
91
94
sys .exit (1 )
92
95
else :
93
96
# 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' ))
95
99
96
100
dbDir = os .path .join (workDir , "db" )
97
101
102
+
98
103
def print_javac_output ():
99
104
logFiles = glob .glob (os .path .join (dbDir , "log" , "javac-output*" ))
100
105
@@ -143,7 +148,7 @@ def run(cmd):
143
148
results ['#select' ]['tuples' ]
144
149
results ['noGeneratedStubs' ]['tuples' ]
145
150
results ['multipleGeneratedStubs' ]['tuples' ]
146
- except ValueError :
151
+ except KeyError :
147
152
print ('Unexpected JSON output - no tuples found' )
148
153
exit (1 )
149
154
0 commit comments