#!/bin/sh
set -eu

# Temporary build directories
rm -rf build-*

# Caches
rm -rf rpython/_cache

# Created by our PEP3147 patch:
echo pypy/doc/config/objspace.magic_tag.txt

# Build artifacts
find . -name '*.pyc'
find . -name __pycache__ | xargs rm -rf
echo pypy/goal/pypy-c pypy/goal/libpypy-c.so
find rpython/translator/c pypy/module/cpyext/test -name '*.o'
find include '(' -name '*.h' -o -name '*.inl' ')' \
             -a ! -name 'PyPy.h'
find lib_pypy -name '*.so' -o -name '*.o' -o -name '*.c'

# Tests
echo pypy/test.db
find pypy/module/test_lib_pypy/ctypes_tests/ -name '*.o'
find lib-python/2.7/lib2to3/ -name '*Grammar*.pickle'
find pypy/module/test_lib_pypy/cffi_tests/snippets -type d \
	'(' -name build -o -name dist -o -name '*.egg-info' ')' \
	| xargs rm -rf
find lib-python/2.7/test/data/ -type f

# Docs
find pypy/doc/config -name 'commandline*.rst' \
	-o -name 'objspace*.rst' \
	-o -name 'translation*.rst'
find pypy/doc/config \( \
	-name 'objspace*.txt' \
	-o -name 'translation*.txt' \
	\) -size 0

# Generated in override_dh_installdeb
echo debian/pypy.preinst debian/pypy.postinst
