Changes in docs/sphinx-docs/build_sphinx.py [01f1e17:3194371] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
docs/sphinx-docs/build_sphinx.py
r01f1e17 r3194371 324 324 print("!!!!NO MODEL DOCS WILL BE BUILT!!!!") 325 325 326 def fetch_katex(version, destination="_static"): 327 from zipfile import ZipFile 328 import urllib2 329 url = "https://github.com/Khan/KaTeX/releases/download/%s/katex.zip" % version 330 cache_path = "katex_%s.zip" % version 331 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) 326 340 327 341 def retrieve_bumps_docs(): … … 360 374 SASVIEW_BUILD]) 361 375 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 362 402 def build(): 363 403 """ 364 404 Runs sphinx-build. Reads in all .rst files and spits out the final html. 365 405 """ 366 print("=== Build HTML Docs from Re stFiles ===")406 print("=== Build HTML Docs from ReST Files ===") 367 407 subprocess.call(["sphinx-build", 368 408 "-b", "html", # Builder name. TODO: accept as arg to setup.py. … … 375 415 copy_tree(html, SASVIEW_DOCS) 376 416 417 def convert_katex(): 418 print("=== Preprocess HTML, converting latex to html ===") 419 subprocess.call(["node", "convertKaTex.js", SASVIEW_DOCS]) 420 377 421 def rebuild(): 378 422 clean() … … 380 424 retrieve_user_docs() 381 425 retrieve_bumps_docs() 426 fetch_katex(version=KATEX_VERSION, destination=KATEX_PARENT) 382 427 apidoc() 383 428 build() 429 #build_pdf() 430 #convert_katex() 384 431 385 432 print("=== Done ===")
Note: See TracChangeset
for help on using the changeset viewer.