Skip to content
Snippets Groups Projects
Commit aa7089a5 authored by Masood Malekghassemi's avatar Masood Malekghassemi
Browse files

Be more verbose when generating Python documentation

parent 28ec869b
Branches
Tags
No related merge requests found
...@@ -28,11 +28,14 @@ ...@@ -28,11 +28,14 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from __future__ import print_function
import argparse import argparse
import os import os
import os.path import os.path
import shutil import shutil
import subprocess import subprocess
import sys
import tempfile import tempfile
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
...@@ -99,6 +102,7 @@ if args.submit: ...@@ -99,6 +102,7 @@ if args.submit:
python_doc_dir = os.path.join(repo_dir, 'python') python_doc_dir = os.path.join(repo_dir, 'python')
doc_branch = args.doc_branch doc_branch = args.doc_branch
print('Cloning your repository...')
subprocess.check_call([ subprocess.check_call([
'git', 'clone', 'https://{}@github.com/{}/grpc'.format( 'git', 'clone', 'https://{}@github.com/{}/grpc'.format(
github_user, github_repository_owner) github_user, github_repository_owner)
...@@ -110,8 +114,11 @@ if args.submit: ...@@ -110,8 +114,11 @@ if args.submit:
subprocess.check_call([ subprocess.check_call([
'git', 'checkout', 'upstream/gh-pages', '-b', doc_branch 'git', 'checkout', 'upstream/gh-pages', '-b', doc_branch
], cwd=repo_dir) ], cwd=repo_dir)
print('Updating documentation...')
shutil.rmtree(python_doc_dir, ignore_errors=True) shutil.rmtree(python_doc_dir, ignore_errors=True)
shutil.copytree(DOC_PATH, python_doc_dir) shutil.copytree(DOC_PATH, python_doc_dir)
print('Attempting to push documentation...')
try:
subprocess.check_call(['git', 'add', '--all'], cwd=repo_dir) subprocess.check_call(['git', 'add', '--all'], cwd=repo_dir)
subprocess.check_call([ subprocess.check_call([
'git', 'commit', '-m', 'Auto-update Python documentation' 'git', 'commit', '-m', 'Auto-update Python documentation'
...@@ -119,4 +126,8 @@ if args.submit: ...@@ -119,4 +126,8 @@ if args.submit:
subprocess.check_call([ subprocess.check_call([
'git', 'push', '--set-upstream', 'origin', doc_branch 'git', 'push', '--set-upstream', 'origin', doc_branch
], cwd=repo_dir) ], 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) shutil.rmtree(repo_parent_dir)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment