diff options
author | Masood Malekghassemi <atash@google.com> | 2017-01-20 18:33:13 -0500 |
---|---|---|
committer | Masood Malekghassemi <atash@google.com> | 2017-01-20 18:55:09 -0500 |
commit | aa7089a549566cb2af45e6cbca0e9da3f22e988a (patch) | |
tree | 8990358616a0e2f7cd1e878a190d1fe9ce3f8d15 /tools | |
parent | 28ec869b5a2567cd30a6e3bcc0efbee0ab0ae7f5 (diff) |
Be more verbose when generating Python documentation
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/distrib/python/docgen.py | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/tools/distrib/python/docgen.py b/tools/distrib/python/docgen.py index 38ffcd6e0e..fddaa2ba3e 100755 --- a/tools/distrib/python/docgen.py +++ b/tools/distrib/python/docgen.py @@ -28,11 +28,14 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +from __future__ import print_function + import argparse import os import os.path import shutil import subprocess +import sys import tempfile parser = argparse.ArgumentParser() @@ -99,6 +102,7 @@ if args.submit: python_doc_dir = os.path.join(repo_dir, 'python') doc_branch = args.doc_branch + print('Cloning your repository...') subprocess.check_call([ 'git', 'clone', 'https://{}@github.com/{}/grpc'.format( github_user, github_repository_owner) @@ -110,13 +114,20 @@ if args.submit: subprocess.check_call([ 'git', 'checkout', 'upstream/gh-pages', '-b', doc_branch ], cwd=repo_dir) + print('Updating documentation...') shutil.rmtree(python_doc_dir, ignore_errors=True) shutil.copytree(DOC_PATH, python_doc_dir) - subprocess.check_call(['git', 'add', '--all'], cwd=repo_dir) - subprocess.check_call([ - 'git', 'commit', '-m', 'Auto-update Python documentation' - ], cwd=repo_dir) - subprocess.check_call([ - 'git', 'push', '--set-upstream', 'origin', doc_branch - ], cwd=repo_dir) + print('Attempting to push documentation...') + try: + subprocess.check_call(['git', 'add', '--all'], cwd=repo_dir) + subprocess.check_call([ + 'git', 'commit', '-m', 'Auto-update Python documentation' + ], cwd=repo_dir) + subprocess.check_call([ + 'git', 'push', '--set-upstream', 'origin', doc_branch + ], cwd=repo_dir) + except subprocess.CalledProcessError: + print('Failed to push documentation. Examine this directory and push ' + 'manually: {}'.format(repo_parent_dir)) + sys.exit(1) shutil.rmtree(repo_parent_dir) |