Build code depending on resources from the appcompat library with both Buck and Gradle
Reviewed By: sdwilsh Differential Revision: D2844961 fb-gh-sync-id: 686a9f253eb370a9dc8cc33ca1c4e8453f89210a
This commit is contained in:
parent
21fcbbc32c
commit
b9a8be97bc
|
@ -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])
|
Loading…
Reference in New Issue