releasetools: Make common.ZipWriteStr Python 3 compatible.
Python 2 and 3 behave differently when calling ZipFile.writestr() with zinfo.external_attr being 0. Python 3 uses `0o600 << 16` as the value for such a case (since https://github.com/python/cpython/commit/18ee29d0b870caddc0806916ca2c823254f1a1f9), which seems to make more sense. Otherwise the entry will end up with 0o000 as the permission bits. This CL updates common.ZipWriteStr to follow the logic in Python 3, in order to get consistent behavior between using the two versions. Bug: 131631303 Test: `python -m unittest test_common.CommonZipTest` Test: `python3 -m unittest test_common.CommonZipTest` Change-Id: If8429855d922ef1ad76591f703215a0ce5089f0f
Loading
Please register or sign in to comment