#!/usr/bin/python

# -*- coding: utf-8 -*-
import re
import sys
import site

REQUIRES_VERSION = (1, 4, 5, 'final', 0)

text_version = ".".join(map(str,REQUIRES_VERSION))

# Prompte /usr/local/lib to the front of sys.path
sys.path.insert(0,site.getsitepackages()[0])

from sphinx import main, version_info

# Verify we're running the required version
if version_info != REQUIRES_VERSION:
    found_version = ".".join(map(str,version_info))
    print("ERROR: Found Sphinx version {found}. Build requires {requires}".format(
        requires=text_version,
        found=found_version))
    sys.exit(1)

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(main())
