contrib: learn to build website/_uploads

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht
2018-04-09 01:37:40 +02:00
parent dd0be5e166
commit 57b2794bfb
3 changed files with 57 additions and 8 deletions

View File

@ -26,7 +26,7 @@ from helpers import (
)
__VERSION__ = "0.1"
__VERSION__ = "0.2"
SPHINXBUILD = 'sphinx-build'
DOCSDIR = 'docs'
@ -260,6 +260,15 @@ Pip:
class Website(object):
def updateUploads(self):
req = ("update uploads/ of the website? "
"(warning: checksums will change if they already exist)")
if User.yesNo(req, defaultToYes=True) is False:
return False
if check_call(shlex.split("./docs/build-uploads.sh")) != 0:
return exit(5)
return True
def updateAPI(self):
req = "update API of the website? (requires {})".format(SPHINXBUILD)
if User.yesNo(req, defaultToYes=True) is False:
@ -292,9 +301,7 @@ Then, commit and push changes of the website.""".format(SPHINXBUILD, DOCSDIR))
with open(WEBSITE_LATEST, 'w') as fd:
fd.write(WEBSITE_LATEST_SKEL.format(stable=version))
def exportDocs(self, version):
branchName = "import-v{}".format(version)
def exportDocs(self):
if not goTo(DOCSDIR):
User.pause()
return
@ -303,6 +310,9 @@ Then, commit and push changes of the website.""".format(SPHINXBUILD, DOCSDIR))
print("error while calling 'make websitedoc'")
exit(3)
def createImportBranch(self, version):
branchName = "import-v{}".format(version)
Git.chdirToRepositoryTopLevel()
if not goTo("website"):
User.pause()
@ -410,8 +420,12 @@ class Release(object):
self.state.saveWebsite()
website = Website()
website.buildLatest(newVersion)
if website.updateAPI():
self.websiteBranch = website.exportDocs(newVersion)
res_upload = website.updateUploads()
res_api = website.updateAPI()
if res_api:
res_export = website.exportDocs()
if True in [res_upload, res_api, res_export]:
self.websiteBranch = website.createImportBranch(newVersion)
def getWebsiteBranch(self):
return self.websiteBranch