Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • docs/sphinx-docs/build_sphinx.py

    r3194371 r01f1e17  
    324324        print("!!!!NO MODEL DOCS WILL BE BUILT!!!!") 
    325325 
    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) 
    340326 
    341327def retrieve_bumps_docs(): 
     
    374360                     SASVIEW_BUILD]) 
    375361 
    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  
    402362def build(): 
    403363    """ 
    404364    Runs sphinx-build.  Reads in all .rst files and spits out the final html. 
    405365    """ 
    406     print("=== Build HTML Docs from ReST Files ===") 
     366    print("=== Build HTML Docs from Rest Files ===") 
    407367    subprocess.call(["sphinx-build", 
    408368                     "-b", "html", # Builder name. TODO: accept as arg to setup.py. 
     
    415375    copy_tree(html, SASVIEW_DOCS) 
    416376 
    417 def convert_katex(): 
    418     print("=== Preprocess HTML, converting latex to html ===") 
    419     subprocess.call(["node", "convertKaTex.js", SASVIEW_DOCS]) 
    420  
    421377def rebuild(): 
    422378    clean() 
     
    424380    retrieve_user_docs() 
    425381    retrieve_bumps_docs() 
    426     fetch_katex(version=KATEX_VERSION, destination=KATEX_PARENT) 
    427382    apidoc() 
    428383    build() 
    429     #build_pdf() 
    430     #convert_katex() 
    431384 
    432385    print("=== Done ===") 
Note: See TracChangeset for help on using the changeset viewer.