Changes in docs/sphinx-docs/build_sphinx.py [3194371:01f1e17] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
docs/sphinx-docs/build_sphinx.py
r3194371 r01f1e17 324 324 print("!!!!NO MODEL DOCS WILL BE BUILT!!!!") 325 325 326 def fetch_katex(version, destination="_static"):327 from zipfile import ZipFile328 import urllib2329 url = "https://github.com/Khan/KaTeX/releases/download/%s/katex.zip" % version330 cache_path = "katex_%s.zip" % version331 if not os.path.exists(cache_path):332 try:333 fd_in = urllib2.urlopen(url)334 with open(cache_path, "wb") as fd_out:335 fd_out.write(fd_in.read())336 finally:337 fd_in.close()338 with ZipFile(cache_path) as zip:339 zip.extractall(destination)340 326 341 327 def retrieve_bumps_docs(): … … 374 360 SASVIEW_BUILD]) 375 361 376 def build_pdf():377 """378 Runs sphinx-build for pdf. Reads in all .rst files and spits out the final html.379 """380 print("=== Build PDF Docs from ReST Files ===")381 subprocess.call(["sphinx-build",382 "-b", "latex", # Builder name. TODO: accept as arg to setup.py.383 "-d", os.path.join(SPHINX_BUILD, "doctrees"),384 SPHINX_SOURCE,385 os.path.join(SPHINX_BUILD, "latex")])386 387 LATEXDIR = os.path.join(SPHINX_BUILD, "latex")388 def pdflatex():389 subprocess.call(["pdflatex", "Sasview.tex"], cwd=LATEXDIR)390 pdflatex()391 pdflatex()392 pdflatex()393 subprocess.call(["makeindex", "-s", "python.ist", "Sasview.idx"], cwd=LATEXDIR)394 pdflatex()395 pdflatex()396 397 print("=== Copy PDF to HTML Directory ===")398 source = os.path.join(LATEXDIR, "Sasview.pdf")399 target = os.path.join(SASVIEW_DOCS, "Sasview.pdf")400 shutil.copyfile(source, target)401 402 362 def build(): 403 363 """ 404 364 Runs sphinx-build. Reads in all .rst files and spits out the final html. 405 365 """ 406 print("=== Build HTML Docs from Re STFiles ===")366 print("=== Build HTML Docs from Rest Files ===") 407 367 subprocess.call(["sphinx-build", 408 368 "-b", "html", # Builder name. TODO: accept as arg to setup.py. … … 415 375 copy_tree(html, SASVIEW_DOCS) 416 376 417 def convert_katex():418 print("=== Preprocess HTML, converting latex to html ===")419 subprocess.call(["node", "convertKaTex.js", SASVIEW_DOCS])420 421 377 def rebuild(): 422 378 clean() … … 424 380 retrieve_user_docs() 425 381 retrieve_bumps_docs() 426 fetch_katex(version=KATEX_VERSION, destination=KATEX_PARENT)427 382 apidoc() 428 383 build() 429 #build_pdf()430 #convert_katex()431 384 432 385 print("=== Done ===")
Note: See TracChangeset
for help on using the changeset viewer.