Page 1 of 1

Running miabuild from a script with compiler variables

Posted: Wed May 20, 2009 10:27 am
by aevanne
Hi,

I have been running miabuild from a (python) script successfully. However I have run into an issue: I need to pass the working path thru to IA from the script:

When I call
miabuild myproj.mpr WORKINGPATH=C:\\myPath\\myCode
it works fine.

However when I call
my_path = C:\\myPath\\myCode
miabuild myproj.mpr WORKINGPATH=my_path

it sets the path in the MSIcode to 'my_path'

I see what it's doing, but is there any way around this?

Thanks,
Aevanne.

Posted: Wed May 20, 2009 11:52 am
by bokkie
Aevanne,

I know little about Python but could it work the same way as it would in DOS, where you'd quote the variable like this: %my_path%? Python might have it's own syntax so that a variable can be distinguished from a literal.

Posted: Wed May 20, 2009 1:41 pm
by aevanne
Thanks Peter,

I'm not an expert on either IA or python, but it looks like python vars are 'as is'.

However, you gave me an idea and, for the record, the following works (It may not be a pretty solution tho :) )

tmp1_root = 'C:\\\\tmp1'
os.environ['TMP_TMP1_ROOT'] = tmp1_root

tmp2_root = 'C:\\\\tmp2'
os.environ['TMP_TMP2_ROOT'] = tmp2_root

os.system("""miabuild.exe myproj.mpr /o=out_dir TMP1_ROOT=%TMP_TMP1_ROOT% TMP2_ROOT=%TMP_TMP2_ROOT% """)

os.environ['TMP_TMP1_ROOT'] =''
os.environ['TMP_TMP2_ROOT'] =''