Skip to content

Commit bd01395

Browse files
Merge pull request #8583 from jorisvandenbossche/doc-upload
DOC/REL: adapt make.py file to upload with other user than pandas
2 parents 8747633 + 0173962 commit bd01395

File tree

1 file changed

+27
-20
lines changed

1 file changed

+27
-20
lines changed

doc/make.py

+27-20
Original file line numberDiff line numberDiff line change
@@ -31,48 +31,48 @@
3131
SPHINX_BUILD = 'sphinxbuild'
3232

3333

34-
def upload_dev():
34+
def upload_dev(user='pandas'):
3535
'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)):
3838
raise SystemExit('Upload to Pydata Dev failed')
3939

4040

41-
def upload_dev_pdf():
41+
def upload_dev_pdf(user='pandas'):
4242
'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)):
4545
raise SystemExit('PDF upload to Pydata Dev failed')
4646

4747

48-
def upload_stable():
48+
def upload_stable(user='pandas'):
4949
'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)):
5252
raise SystemExit('Upload to stable failed')
5353

5454

55-
def upload_stable_pdf():
55+
def upload_stable_pdf(user='pandas'):
5656
'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)):
5959
raise SystemExit('PDF upload to stable failed')
6060

6161

62-
def upload_prev(ver, doc_root='./'):
62+
def upload_prev(ver, doc_root='./', user='pandas'):
6363
'push a copy of older release to appropriate version directory'
6464
local_dir = doc_root + 'build/html'
6565
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)
6868
print(cmd)
6969
if os.system(cmd):
7070
raise SystemExit(
7171
'Upload to %s from %s failed' % (remote_dir, local_dir))
7272

7373
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)
7676
if os.system(pdf_cmd):
7777
raise SystemExit('Upload PDF to %s from %s failed' % (ver, doc_root))
7878

@@ -337,6 +337,10 @@ def generate_index(api=True, single=False, **kwds):
337337
type=str,
338338
default=False,
339339
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')
340344

341345
def main():
342346
args, unknown = argparser.parse_known_args()
@@ -354,16 +358,19 @@ def main():
354358
ver = sys.argv[2]
355359

356360
if ftype == 'build_previous':
357-
build_prev(ver)
361+
build_prev(ver, user=args.user)
358362
if ftype == 'upload_previous':
359-
upload_prev(ver)
363+
upload_prev(ver, user=args.user)
360364
elif len(sys.argv) == 2:
361365
for arg in sys.argv[1:]:
362366
func = funcd.get(arg)
363367
if func is None:
364368
raise SystemExit('Do not know how to handle %s; valid args are %s' % (
365369
arg, list(funcd.keys())))
366-
func()
370+
if args.user:
371+
func(user=args.user)
372+
else:
373+
func()
367374
else:
368375
small_docs = False
369376
all()

0 commit comments

Comments
 (0)