diff --git a/ReactAndroid/src/main/third-party/android-support-for-standalone-apps/v7/appcompat/res-unpacker.py b/ReactAndroid/src/main/third-party/android-support-for-standalone-apps/v7/appcompat/res-unpacker.py new file mode 100644 index 000000000..145d09b02 --- /dev/null +++ b/ReactAndroid/src/main/third-party/android-support-for-standalone-apps/v7/appcompat/res-unpacker.py @@ -0,0 +1,20 @@ +import contextlib +import os +import shutil +import sys +import tempfile +import zipfile + +# Helper that unpacks the contents of the res folder of an .aar file +# into given destination. + +@contextlib.contextmanager +def cleanup(path): + yield path + shutil.rmtree(path) + +if __name__ == '__main__': + with zipfile.ZipFile(sys.argv[1], 'r') as z: + with cleanup(tempfile.mkdtemp()) as temp_path: + z.extractall(temp_path, filter(lambda n: n.startswith('res/'), z.namelist())) + shutil.move(os.path.join(temp_path, 'res'), sys.argv[2])