Changeset bb0c836 in sasview
- Timestamp:
- Mar 21, 2016 7:11:16 AM (9 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.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:
- 66f21cd
- Parents:
- f1a28b4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
docs/sphinx-docs/build_sphinx.py
r756e8ce rbb0c836 35 35 #/sasview-local-trunk/docs/sphinx-docs/build_sphinx.py 36 36 SASMODELS_SOURCE_PROLOG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc") 37 #SASMODELS_SOURCE_REF_MODELS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "models")37 SASMODELS_SOURCE_REF_MODELS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "ref", "models") 38 38 SASMODELS_SOURCE_MODELS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "model") 39 39 SASMODELS_SOURCE_IMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "model", "img") … … 71 71 BUMPS_TARGET = os.path.join(SPHINX_SOURCE_PERSPECTIVES, "fitting") 72 72 73 def inplace_change(filename, old_string, new_string): 74 # Thanks to http://stackoverflow.com/questions/4128144/replace-string-within-file-contents 75 s=open(filename).read() 76 if old_string in s: 77 print 'Changing "{old_string}" to "{new_string}"'.format(**locals()) 78 s=s.replace(old_string, new_string) 79 f=open(filename, 'w') 80 f.write(s) 81 f.flush() 82 f.close() 83 else: 84 print 'No occurences of "{old_string}" found.'.format(**locals()) 85 73 86 def _remove_dir(dir_path): 74 87 """Removes the given directory.""" … … 154 167 shutil.copy(fromhere,tohere) 155 168 156 # ACTUALLY IT TURNED OUT WE NEED TO EDIT THE TOCTREES SO THIS COPY WASN'T USEFUL IN THE END! 157 # And the relevant rst descriptions for the new sasmodels documentation 158 # if os.path.exists(SASMODELS_SOURCE_REF_MODELS): 159 # print "Found docs folder SASMODELS_SOURCE_REF_MODELS at ", SASMODELS_SOURCE_REF_MODELS 160 # if os.path.exists(SASMODELS_DEST_REF_MODELS): 161 # print "Found docs folder SASMODELS_DEST_REF_MODELS at ", SASMODELS_DEST_REF_MODELS 162 # print "Copying sasmodels model toctree files..." 163 # for files in os.listdir(SASMODELS_SOURCE_REF_MODELS): 164 # if files.endswith(".rst"): 165 # fromhere=os.path.join(SASMODELS_SOURCE_REF_MODELS,files) 166 # tohere=os.path.join(SASMODELS_DEST_REF_MODELS,files) 167 # shutil.copy(fromhere,tohere) 169 if os.path.exists(SASMODELS_SOURCE_REF_MODELS): 170 print "Found docs folder SASMODELS_SOURCE_REF_MODELS at ", SASMODELS_SOURCE_REF_MODELS 171 if os.path.exists(SASMODELS_DEST_REF_MODELS): 172 print "Found docs folder SASMODELS_DEST_REF_MODELS at ", SASMODELS_DEST_REF_MODELS 173 print "Copying sasmodels model toctree files..." 174 for files in os.listdir(SASMODELS_SOURCE_REF_MODELS): 175 if files.endswith(".rst"): 176 fromhere=os.path.join(SASMODELS_SOURCE_REF_MODELS,files) 177 tohere=os.path.join(SASMODELS_DEST_REF_MODELS,files) 178 shutil.copy(fromhere,tohere) 179 # But need to change the path to the model docs in the tocs 180 for files in os.listdir(SASMODELS_DEST_REF_MODELS): 181 # print files 182 if files.startswith("shape"): 183 print "Changing toc paths in", files 184 inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/") 185 if files.startswith("sphere"): 186 print "Changing toc paths in", files 187 inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/") 188 if files.startswith("custom"): 189 print "Changing toc paths in", files 190 inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/") 191 if files.startswith("structure"): 192 print "Changing toc paths in", files 193 inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/") 168 194 169 195 if os.path.exists(SASMODELS_SOURCE_MODELS):
Note: See TracChangeset
for help on using the changeset viewer.