31
31
SPHINX_BUILD = 'sphinxbuild'
32
32
33
33
34
- def upload_dev ():
34
+ def upload_dev (user = 'pandas' ):
35
35
'push a copy to the pydata dev directory'
36
- if os .system ('cd build/html; rsync -avz . pandas @pandas.pydata.org'
37
- ':/usr/share/nginx/pandas/pandas-docs/dev/ -essh' ):
36
+ if os .system ('cd build/html; rsync -avz . {0} @pandas.pydata.org'
37
+ ':/usr/share/nginx/pandas/pandas-docs/dev/ -essh' . format ( user ) ):
38
38
raise SystemExit ('Upload to Pydata Dev failed' )
39
39
40
40
41
- def upload_dev_pdf ():
41
+ def upload_dev_pdf (user = 'pandas' ):
42
42
'push a copy to the pydata dev directory'
43
- if os .system ('cd build/latex; scp pandas.pdf pandas @pandas.pydata.org'
44
- ':/usr/share/nginx/pandas/pandas-docs/dev/' ):
43
+ if os .system ('cd build/latex; scp pandas.pdf {0} @pandas.pydata.org'
44
+ ':/usr/share/nginx/pandas/pandas-docs/dev/' . format ( user ) ):
45
45
raise SystemExit ('PDF upload to Pydata Dev failed' )
46
46
47
47
48
- def upload_stable ():
48
+ def upload_stable (user = 'pandas' ):
49
49
'push a copy to the pydata stable directory'
50
- if os .system ('cd build/html; rsync -avz . pandas @pandas.pydata.org'
51
- ':/usr/share/nginx/pandas/pandas-docs/stable/ -essh' ):
50
+ if os .system ('cd build/html; rsync -avz . {0} @pandas.pydata.org'
51
+ ':/usr/share/nginx/pandas/pandas-docs/stable/ -essh' . format ( user ) ):
52
52
raise SystemExit ('Upload to stable failed' )
53
53
54
54
55
- def upload_stable_pdf ():
55
+ def upload_stable_pdf (user = 'pandas' ):
56
56
'push a copy to the pydata dev directory'
57
- if os .system ('cd build/latex; scp pandas.pdf pandas @pandas.pydata.org'
58
- ':/usr/share/nginx/pandas/pandas-docs/stable/' ):
57
+ if os .system ('cd build/latex; scp pandas.pdf {0} @pandas.pydata.org'
58
+ ':/usr/share/nginx/pandas/pandas-docs/stable/' . format ( user ) ):
59
59
raise SystemExit ('PDF upload to stable failed' )
60
60
61
61
62
- def upload_prev (ver , doc_root = './' ):
62
+ def upload_prev (ver , doc_root = './' , user = 'pandas' ):
63
63
'push a copy of older release to appropriate version directory'
64
64
local_dir = doc_root + 'build/html'
65
65
remote_dir = '/usr/share/nginx/pandas/pandas-docs/version/%s/' % ver
66
- cmd = 'cd %s; rsync -avz . pandas @pandas.pydata.org:%s -essh'
67
- cmd = cmd % (local_dir , remote_dir )
66
+ cmd = 'cd %s; rsync -avz . %s @pandas.pydata.org:%s -essh'
67
+ cmd = cmd % (local_dir , user , remote_dir )
68
68
print (cmd )
69
69
if os .system (cmd ):
70
70
raise SystemExit (
71
71
'Upload to %s from %s failed' % (remote_dir , local_dir ))
72
72
73
73
local_dir = doc_root + 'build/latex'
74
- pdf_cmd = 'cd %s; scp pandas.pdf pandas @pandas.pydata.org:%s'
75
- pdf_cmd = pdf_cmd % (local_dir , remote_dir )
74
+ pdf_cmd = 'cd %s; scp pandas.pdf %s @pandas.pydata.org:%s'
75
+ pdf_cmd = pdf_cmd % (local_dir , user , remote_dir )
76
76
if os .system (pdf_cmd ):
77
77
raise SystemExit ('Upload PDF to %s from %s failed' % (ver , doc_root ))
78
78
@@ -337,6 +337,10 @@ def generate_index(api=True, single=False, **kwds):
337
337
type = str ,
338
338
default = False ,
339
339
help = 'filename of section to compile, e.g. "indexing"' )
340
+ argparser .add_argument ('--user' ,
341
+ type = str ,
342
+ default = False ,
343
+ help = 'Username to connect to the pydata server' )
340
344
341
345
def main ():
342
346
args , unknown = argparser .parse_known_args ()
@@ -354,16 +358,19 @@ def main():
354
358
ver = sys .argv [2 ]
355
359
356
360
if ftype == 'build_previous' :
357
- build_prev (ver )
361
+ build_prev (ver , user = args . user )
358
362
if ftype == 'upload_previous' :
359
- upload_prev (ver )
363
+ upload_prev (ver , user = args . user )
360
364
elif len (sys .argv ) == 2 :
361
365
for arg in sys .argv [1 :]:
362
366
func = funcd .get (arg )
363
367
if func is None :
364
368
raise SystemExit ('Do not know how to handle %s; valid args are %s' % (
365
369
arg , list (funcd .keys ())))
366
- func ()
370
+ if args .user :
371
+ func (user = args .user )
372
+ else :
373
+ func ()
367
374
else :
368
375
small_docs = False
369
376
all ()
0 commit comments