Chih-Hung Hsieh | fab4380 | 2020-04-07 14:24:01 -0700 | [diff] [blame^] | 1 | #!/usr/bin/env python3 |
| 2 | |
| 3 | import os |
| 4 | import shutil |
| 5 | import subprocess |
| 6 | |
| 7 | TARGET = ".docs" |
| 8 | VERSION = "clang_9_0" |
| 9 | |
| 10 | if os.path.isdir(TARGET): |
| 11 | shutil.rmtree(TARGET) |
| 12 | |
| 13 | os.mkdir(TARGET) |
| 14 | |
| 15 | for (name, features) in [("default", VERSION), ("runtime", f"runtime,{VERSION}")]: |
| 16 | subprocess.call(["cargo", "clean"]) |
| 17 | subprocess.call(["cargo", "doc", f"--features={features}", "--no-deps"]) |
| 18 | print(f"Copying docs to {TARGET}/{name}...") |
| 19 | shutil.copytree(f"target/doc", f"{TARGET}/{name}") |
| 20 | |
| 21 | os.chdir(TARGET) |
| 22 | subprocess.call(["git", "init"]) |
| 23 | subprocess.call(["git", "remote", "add", "origin", "git@github.com:KyleMayes/clang-sys.git"]) |
| 24 | subprocess.call(["git", "checkout", "--orphan", "gh-pages"]) |
| 25 | subprocess.call(["git", "add", "-A"]) |
| 26 | subprocess.call(["git", "commit", "-m", "\"Update documentation\""]) |
| 27 | subprocess.call(["git", "push", "origin", "gh-pages", "--force"]) |
| 28 | |
| 29 | os.chdir("..") |
| 30 | shutil.rmtree(TARGET) |