make rules.py compatible with python2.6.

subprocess.check_output is not present in python2.6, so using Popen instead.