# writes out approximate entries to put in GSASIIctrls tutorialCatalog import glob,os,re # make subdirectories in help & Exercises (trunk and MT) import subprocess import os cmd = 'svn propset svn:mime-type application/octet-stream ' subprocess.call(cmd+'*/*/*.png',shell=True) subprocess.call(cmd+'*/*/*.jpg',shell=True) subprocess.call(cmd+'*/*/*.gif',shell=True) # cmd = ['svn','propset','svn:mime-type','text/html'] cmd1 = ['svn','add'] for f in glob.glob('*/*.htm'): subprocess.call(cmd+[f]) for dr in ('../MT/help','../MT/Exercises','../GSASII/help/','../GSASII/Exercises/'): d = os.path.join(dr,os.path.split(f)[0]) if not os.path.exists(d): os.mkdir(d) subprocess.call(cmd1+[d]) for f in glob.glob('*/*.htm'): p,n = os.path.split(f) fp = open(f,'r') t = '' for l in fp: if 'h1>' in l.lower(): t += l fp.close() t = re.sub('\n',' ',t) t = re.sub('\r',' ',t) t = re.sub('<.*?>','',t) t = re.sub(' +',' ',t).strip() print (" ['"+p+"', '"+p+"', '"+n+"',\n '"+t+"'],") print '''Remaining steps: (1) add help info to GSASIIctrls.py (2) check in changes to ../Tutorials ../Exercises ../MT and ../GSASII '''