Changeset 7d6f1bd in sasview for docs/sphinx-docs/build_sphinx.py


Ignore:
Timestamp:
Apr 5, 2014 7:24:06 AM (11 years ago)
Author:
Peter Parker
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
30fbe6d
Parents:
f330d67
Message:

Refs #202 - Copy built docs to SasView? build folder.

File:
1 edited

Legend:

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

    ra40a875 r7d6f1bd  
    2020SASVIEW_SRC = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "src") 
    2121SASVIEW_BUILD = os.path.abspath(os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "build", "lib"+platform)) 
     22SASVIEW_DOCS = os.path.join(SASVIEW_BUILD, "doc") 
    2223 
    2324SPHINX_BUILD = os.path.join(CURRENT_SCRIPT_DIR, "build") 
    2425SPHINX_SOURCE = os.path.join(CURRENT_SCRIPT_DIR, "source") 
    25 SPHINX_SOURCE_API = os.path.join(SPHINX_SOURCE, "dev","api") 
     26SPHINX_SOURCE_API = os.path.join(SPHINX_SOURCE, "dev", "api") 
    2627 
    2728def _remove_dir(dir_path): 
     
    4041def retrieve_user_docs(): 
    4142    """ 
    42     Copies across the contents of any docs/ directories in src/, and puts them 
     43    Copies across the contents of any media/ directories in src/, and puts them 
    4344    in an appropriately named directory of docs/sphinx-docs/source/. For 
    4445    example: 
    4546 
    46     sans/../[MODULE]/docs/A.rst 
    47     sans/../[MODULE]/docs/B.rst 
     47        sans/../[MODULE]/media/dir/A.rst 
     48        sans/../[MODULE]/media/B.rst 
    4849 
    4950    gets copied to a new location: 
    5051 
    51     docs/sphinx-docs/source/user/[MODULE]/A.rst 
    52     docs/sphinx-docs/source/user/[MODULE]/B.rst 
     52        docs/sphinx-docs/source/user/[MODULE]/dir/A.rst 
     53        docs/sphinx-docs/source/user/[MODULE]/B.rst 
    5354 
    5455    so that Sphinx may pick it up when generating the documentation. 
     
    5859    # Copy documentation files from their "source" to their "destination". 
    5960    for root, dirnames, _ in os.walk(SASVIEW_SRC): 
    60         for dirname in fnmatch.filter(dirnames, 'docs'): 
     61        for dirname in fnmatch.filter(dirnames, 'media'): 
    6162 
    6263            docs = os.path.abspath(os.path.join(root, dirname)) 
     
    6667            dest_dir = os.path.join(SPHINX_SOURCE, "user", dest_dir_name) 
    6768 
    68             copy_tree(docs, dest_dir, update=1) 
     69            copy_tree(docs, dest_dir) 
    6970 
    7071def apidoc(): 
     
    8788    Runs sphinx-build.  Reads in all .rst files and spits out the final html. 
    8889    """ 
    89     print "=== Build HTML from Rest Files ===" 
     90    print "=== Build HTML Docs from Rest Files ===" 
    9091    subprocess.call(["sphinx-build", 
    91                      "-b", "html", # Builder name. 
    92                      "-d", os.path.join(SPHINX_BUILD, "doctrees"), # Cache directory (doctrees). 
     92                     "-b", "html", # Builder name. TODO: accept as arg to setup.py. 
     93                     "-d", os.path.join(SPHINX_BUILD, "doctrees"), 
    9394                     SPHINX_SOURCE, 
    9495                     os.path.join(SPHINX_BUILD, "html")]) 
    9596 
     97    print "=== Copy HTML Docs to Build Directory ===" 
     98    html = os.path.join(SPHINX_BUILD, "html") 
     99    copy_tree(html, SASVIEW_DOCS) 
     100 
    96101if __name__ == "__main__": 
    97102    call() 
Note: See TracChangeset for help on using the changeset viewer.