1 | # writes out approximate entries to put in GSASIIctrls tutorialCatalog |
---|
2 | import glob,os,re |
---|
3 | # make subdirectories in help & Exercises (trunk and MT) |
---|
4 | import subprocess |
---|
5 | import os |
---|
6 | cmd = 'svn propset svn:mime-type application/octet-stream ' |
---|
7 | subprocess.call(cmd+'*/*/*.png',shell=True) |
---|
8 | subprocess.call(cmd+'*/*/*.jpg',shell=True) |
---|
9 | subprocess.call(cmd+'*/*/*.gif',shell=True) |
---|
10 | # |
---|
11 | cmd = ['svn','propset','svn:mime-type','text/html'] |
---|
12 | cmd1 = ['svn','add'] |
---|
13 | for f in glob.glob('*/*.htm'): |
---|
14 | subprocess.call(cmd+[f]) |
---|
15 | for dr in ('../MT/help','../MT/Exercises','../GSASII/help/','../GSASII/Exercises/'): |
---|
16 | d = os.path.join(dr,os.path.split(f)[0]) |
---|
17 | if not os.path.exists(d): |
---|
18 | os.mkdir(d) |
---|
19 | subprocess.call(cmd1+[d]) |
---|
20 | for f in glob.glob('*/*.htm'): |
---|
21 | p,n = os.path.split(f) |
---|
22 | |
---|
23 | fp = open(f,'r') |
---|
24 | t = '' |
---|
25 | for l in fp: |
---|
26 | if 'h1>' in l.lower(): t += l |
---|
27 | fp.close() |
---|
28 | t = re.sub('\n',' ',t) |
---|
29 | t = re.sub('\r',' ',t) |
---|
30 | t = re.sub('<.*?>','',t) |
---|
31 | t = re.sub(' +',' ',t).strip() |
---|
32 | print (" ['"+p+"', '"+p+"', '"+n+"',\n '"+t+"'],") |
---|
33 | |
---|
34 | print '''Remaining steps: |
---|
35 | (1) add help info to GSASIIctrls.py |
---|
36 | (2) check in changes to ../Tutorials ../Exercises ../MT and ../GSASII |
---|
37 | ''' |
---|