#!/bin/sh
# This is a horrible hack to run dirtbike under Python 2, so it can find python
# 2 libraries.

set -eu

if [ ! -d /tmp/dirtbike2 ]; then
	mkdir /tmp/dirtbike2
	# Wheel isn't available on python2 any more, so we just copy it from python3
	cp -a /usr/lib/python3/dist-packages/wheel* /tmp/dirtbike2/
	cp -a /usr/lib/python3/dist-packages/dirtbike* /tmp/dirtbike2/
fi

export PYTHONPATH=/tmp/dirtbike2
exec /usr/bin/python2 /usr/bin/dirtbike "$@"
