@@ -9,16 +9,18 @@ def __get_my_dir(): return os.path.dirname(os.path.realpath(__file__))
9
9
10
10
11
11
def collect_java_files (app_build_dir ,extension_text ,output_list ):
12
- prof = { "duration" : time .time () }
12
+ prof = {}
13
+ prof_start_time = time .time ()
13
14
for root , dirnames , filenames in os .walk (app_build_dir ):
14
15
for filename in fnmatch .filter (filenames , "*." + extension_text ):
15
16
output_list .append (os .path .abspath (os .path .join (root ,filename )))
16
- prof ["duration" ] = time .time () - prof [ "duration" ]
17
+ prof ["duration" ] = time .time () - prof_start_time
17
18
return prof
18
19
19
20
20
21
def unpack_java_package (pathname ,unpack_dir ):
21
- prof = { "duration" : time .time () }
22
+ prof = {}
23
+ prof_start_time = time .time ()
22
24
if not os .path .exists (unpack_dir ):
23
25
os .makedirs (unpack_dir )
24
26
old_cwd = os .getcwd ()
@@ -29,12 +31,13 @@ def unpack_java_package(pathname,unpack_dir):
29
31
pathname
30
32
)
31
33
os .chdir (old_cwd )
32
- prof ["duration" ] = time .time () - prof [ "duration" ]
34
+ prof ["duration" ] = time .time () - prof_start_time
33
35
return prof
34
36
35
37
36
38
def pack_classes_to_jar (classes_dir ,dst_file ):
37
- prof = { "duration" : time .time () }
39
+ prof = {}
40
+ prof_start_time = time .time ()
38
41
if not os .path .exists (os .path .dirname (dst_file )):
39
42
os .makedirs (os .path .dirname (dst_file ))
40
43
old_cwd = os .getcwd ()
@@ -44,7 +47,7 @@ def pack_classes_to_jar(classes_dir,dst_file):
44
47
+ dst_file + "\" ."
45
48
)
46
49
os .chdir (old_cwd )
47
- prof ["duration" ] = time .time () - prof [ "duration" ]
50
+ prof ["duration" ] = time .time () - prof_start_time
48
51
return prof
49
52
50
53
@@ -100,11 +103,13 @@ def is_class_modeled(pathname):
100
103
101
104
102
105
def install_class_file (pathname ,output_dir ,class_temp_dir ):
103
- prof = { "duration" : time .time () }
106
+ prof = {}
107
+ prof_start_time = time .time ()
104
108
print (" " + pathname )
105
- prof ["fullname" ] = { "duration" : time .time () }
109
+ prof ["fullname" ] = {}
110
+ prof_fullname_start_time = time .time ()
106
111
packages_classname = compute_fullname_of_class (pathname ,class_temp_dir )
107
- prof ["fullname" ]["duration" ] = time .time () - prof [ "fullname" ][ "duration" ]
112
+ prof ["fullname" ]["duration" ] = time .time () - prof_fullname_start_time
108
113
if packages_classname is None :
109
114
print ("FAIL: Cannot read full class name (including packages) of the class file: " + pathname )
110
115
prof ["duration" ] = time .time () - prof ["duration" ]
@@ -120,12 +125,13 @@ def install_class_file(pathname,output_dir,class_temp_dir):
120
125
else :
121
126
shutil .copyfile (pathname ,class_pathname )
122
127
123
- prof ["duration" ] = time .time () - prof [ "duration" ]
128
+ prof ["duration" ] = time .time () - prof_start_time
124
129
return prof
125
130
126
131
127
132
def install_jar_file (pathname ,output_dir ,temp_dir ,class_temp_dir ):
128
- prof = { "duration" : time .time () }
133
+ prof = {}
134
+ prof_start_time = time .time ()
129
135
130
136
prof ["unpack" ] = unpack_java_package (pathname ,temp_dir )
131
137
@@ -140,12 +146,13 @@ def install_jar_file(pathname,output_dir,temp_dir,class_temp_dir):
140
146
prof ["install" ]["duration" ] += prof_install ["duration" ]
141
147
prof ["install" ]["fullname" ]["duration" ] += prof_install ["fullname" ]["duration" ]
142
148
143
- prof ["duration" ] = time .time () - prof [ "duration" ]
149
+ prof ["duration" ] = time .time () - prof_start_time
144
150
return prof
145
151
146
152
147
153
def install_war_file (pathname ,output_dir ,temp_dir ,class_temp_dir ):
148
- prof = { "duration" : time .time () }
154
+ prof = {}
155
+ prof_start_time = time .time ()
149
156
150
157
war_temp_dir = os .path .join (temp_dir ,"WAR" )
151
158
prof ["unpack" ] = unpack_java_package (pathname ,war_temp_dir )
@@ -176,12 +183,13 @@ def install_war_file(pathname,output_dir,temp_dir,class_temp_dir):
176
183
prof ["install" ]["duration" ] += prof_install ["install" ]["duration" ]
177
184
prof ["install" ]["fullname" ]["duration" ] += prof_install ["install" ]["fullname" ]["duration" ]
178
185
179
- prof ["duration" ] = time .time () - prof [ "duration" ]
186
+ prof ["duration" ] = time .time () - prof_start_time
180
187
return prof
181
188
182
189
183
190
def build_classes_configuration (app_binary_dir ,output_dir ,temp_dir ):
184
- prof = { "duration" : time .time () }
191
+ prof = {}
192
+ prof_start_time = time .time ()
185
193
186
194
prof ["unpack" ] = {"duration" : 0.0 }
187
195
prof ["collect" ] = {"duration" : 0.0 }
@@ -229,5 +237,5 @@ def build_classes_configuration(app_binary_dir,output_dir,temp_dir):
229
237
prof ["install" ]["duration" ] += prof_install ["install" ]["duration" ]
230
238
prof ["install" ]["fullname" ]["duration" ] += prof_install ["install" ]["fullname" ]["duration" ]
231
239
232
- prof ["duration" ] = time .time () - prof [ "duration" ]
240
+ prof ["duration" ] = time .time () - prof_start_time
233
241
return prof
0 commit comments