shutil.move() in apk_strip_signature() to work across filesystems

os.rename() only works if source and destination are on the same file
system, shutil.move() works across file systems.

OSError: [Errno 18] Invalid cross-device link: '/builds/eighthave/fdroidclient/app/build/outputs/apk/app-debug.apk' -> '/tmp/tmp966vh75f/tmp.apk'
This commit is contained in:
Hans-Christoph Steiner 2017-12-01 14:08:42 +01:00
parent bf913703c5
commit 2983c35361

View file

@ -2368,7 +2368,7 @@ def apk_strip_signatures(signed_apk, strip_manifest=False):
""" """
with tempfile.TemporaryDirectory() as tmpdir: with tempfile.TemporaryDirectory() as tmpdir:
tmp_apk = os.path.join(tmpdir, 'tmp.apk') tmp_apk = os.path.join(tmpdir, 'tmp.apk')
os.rename(signed_apk, tmp_apk) shutil.move(signed_apk, tmp_apk)
with ZipFile(tmp_apk, 'r') as in_apk: with ZipFile(tmp_apk, 'r') as in_apk:
with ZipFile(signed_apk, 'w') as out_apk: with ZipFile(signed_apk, 'w') as out_apk:
for info in in_apk.infolist(): for info in in_apk.infolist():