diff options
author | Dan Albert <danalbert@google.com> | 2015-11-06 18:18:14 -0800 |
---|---|---|
committer | Dan Albert <danalbert@google.com> | 2015-11-06 18:22:24 -0800 |
commit | b02688b218abceef5d160924ad9ccd207ee6417b (patch) | |
tree | 060ca0026f053b5643c37a94d5672dc4cdf5d361 /build/lib | |
parent | 797ec6dcaa79bdf860eddae535b8a9cdedbad1ed (diff) | |
download | ndk-b02688b218abceef5d160924ad9ccd207ee6417b.tar.gz |
Remove unwanted crap before making modules.
This has traditionally been done by package-release.sh, but we're
shipping the modules now and we don't want those to have these things
either.
Change-Id: I9eb3c78f3b15ab18ef74c21f4d6acc44c28b1edb
Diffstat (limited to 'build/lib')
-rw-r--r-- | build/lib/build_support.py | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/build/lib/build_support.py b/build/lib/build_support.py index 0c739da55..c40b21652 100644 --- a/build/lib/build_support.py +++ b/build/lib/build_support.py @@ -195,22 +195,32 @@ def make_package(name, files, out_dir, root_dir, repo_prop_dir=''): """ path = os.path.join(out_dir, name + '.tar.bz2') - def package_filter(path): + def package_filter(tarinfo): + # The libc++ .git directory is in our tree. + basename = os.path.basename(tarinfo.name) + if basename in ('.git', '.gitignore'): + return None + ignored_extensions = ( # Python junk. '.pyc', '.pyo', '.pyd', + + # Vim junk. + '.swp', ) - name = os.path.basename(path) - _, ext = os.path.splitext(name) - return ext in ignored_extensions or name == '.gitignore' + _, ext = os.path.splitext(tarinfo.name) + if ext in ignored_extensions: + return None + + return tarinfo with tarfile.open(path, 'w:bz2') as tarball: for f in files: real_file = os.path.join(root_dir, f) - tarball.add(real_file, f, exclude=package_filter) + tarball.add(real_file, f, filter=package_filter) tmpdir = tempfile.mkdtemp() try: |