'r10e': "$ANDROID_NDK",
},
'build_tools': "23.0.3",
+ 'force_build_tools': False,
'java_paths': None,
'ant': "ant",
'mvn3': "mvn",
def regsub_file(pattern, repl, path):
- with open(path, 'r') as f:
+ with open(path, 'rb') as f:
text = f.read()
- text = re.sub(pattern, repl, text)
- with open(path, 'w') as f:
+ text = re.sub(bytes(pattern, 'utf8'), bytes(repl, 'utf8'), text)
+ with open(path, 'wb') as f:
f.write(text)
# Record an apk (if it's new, otherwise does nothing)
# Returns the date it was added.
- def recordapk(self, apk, app):
+ def recordapk(self, apk, app, default_date=None):
if apk not in self.apks:
- self.apks[apk] = (app, time.gmtime(time.time()))
+ if default_date is None:
+ default_date = time.gmtime(time.time())
+ self.apks[apk] = (app, default_date)
self.changed = True
_, added = self.apks[apk]
return added
if 'build.gradle' in files:
path = os.path.join(root, 'build.gradle')
- with open(path, "r") as o:
+ with open(path, "r", encoding='utf8') as o:
lines = o.readlines()
changed = False
opened = 0
i = 0
- with open(path, "w") as o:
+ with open(path, "w", encoding='utf8') as o:
while i < len(lines):
line = lines[i]
i += 1
for k, v in config['java_paths'].items():
env['JAVA%s_HOME' % k] = v
- # Set up environment vars that depend on each build, only set the
- # NDK env vars if the NDK is not already in the PATH
if build is not None:
path = build.ndk_path()
paths = orig_path.split(os.pathsep)
- if path in paths:
- return
- paths.append(path)
- env['PATH'] = os.pathsep.join(paths)
-
+ if path not in paths:
+ paths = [path] + paths
+ env['PATH'] = os.pathsep.join(paths)
for n in ['ANDROID_NDK', 'NDK', 'ANDROID_NDK_HOME']:
env[n] = build.ndk_path()
if not placed:
o.write('android.library.reference.%d=%s\n' % (number, relpath))
-apk_sigfile = re.compile(r'META-INF/[0-9A-Za-z]+\.(SF|RSA)')
+apk_sigfile = re.compile(r'META-INF/[0-9A-Za-z]+\.(SF|RSA|DSA|EC)')
def verify_apks(signed_apk, unsigned_apk, tmp_dir):