1# Setup hook for detecting conflicts in Python packages
2echo "Sourcing python-remove-bin-bytecode-hook.sh"
3
4# Check if we have two packages with the same name in the closure and fail.
5# If this happens, something went wrong with the dependencies specs.
6# Intentionally kept in a subdirectory, see catch_conflicts/README.md.
7
8pythonRemoveBinBytecodePhase () {
9 if [ -d "$out/bin" ]; then
10 rm -rf "$out/bin/__pycache__" # Python 3
11 find "$out/bin" -type f -name "*.pyc" -delete # Python 2
12 fi
13}
14
15if [ -z "$dontUsePythonRemoveBinBytecode" ]; then
16 preDistPhases+=" pythonRemoveBinBytecodePhase"
17fi