def run(self):
        if self.test:
            path = "docs/_build/doctest"
            mode = "doctest"
        else:
            path = "docs/_build/%s" % __version__
            mode = "html"
            try:
                os.makedirs(path)
            except:
                pass
        status = subprocess.call(["sphinx-build", "-E",
                                  "-b", mode, "docs", path])
        if status:
            raise RuntimeError("documentation step '%s' failed" % (mode,))
        sys.stdout.write("\nDocumentation step '%s' performed, results here:\n"
                         "   %s/\n" % (mode, path))