Skip to content

Commit 9cf39ac

Browse files
committed
DOC: build docs for previous releases
1 parent 5d0565e commit 9cf39ac

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

doc/make.py

+36-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,33 @@ def upload_stable_pdf():
4949
':/usr/share/nginx/pandas/pandas-docs/stable/'):
5050
raise SystemExit('PDF upload to stable failed')
5151

52+
def upload_prev(ver, doc_root='./'):
53+
'push a copy of older release to appropriate version directory'
54+
local_dir = doc_root + 'build/html'
55+
remote_dir = '/usr/share/nginx/pandas/pandas-docs/version/%s/' % ver
56+
cmd = 'cd %s; rsync -avz . [email protected]:%s -essh'
57+
cmd = cmd % (local_dir, remote_dir)
58+
print cmd
59+
if os.system(cmd):
60+
raise SystemExit('Upload to %s from %s failed' % (remote_dir, local_dir))
61+
62+
local_dir = doc_root + 'build/latex'
63+
pdf_cmd = 'cd %s; scp pandas.pdf [email protected]:%s'
64+
pdf_cmd = pdf_cmd % (local_dir, remote_dir)
65+
if os.system(pdf_cmd):
66+
raise SystemExit('Upload PDF to %s from %s failed' % (ver, doc_root))
67+
68+
def build_prev(ver):
69+
if os.system('git checkout v%s' % ver) != 1:
70+
os.chdir('..')
71+
os.system('python setup.py clean')
72+
os.system('python setup.py build_ext --inplace')
73+
os.chdir('doc')
74+
os.system('python make.py clean')
75+
os.system('python make.py html')
76+
os.system('python make.py latex')
77+
os.system('git checkout master')
78+
5279
def clean():
5380
if os.path.exists('build'):
5481
shutil.rmtree('build')
@@ -201,7 +228,15 @@ def _get_config():
201228
# current_dir = os.getcwd()
202229
# os.chdir(os.path.dirname(os.path.join(current_dir, __file__)))
203230

204-
if len(sys.argv)>1:
231+
if len(sys.argv) > 2:
232+
ftype = sys.argv[1]
233+
ver = sys.argv[2]
234+
235+
if ftype == 'build_previous':
236+
build_prev(ver)
237+
if ftype == 'upload_previous':
238+
upload_prev(ver)
239+
elif len(sys.argv) > 1:
205240
for arg in sys.argv[1:]:
206241
func = funcd.get(arg)
207242
if func is None:

0 commit comments

Comments
 (0)