| 3 | 1 #!usr/bin/env python | 
|  | 2 | 
|  | 3 import os, sys | 
|  | 4 import subprocess | 
|  | 5 | 
|  | 6 """ | 
|  | 7     OSRA_DATA_FILES is set during the toolshed Installation | 
|  | 8     If it is not set, use the standard configuration of OSRA. | 
|  | 9     That means we need to delete argument 4-7. | 
|  | 10     That script is a hack, because we do not know the content of OSRA_DATA_FILES at xml evaluation time. | 
|  | 11 | 
|  | 12     osra -f $oformat $infile | 
|  | 13         -l \$OSRA_DATA_FILES/spelling.txt -a \$OSRA_DATA_FILES/superatom.txt | 
|  | 14         > $outfile | 
|  | 15 """ | 
|  | 16 | 
|  | 17 if not os.path.exists(sys.argv[6]): | 
|  | 18     # OSRA_DATA_FILES path is not set or the spelling file is not existent | 
|  | 19     sys.argv.pop(7) # superatom.txt path | 
|  | 20     sys.argv.pop(6) # -a | 
|  | 21     sys.argv.pop(5) # speling.txt path | 
|  | 22     sys.argv.pop(4) # -l | 
|  | 23 | 
|  | 24 subprocess.call(sys.argv[1:], stdout=sys.stdout) | 
|  | 25 | 
|  | 26 |