Changeset 153b75a in sasview for docs/sphinx-docs/build_sphinx.py
- Timestamp:
- Sep 4, 2018 11:37:06 AM (6 years ago)
- Branches:
- master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, unittest-saveload
- Children:
- 170b251
- Parents:
- 5d43213
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
docs/sphinx-docs/build_sphinx.py
rdf72475 r153b75a 8 8 from __future__ import print_function 9 9 10 import s ubprocess10 import sys 11 11 import os 12 12 from os.path import join as joinpath, abspath, dirname, isdir, exists, relpath 13 import sys14 import fnmatch15 13 import shutil 14 import subprocess 16 15 import imp 17 18 16 from glob import glob 19 17 from distutils.dir_util import copy_tree … … 21 19 from distutils.spawn import find_executable 22 20 23 from shutil import copy 24 from os import listdir 25 26 platform = '.%s-%s'%(get_platform(),sys.version[:3]) 21 PLATFORM = '.%s-%s'%(get_platform(), sys.version[:3]) 27 22 28 23 # sphinx paths … … 35 30 SASVIEW_ROOT = joinpath(SPHINX_ROOT, '..', '..') 36 31 SASVIEW_DOCS = joinpath(SPHINX_ROOT, "source") 37 SASVIEW_BUILD = abspath(joinpath(SASVIEW_ROOT, "build", "lib"+ platform))32 SASVIEW_BUILD = abspath(joinpath(SASVIEW_ROOT, "build", "lib"+PLATFORM)) 38 33 SASVIEW_MEDIA_SOURCE = joinpath(SASVIEW_ROOT, "src", "sas") 39 34 SASVIEW_DOC_TARGET = joinpath(SASVIEW_BUILD, "doc") … … 65 60 66 61 def inplace_change(filename, old_string, new_string): 67 # Thanks to http://stackoverflow.com/questions/4128144/replace-string-within-file-contents 68 s=open(filename).read() 69 if old_string in s: 70 print('Changing "{old_string}" to "{new_string}"'.format(**locals())) 71 s=s.replace(old_string, new_string) 72 f=open(filename, 'w') 73 f.write(s) 74 f.flush() 75 f.close() 76 else: 77 print('No occurences of "{old_string}" found.'.format(**locals())) 62 # Thanks to http://stackoverflow.com/questions/4128144/replace-string-within-file-contents 63 s = open(filename).read() 64 if old_string in s: 65 print('Changing "{old_string}" to "{new_string}"'.format(**locals())) 66 s = s.replace(old_string, new_string) 67 with open(filename, 'w') as f: 68 f.write(s) 69 else: 70 print('No occurences of "{old_string}" found.'.format(**locals())) 78 71 79 72 def _remove_dir(dir_path): … … 241 234 finally: 242 235 fd_in.close() 243 with ZipFile(cache_path) as zip:244 zip.extractall(destination)236 with ZipFile(cache_path) as archive: 237 archive.extractall(destination) 245 238 246 239 def convert_katex():
Note: See TracChangeset
for help on using the changeset viewer.