#!/usr/bin/bash -e

if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
  exit 0
fi

if [ ! -x /usr/bin/marshalparser ]; then
  echo "ERROR: /usr/bin/marshalparser not found!"
  exit 1
fi

set -o pipefail
find "$1" -type f -name "*.pyc" | xargs /usr/bin/marshalparser --fix --overwrite
