@@ -94,7 +94,7 @@ def _parse_cfg(self):
94
94
95
95
def _write_ant_properties (self , cfg ):
96
96
ant_cfg_file = os .path .join (self .app_android_root , "ant.properties" )
97
- file_obj = open (ant_cfg_file , "a" )
97
+ file_obj = open (ant_cfg_file , "a+ " )
98
98
for key in cfg .keys ():
99
99
str_cfg = "%s=%s\n " % (key , cfg [key ])
100
100
file_obj .write (str_cfg )
@@ -104,23 +104,24 @@ def _write_ant_properties(self, cfg):
104
104
def _move_cfg (self , cfg ):
105
105
# add into ant.properties
106
106
ant_cfg_file = os .path .join (self .app_android_root , "ant.properties" )
107
- file_obj = open (ant_cfg_file )
108
- pattern = re .compile (r"^key\.store=(.+)" )
109
- keystore = None
110
- for line in file_obj :
111
- str1 = line .replace (' ' , '' )
112
- str2 = str1 .replace ('\t ' , '' )
113
- match = pattern .match (str2 )
114
- if match is not None :
115
- keystore = match .group (1 )
116
- break
117
-
118
- file_obj .close ()
107
+ try :
108
+ keystore = None
109
+ file_obj = open (ant_cfg_file )
110
+ pattern = re .compile (r"^key\.store=(.+)" )
111
+ for line in file_obj :
112
+ str1 = line .replace (' ' , '' )
113
+ str2 = str1 .replace ('\t ' , '' )
114
+ match = pattern .match (str2 )
115
+ if match is not None :
116
+ keystore = match .group (1 )
117
+ break
118
+ file_obj .close ()
119
+ except :
120
+ pass
119
121
120
122
if keystore is None :
121
123
# ant.properties not have the config for sign
122
124
self ._write_ant_properties (cfg )
123
-
124
125
def remove_c_libs (self , libs_dir ):
125
126
for file_name in os .listdir (libs_dir ):
126
127
lib_file = os .path .join (libs_dir , file_name )
0 commit comments