@@ -49,6 +49,33 @@ def upload_stable_pdf():
49
49
':/usr/share/nginx/pandas/pandas-docs/stable/' ):
50
50
raise SystemExit ('PDF upload to stable failed' )
51
51
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
+
52
79
def clean ():
53
80
if os .path .exists ('build' ):
54
81
shutil .rmtree ('build' )
@@ -201,7 +228,15 @@ def _get_config():
201
228
# current_dir = os.getcwd()
202
229
# os.chdir(os.path.dirname(os.path.join(current_dir, __file__)))
203
230
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 :
205
240
for arg in sys .argv [1 :]:
206
241
func = funcd .get (arg )
207
242
if func is None :
0 commit comments