annotate osra.py @ 1:0916781bc971 draft

Uploaded
author bgruening
date Sun, 20 Apr 2014 09:03:07 -0400
parents 34ae5f2ae450
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
34ae5f2ae450 Uploaded
bgruening
parents:
diff changeset
1 #!usr/bin/env python
34ae5f2ae450 Uploaded
bgruening
parents:
diff changeset
2
34ae5f2ae450 Uploaded
bgruening
parents:
diff changeset
3 import os, sys
34ae5f2ae450 Uploaded
bgruening
parents:
diff changeset
4 import subprocess
34ae5f2ae450 Uploaded
bgruening
parents:
diff changeset
5
34ae5f2ae450 Uploaded
bgruening
parents:
diff changeset
6 """
34ae5f2ae450 Uploaded
bgruening
parents:
diff changeset
7 OSRA_DATA_FILES is set during the toolshed Installation
34ae5f2ae450 Uploaded
bgruening
parents:
diff changeset
8 If it is not set, use the standard configuration of OSRA.
34ae5f2ae450 Uploaded
bgruening
parents:
diff changeset
9 That means we need to delete argument 4-7.
34ae5f2ae450 Uploaded
bgruening
parents:
diff changeset
10 That script is a hack, because we do not know the content of OSRA_DATA_FILES at xml evaluation time.
34ae5f2ae450 Uploaded
bgruening
parents:
diff changeset
11
34ae5f2ae450 Uploaded
bgruening
parents:
diff changeset
12 osra -f $oformat $infile
34ae5f2ae450 Uploaded
bgruening
parents:
diff changeset
13 -l \$OSRA_DATA_FILES/spelling.txt -a \$OSRA_DATA_FILES/superatom.txt
34ae5f2ae450 Uploaded
bgruening
parents:
diff changeset
14 > $outfile
34ae5f2ae450 Uploaded
bgruening
parents:
diff changeset
15 """
34ae5f2ae450 Uploaded
bgruening
parents:
diff changeset
16
34ae5f2ae450 Uploaded
bgruening
parents:
diff changeset
17 if not os.path.exists(sys.argv[7]):
34ae5f2ae450 Uploaded
bgruening
parents:
diff changeset
18 # OSRA_DATA_FILES path is not set or the spelling file is not existent
34ae5f2ae450 Uploaded
bgruening
parents:
diff changeset
19 sys.argv.pop(7) # superatom.txt path
34ae5f2ae450 Uploaded
bgruening
parents:
diff changeset
20 sys.argv.pop(6) # -a
34ae5f2ae450 Uploaded
bgruening
parents:
diff changeset
21 sys.argv.pop(5) # speling.txt path
34ae5f2ae450 Uploaded
bgruening
parents:
diff changeset
22 sys.argv.pop(4) # -l
34ae5f2ae450 Uploaded
bgruening
parents:
diff changeset
23
34ae5f2ae450 Uploaded
bgruening
parents:
diff changeset
24 sys.argv[0] = 'osra'
34ae5f2ae450 Uploaded
bgruening
parents:
diff changeset
25 subprocess.call(sys.argv, stdout=sys.stdout)
34ae5f2ae450 Uploaded
bgruening
parents:
diff changeset
26
34ae5f2ae450 Uploaded
bgruening
parents:
diff changeset
27