#!/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*
find rpython/translator/c -name '*.o'
find include '(' -name '*.h' -o -name '*.inl' ')' \
             -a ! -name 'PyPy.h'

# 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

# Docs
find pypy/doc/config -name 'commandline*.rst' \
	-o -name 'objspace*.rst' \
	-o -name 'translation*.rst'

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