Changeset b854587 in sasview for docs/sphinx-docs
- Timestamp:
- Apr 11, 2017 8:01:57 AM (8 years ago)
- 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.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 7b15990
- Parents:
- f36e01f (diff), a42fb8e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - git-author:
- Andrew Jackson <andrew.jackson@…> (04/11/17 08:01:57)
- git-committer:
- GitHub <noreply@…> (04/11/17 08:01:57)
- Location:
- docs/sphinx-docs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
docs/sphinx-docs/build_sphinx.py
r751f4bd r01f1e17 6 6 http://sphinx-doc.org/invocation.html 7 7 """ 8 from __future__ import print_function 9 8 10 import subprocess 9 11 import os … … 12 14 import shutil 13 15 import imp 16 14 17 from glob import glob 15 16 18 from distutils.dir_util import copy_tree 17 19 from distutils.util import get_platform … … 55 57 SASMODELS_DEST_BUILDIMG = os.path.join(SASMODELS_DEST_PROLOG, "user", "models", "img") 56 58 57 #if os.path.exists(SASMODELS_SOURCE_PROLOG):58 # print "Found models prolog folder at ", SASMODELS_SOURCE_PROLOG59 #if os.path.exists(SASMODELS_SOURCE_REF_MODELS):60 # print "Found models ref folder at ", SASMODELS_SOURCE_REF_MODELS61 #if os.path.exists(SASMODELS_SOURCE_MODELS):62 # print "Found models folder at ", SASMODELS_SOURCE_MODELS63 #if os.path.exists(SASMODELS_SOURCE_IMG):64 # print "Found img folder at ", SASMODELS_SOURCE_IMG65 #if os.path.exists(SASMODELS_DEST_REF_MODELS):66 # print "Found models ref folder at ", SASMODELS_DEST_REF_MODELS67 #if os.path.exists(SASMODELS_DEST_MODELS):68 # print "Found models folder at ", SASMODELS_DEST_MODELS69 #if os.path.exists(SASMODELS_DEST_IMG):70 # print "Found img folder at ", SASMODELS_DEST_IMG71 #sys.exit()72 59 73 60 SPHINX_BUILD = os.path.join(CURRENT_SCRIPT_DIR, "build") … … 88 75 s=open(filename).read() 89 76 if old_string in s: 90 print 'Changing "{old_string}" to "{new_string}"'.format(**locals())77 print('Changing "{old_string}" to "{new_string}"'.format(**locals())) 91 78 s=s.replace(old_string, new_string) 92 79 f=open(filename, 'w') … … 95 82 f.close() 96 83 else: 97 print 'No occurences of "{old_string}" found.'.format(**locals())84 print('No occurences of "{old_string}" found.'.format(**locals())) 98 85 99 86 def _remove_dir(dir_path): 100 87 """Removes the given directory.""" 101 88 if os.path.isdir(dir_path): 102 print "Removing \"%s\"... " % dir_path89 print("Removing \"%s\"... " % dir_path) 103 90 shutil.rmtree(dir_path) 104 91 … … 107 94 Clean the sphinx build directory. 108 95 """ 109 print "=== Cleaning Sphinx Build ==="96 print("=== Cleaning Sphinx Build ===") 110 97 _remove_dir(SASVIEW_DOCS) 111 98 _remove_dir(SPHINX_BUILD) … … 120 107 Copy the source toctrees to new folder for assembling the sphinx-docs 121 108 """ 122 print "=== Copying Source toctrees ==="109 print("=== Copying Source toctrees ===") 123 110 if os.path.exists(SASVIEW_TOC_SOURCE): 124 print "Found docs folder at ", SASVIEW_TOC_SOURCE111 print("Found docs folder at", SASVIEW_TOC_SOURCE) 125 112 shutil.copytree(SASVIEW_TOC_SOURCE, SPHINX_SOURCE) 126 113 … … 141 128 so that Sphinx may pick it up when generating the documentation. 142 129 """ 143 print "=== Retrieve User Docs ==="130 print("=== Retrieve User Docs ===") 144 131 145 132 # Copy documentation files from their "source" to their "destination". … … 148 135 149 136 docs = os.path.abspath(os.path.join(root, dirname)) 150 print "Found docs folder at \"%s\"." % docs137 print("Found docs folder at \"%s\"." % docs) 151 138 152 139 dest_dir_part = os.path.dirname(os.path.relpath(docs, SASVIEW_SRC)) … … 158 145 159 146 # Now pickup testdata_help.rst 160 # print os.path.abspath(SASVIEW_TEST) 161 # print os.path.abspath(SPHINX_SOURCE_TEST) 162 print "=== Including Test Data Docs ===" 147 print("=== Including Test Data Docs ===") 163 148 if os.path.exists(SASVIEW_TEST): 164 print "Found docs folder at ", SASVIEW_TEST149 print("Found docs folder at", SASVIEW_TEST) 165 150 shutil.copytree(SASVIEW_TEST, SPHINX_SOURCE_TEST) 166 151 167 print "=== And the Sasmodels Docs ==="152 print("=== And the Sasmodels Docs ===") 168 153 # Make sure we have the relevant images for the new sasmodels documentation 169 154 # First(!) we'll make a local reference copy for SasView (/new-models will be cleaned each build) 170 155 if os.path.exists(SASMODELS_SOURCE_IMG): 171 print "Found img folder SASMODELS_SOURCE_IMG at ", SASMODELS_SOURCE_IMG156 print("Found img folder SASMODELS_SOURCE_IMG at", SASMODELS_SOURCE_IMG) 172 157 if not os.path.exists(SASMODELS_DEST_IMG): 173 print "Missing docs folder SASMODELS_DEST_IMG at ", SASMODELS_DEST_IMG158 print("Missing docs folder SASMODELS_DEST_IMG at", SASMODELS_DEST_IMG) 174 159 os.makedirs(SASMODELS_DEST_IMG) 175 print "created SASMODELS_DEST_BUILDIMG at ", SASMODELS_DEST_BUILDIMG 176 else: print "Found img folder SASMODELS_DEST_IMG at ", SASMODELS_DEST_IMG 177 print "Copying sasmodels model image files..." 160 print("created SASMODELS_DEST_BUILDIMG at", SASMODELS_DEST_BUILDIMG) 161 else: 162 print("Found img folder SASMODELS_DEST_IMG at", SASMODELS_DEST_IMG) 163 print("Copying sasmodels model image files...") 178 164 for files in os.listdir(SASMODELS_SOURCE_IMG): 179 165 fromhere=os.path.join(SASMODELS_SOURCE_IMG,files) 180 166 tohere=os.path.join(SASMODELS_DEST_IMG,files) 181 167 shutil.copy(fromhere,tohere) 182 else: print "cannot find SASMODELS_SOURCE_IMG", SASMODELS_SOURCE_IMG 168 else: 169 print("no source directory",SASMODELS_SOURCE_IMG,"was found") 183 170 184 171 if os.path.exists(SASMODELS_SOURCE_AUTOIMG): 185 print "Found img folder SASMODELS_SOURCE_AUTOIMG at ", SASMODELS_SOURCE_AUTOIMG172 print("Found img folder SASMODELS_SOURCE_AUTOIMG at", SASMODELS_SOURCE_AUTOIMG) 186 173 if not os.path.exists(SASMODELS_DEST_IMG): 187 print "Missing docs folder SASMODELS_DEST_IMG at ", SASMODELS_DEST_IMG174 print("Missing docs folder SASMODELS_DEST_IMG at", SASMODELS_DEST_IMG) 188 175 os.makedirs(SASMODELS_DEST_BUILDIMG) 189 print "created SASMODELS_DEST_BUILDIMG at ", SASMODELS_DEST_BUILDIMG190 print "Copying sasmodels model auto-generated image files..."176 print("created SASMODELS_DEST_BUILDIMG at", SASMODELS_DEST_BUILDIMG) 177 print("Copying sasmodels model auto-generated image files...") 191 178 for files in os.listdir(SASMODELS_SOURCE_AUTOIMG): 192 179 fromhere=os.path.join(SASMODELS_SOURCE_AUTOIMG,files) 193 180 tohere=os.path.join(SASMODELS_DEST_IMG,files) 194 181 shutil.copy(fromhere,tohere) 195 else: print "no source directory",SASMODELS_SOURCE_AUTOIMG ,"was found" 182 else: 183 print("no source directory",SASMODELS_SOURCE_AUTOIMG ,"was found") 196 184 197 185 # And the rst prolog with the unit substitutions 198 186 if os.path.exists(SASMODELS_SOURCE_PROLOG): 199 print "Found prolog folder SASMODELS_SOURCE_PROLOG at ", SASMODELS_SOURCE_PROLOG187 print("Found prolog folder SASMODELS_SOURCE_PROLOG at", SASMODELS_SOURCE_PROLOG) 200 188 if os.path.exists(SASMODELS_DEST_PROLOG): 201 print "Found docs folder SASMODELS_DEST_PROLOG at ", SASMODELS_DEST_PROLOG202 print "Copying sasmodels rst_prolog file..."189 print("Found docs folder SASMODELS_DEST_PROLOG at", SASMODELS_DEST_PROLOG) 190 print("Copying sasmodels rst_prolog file...") 203 191 for files in os.listdir(SASMODELS_SOURCE_PROLOG): 204 192 if files.startswith("rst"): … … 206 194 tohere=os.path.join(SASMODELS_DEST_PROLOG,files) 207 195 shutil.copy(fromhere,tohere) 196 else: 197 print("no source directory",SASMODELS_SOURCE_PROLOG, "was found") 208 198 209 199 if os.path.exists(SASMODELS_SOURCE_GPU): 210 print "Found docs folder SASMODELS_SOURCE_GPU at ", SASMODELS_SOURCE_GPU200 print("Found docs folder SASMODELS_SOURCE_GPU at", SASMODELS_SOURCE_GPU) 211 201 if os.path.exists(SPHINX_SOURCE_USER): 212 print "Found docs folder SPHINX_SOURCE_USER at ", SPHINX_SOURCE_USER213 print "Copying sasmodels gpu files..."202 print("Found docs folder SPHINX_SOURCE_USER at", SPHINX_SOURCE_USER) 203 print("Copying sasmodels gpu files...") 214 204 for files in os.listdir(SASMODELS_SOURCE_GPU): 215 205 if files.endswith(".rst"): … … 217 207 tohere=os.path.join(SPHINX_SOURCE_USER,files) 218 208 shutil.copy(fromhere,tohere) 209 else: 210 print("no source directory",SASMODELS_SOURCE_GPU,"was found") 219 211 220 212 if os.path.exists(SASMODELS_SOURCE_SESANS): 221 print "Found docs folder SASMODELS_SOURCE_SESANS at ", SASMODELS_SOURCE_SESANS213 print("Found docs folder SASMODELS_SOURCE_SESANS at", SASMODELS_SOURCE_SESANS) 222 214 if os.path.exists(SPHINX_SOURCE_USER): 223 print "Found docs folder SPHINX_SOURCE_USER at ", SPHINX_SOURCE_USER224 print "Copying sasmodels sesans files..."215 print("Found docs folder SPHINX_SOURCE_USER at", SPHINX_SOURCE_USER) 216 print("Copying sasmodels sesans files...") 225 217 for files in os.listdir(SASMODELS_SOURCE_SESANS): 226 218 if files.endswith(".rst"): … … 228 220 tohere=os.path.join(SPHINX_SOURCE_USER,files) 229 221 shutil.copy(fromhere,tohere) 222 else: 223 print("no source directory",SASMODELS_SOURCE_SESANS,"was found") 230 224 231 225 if os.path.exists(SASMODELS_SOURCE_MAGNETISM): 232 print "Found docs folder SASMODELS_SOURCE_MAGNETISM at ", SASMODELS_SOURCE_MAGNETISM226 print("Found docs folder SASMODELS_SOURCE_MAGNETISM at", SASMODELS_SOURCE_MAGNETISM) 233 227 if os.path.exists(SASMODELS_DEST_REF_MODELS): 234 print "Found docs folder SASMODELS_DEST_REF_MODELS at ", SASMODELS_DEST_REF_MODELS235 print "Copying sasmodels model toctree files..."228 print("Found docs folder SASMODELS_DEST_REF_MODELS at", SASMODELS_DEST_REF_MODELS) 229 print("Copying sasmodels model toctree files...") 236 230 for files in os.listdir(SASMODELS_SOURCE_MAGNETISM): 237 231 if files.endswith(".rst"): … … 239 233 tohere=os.path.join(SASMODELS_DEST_REF_MODELS,files) 240 234 shutil.copy(fromhere,tohere) 235 else: 236 print("no source directory",SASMODELS_SOURCE_MAGNETISM,"was found") 241 237 242 238 if os.path.exists(SASMODELS_SOURCE_MAGIMG): 243 print "Found img folder SASMODELS_SOURCE_MAGIMG at ", SASMODELS_SOURCE_MAGIMG239 print("Found img folder SASMODELS_SOURCE_MAGIMG at", SASMODELS_SOURCE_MAGIMG) 244 240 if not os.path.exists(SASMODELS_DEST_MAGIMG): 245 print "Missing img folder SASMODELS_DEST_MAGIMG at ", SASMODELS_DEST_MAGIMG241 print("Missing img folder SASMODELS_DEST_MAGIMG at", SASMODELS_DEST_MAGIMG) 246 242 os.makedirs(SASMODELS_DEST_MAGIMG) 247 print "created SASMODELS_DEST_MAGIMG at ", SASMODELS_DEST_MAGIMG248 print "Copying sasmodels mag image files..."243 print("created SASMODELS_DEST_MAGIMG at", SASMODELS_DEST_MAGIMG) 244 print("Copying sasmodels mag image files...") 249 245 for files in os.listdir(SASMODELS_SOURCE_MAGIMG): 250 246 fromhere=os.path.join(SASMODELS_SOURCE_MAGIMG,files) 251 247 tohere=os.path.join(SASMODELS_DEST_MAGIMG,files) 252 248 shutil.copy(fromhere,tohere) 253 else: print "no source directory",SASMODELS_SOURCE_MAGIMG ,"was found" 249 else: 250 print("no source directory",SASMODELS_SOURCE_MAGIMG ,"was found") 254 251 255 252 if os.path.exists(SASMODELS_SOURCE_SESANSIMG): 256 print "Found img folder SASMODELS_SOURCE_SESANSIMG at ", SASMODELS_SOURCE_SESANSIMG253 print("Found img folder SASMODELS_SOURCE_SESANSIMG at", SASMODELS_SOURCE_SESANSIMG) 257 254 if not os.path.exists(SASMODELS_DEST_SESANSIMG): 258 print "Missing img folder SASMODELS_DEST_SESANSIMG at ", SASMODELS_DEST_SESANSIMG255 print("Missing img folder SASMODELS_DEST_SESANSIMG at", SASMODELS_DEST_SESANSIMG) 259 256 os.makedirs(SASMODELS_DEST_SESANSIMG) 260 print "created SASMODELS_DEST_SESANSIMG at ", SASMODELS_DEST_SESANSIMG261 print "Copying sasmodels sesans image files..."257 print("created SASMODELS_DEST_SESANSIMG at", SASMODELS_DEST_SESANSIMG) 258 print("Copying sasmodels sesans image files...") 262 259 for files in os.listdir(SASMODELS_SOURCE_SESANSIMG): 263 260 fromhere=os.path.join(SASMODELS_SOURCE_SESANSIMG,files) 264 261 tohere=os.path.join(SASMODELS_DEST_SESANSIMG,files) 265 262 shutil.copy(fromhere,tohere) 266 else: print "no source directory",SASMODELS_SOURCE_SESANSIMG ,"was found" 263 else: 264 print("no source directory",SASMODELS_SOURCE_SESANSIMG ,"was found") 267 265 268 266 if os.path.exists(SASMODELS_SOURCE_REF_MODELS): 269 print "Found docs folder SASMODELS_SOURCE_REF_MODELS at ", SASMODELS_SOURCE_REF_MODELS267 print("Found docs folder SASMODELS_SOURCE_REF_MODELS at", SASMODELS_SOURCE_REF_MODELS) 270 268 if os.path.exists(SASMODELS_DEST_REF_MODELS): 271 print "Found docs folder SASMODELS_DEST_REF_MODELS at ", SASMODELS_DEST_REF_MODELS272 print "Copying sasmodels model toctree files..."269 print("Found docs folder SASMODELS_DEST_REF_MODELS at", SASMODELS_DEST_REF_MODELS) 270 print("Copying sasmodels model toctree files...") 273 271 for files in os.listdir(SASMODELS_SOURCE_REF_MODELS): 274 272 if files.endswith(".rst"): … … 276 274 tohere=os.path.join(SASMODELS_DEST_REF_MODELS,files) 277 275 shutil.copy(fromhere,tohere) 278 # But need to change the path to the model docs in the tocs 279 for files in os.listdir(SASMODELS_DEST_REF_MODELS): 280 # print files 281 if files.startswith("shape"): 282 print "Changing toc paths in", files 283 inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/") 284 if files.startswith("sphere"): 285 print "Changing toc paths in", files 286 inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/") 287 if files.startswith("custom"): 288 print "Changing toc paths in", files 289 inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/") 290 if files.startswith("structure"): 291 print "Changing toc paths in", files 292 inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/") 276 # But need to change the path to the model docs in the tocs 277 for files in os.listdir(SASMODELS_DEST_REF_MODELS): 278 # print files 279 if files.startswith("shape"): 280 print("Changing toc paths in", files) 281 inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/") 282 if files.startswith("sphere"): 283 print("Changing toc paths in", files) 284 inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/") 285 if files.startswith("custom"): 286 print("Changing toc paths in", files) 287 inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/") 288 if files.startswith("structure"): 289 print("Changing toc paths in", files) 290 inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/") 291 else: 292 print("no source directory",SASMODELS_SOURCE_REF_MODELS," was found") 293 293 294 294 if os.path.exists(SASMODELS_SOURCE_MODELS): 295 print "Found docs folder SASMODELS_SOURCE_MODELS at ", SASMODELS_SOURCE_MODELS295 print("Found docs folder SASMODELS_SOURCE_MODELS at", SASMODELS_SOURCE_MODELS) 296 296 if os.path.exists(SASMODELS_DEST_MODELS): 297 print "Found docs folder SASMODELS_DEST_MODELS at ", SASMODELS_DEST_MODELS298 print "Copying sasmodels model files..."297 print("Found docs folder SASMODELS_DEST_MODELS at", SASMODELS_DEST_MODELS) 298 print("Copying sasmodels model files...") 299 299 for files in os.listdir(SASMODELS_SOURCE_MODELS): 300 300 if files.endswith(".rst"): … … 303 303 shutil.copy(fromhere,tohere) 304 304 else: 305 print "Missing docs folder SASMODELS_DEST_MODELS at ", SASMODELS_DEST_MODELS305 print("Missing docs folder SASMODELS_DEST_MODELS at", SASMODELS_DEST_MODELS) 306 306 os.makedirs(SASMODELS_DEST_MODELS) 307 307 if not os.path.exists(SASMODELS_DEST_BUILDIMG): 308 308 os.makedirs(SASMODELS_DEST_BUILDIMG) 309 print "Created docs folder SASMODELS_DEST_MODELS at ", SASMODELS_DEST_MODELS310 print "Copying model files for build..."309 print("Created docs folder SASMODELS_DEST_MODELS at", SASMODELS_DEST_MODELS) 310 print("Copying model files for build...") 311 311 for files in os.listdir(SASMODELS_SOURCE_MODELS): 312 312 if files.endswith(".rst"): … … 315 315 shutil.copy(fromhere,tohere) 316 316 # No choice but to do this because model files are all coded for images in /models/img 317 print "Copying image files for build..."317 print("Copying image files for build...") 318 318 for files in os.listdir(SASMODELS_DEST_IMG): 319 319 fromhere=os.path.join(SASMODELS_DEST_IMG,files) 320 320 tohere=os.path.join(SASMODELS_DEST_BUILDIMG,files) 321 321 shutil.copy(fromhere,tohere) 322 else: 323 print("no source directory",SASMODELS_SOURCE_MODELS,"was found.") 324 print("!!!!NO MODEL DOCS WILL BE BUILT!!!!") 322 325 323 326 … … 327 330 """ 328 331 if os.path.exists(BUMPS_DOCS): 329 print "=== Retrieve BUMPS Docs ==="332 print("=== Retrieve BUMPS Docs ===") 330 333 filenames = [os.path.join(BUMPS_DOCS, "optimizer.rst")] 331 334 filenames += glob(os.path.join(BUMPS_DOCS, "dream-*.png")) 332 335 filenames += glob(os.path.join(BUMPS_DOCS, "fit-*.png")) 333 336 for f in filenames: 334 print "Copying file", f337 print("Copying file", f) 335 338 shutil.copy(f, BUMPS_TARGET) 336 339 else: 337 print """ 338 *** Error *** missing directory %s 340 print(""" 341 ======= Error ======= 342 missing directory %s 339 343 The documentation will not include the optimizer selection section. 340 344 Checkout the bumps source tree and rebuild the docs. 341 342 343 """ % BUMPS_DOCS 345 """ % BUMPS_DOCS) 344 346 345 347 def apidoc(): … … 348 350 in the SasView build directory. 349 351 """ 350 print "=== Generate API Rest Files ==="352 print("=== Generate API Rest Files ===") 351 353 352 354 # Clean directory before generating a new version. … … 362 364 Runs sphinx-build. Reads in all .rst files and spits out the final html. 363 365 """ 364 print "=== Build HTML Docs from Rest Files ==="366 print("=== Build HTML Docs from Rest Files ===") 365 367 subprocess.call(["sphinx-build", 366 368 "-b", "html", # Builder name. TODO: accept as arg to setup.py. … … 369 371 os.path.join(SPHINX_BUILD, "html")]) 370 372 371 print "=== Copy HTML Docs to Build Directory ==="373 print("=== Copy HTML Docs to Build Directory ===") 372 374 html = os.path.join(SPHINX_BUILD, "html") 373 375 copy_tree(html, SASVIEW_DOCS) … … 381 383 build() 382 384 383 print "=== Done ==="385 print("=== Done ===") 384 386 385 387 if __name__ == "__main__": -
docs/sphinx-docs/source/user/tutorial.rst
r959eb01 r461a917 3 3 .. _tutorial: 4 4 5 Tutorial 6 ======== 5 Tutorials 6 ========= 7 7 8 8 .. note:: In Windows use [Alt]-[Cursor left] to return to the previous page 9 9 10 :download:`Tutorial <../../../../sasview/media/Tutorial.pdf>` 10 :download:`Getting Started with Sasview <../../../../sasview/media/getting_started_with_sasview.pdf>` 11 12 :download:`Old Tutorial <../../../../sasview/media/Tutorial.pdf>` -
docs/sphinx-docs/source/user/working.rst
r959eb01 r8cc39d6 15 15 Test Data <../test/testdata_help.rst> 16 16 17 Tutorial <tutorial.rst>17 Tutorials <tutorial.rst> 18 18 19 19 Writing a Plugin Model <sasgui/perspectives/fitting/plugin.rst>
Note: See TracChangeset
for help on using the changeset viewer.