Skip to content

DOC/REL: adapt make.py file to upload with other user than pandas #8583

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 22, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 27 additions & 20 deletions doc/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,48 +31,48 @@
SPHINX_BUILD = 'sphinxbuild'


def upload_dev():
def upload_dev(user='pandas'):
'push a copy to the pydata dev directory'
if os.system('cd build/html; rsync -avz . pandas@pandas.pydata.org'
':/usr/share/nginx/pandas/pandas-docs/dev/ -essh'):
if os.system('cd build/html; rsync -avz . {0}@pandas.pydata.org'
':/usr/share/nginx/pandas/pandas-docs/dev/ -essh'.format(user)):
raise SystemExit('Upload to Pydata Dev failed')


def upload_dev_pdf():
def upload_dev_pdf(user='pandas'):
'push a copy to the pydata dev directory'
if os.system('cd build/latex; scp pandas.pdf pandas@pandas.pydata.org'
':/usr/share/nginx/pandas/pandas-docs/dev/'):
if os.system('cd build/latex; scp pandas.pdf {0}@pandas.pydata.org'
':/usr/share/nginx/pandas/pandas-docs/dev/'.format(user)):
raise SystemExit('PDF upload to Pydata Dev failed')


def upload_stable():
def upload_stable(user='pandas'):
'push a copy to the pydata stable directory'
if os.system('cd build/html; rsync -avz . pandas@pandas.pydata.org'
':/usr/share/nginx/pandas/pandas-docs/stable/ -essh'):
if os.system('cd build/html; rsync -avz . {0}@pandas.pydata.org'
':/usr/share/nginx/pandas/pandas-docs/stable/ -essh'.format(user)):
raise SystemExit('Upload to stable failed')


def upload_stable_pdf():
def upload_stable_pdf(user='pandas'):
'push a copy to the pydata dev directory'
if os.system('cd build/latex; scp pandas.pdf pandas@pandas.pydata.org'
':/usr/share/nginx/pandas/pandas-docs/stable/'):
if os.system('cd build/latex; scp pandas.pdf {0}@pandas.pydata.org'
':/usr/share/nginx/pandas/pandas-docs/stable/'.format(user)):
raise SystemExit('PDF upload to stable failed')


def upload_prev(ver, doc_root='./'):
def upload_prev(ver, doc_root='./', user='pandas'):
'push a copy of older release to appropriate version directory'
local_dir = doc_root + 'build/html'
remote_dir = '/usr/share/nginx/pandas/pandas-docs/version/%s/' % ver
cmd = 'cd %s; rsync -avz . pandas@pandas.pydata.org:%s -essh'
cmd = cmd % (local_dir, remote_dir)
cmd = 'cd %s; rsync -avz . %s@pandas.pydata.org:%s -essh'
cmd = cmd % (local_dir, user, remote_dir)
print(cmd)
if os.system(cmd):
raise SystemExit(
'Upload to %s from %s failed' % (remote_dir, local_dir))

local_dir = doc_root + 'build/latex'
pdf_cmd = 'cd %s; scp pandas.pdf pandas@pandas.pydata.org:%s'
pdf_cmd = pdf_cmd % (local_dir, remote_dir)
pdf_cmd = 'cd %s; scp pandas.pdf %s@pandas.pydata.org:%s'
pdf_cmd = pdf_cmd % (local_dir, user, remote_dir)
if os.system(pdf_cmd):
raise SystemExit('Upload PDF to %s from %s failed' % (ver, doc_root))

Expand Down Expand Up @@ -337,6 +337,10 @@ def generate_index(api=True, single=False, **kwds):
type=str,
default=False,
help='filename of section to compile, e.g. "indexing"')
argparser.add_argument('--user',
type=str,
default=False,
help='Username to connect to the pydata server')

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

if ftype == 'build_previous':
build_prev(ver)
build_prev(ver, user=args.user)
if ftype == 'upload_previous':
upload_prev(ver)
upload_prev(ver, user=args.user)
elif len(sys.argv) == 2:
for arg in sys.argv[1:]:
func = funcd.get(arg)
if func is None:
raise SystemExit('Do not know how to handle %s; valid args are %s' % (
arg, list(funcd.keys())))
func()
if args.user:
func(user=args.user)
else:
func()
else:
small_docs = False
all()
Expand Down