better automated doc upload

This commit is contained in:
Paul Müller 2015-04-03 11:21:08 +02:00
parent 7fc6f9ab46
commit 6c81095509
2 changed files with 6 additions and 5 deletions

View file

@ -14,5 +14,4 @@ To upload the documentation to gh-pages, run
or
cd doc
python commit_gh-pages.py
python doc/commit_gh-pages.py

View file

@ -1,10 +1,12 @@
#!/usr/bin/env python
from __future__ import print_function
import os
from os.path import abspath,dirname
import sys
import subprocess as sp
os.chdir(os.path.dirname(os.path.abspath(__file__)))
os.chdir(dirname(dirname(abspath(__file__))))
def checkout_master():
@ -28,14 +30,14 @@ checkout_ghpages()
# copy built files
if os.system("cp -r ./build/sphinx/html/* ../") != 0:
if os.system("cp -r ./build/sphinx/html/* ./") != 0:
checkout_master()
sys.exit()
for item in os.listdir("./build/sphinx/html/"):
# Make sure we have added all files from html
if not item.startswith("."):
os.system("git add ../{}".format(item))
os.system("git add ./{}".format(item))
# commit changes
if len(sp.check_output(["git", "diff", "HEAD"]).strip()) > 0: