build - How to access ant variables in python script -


i have made build.properties file in ant in have defined variables shown below

webinf.dir = web-inf  src.dir = ${webinf.dir}/src 

now these variable accessed in ant build.xml file , working fine. want access these variables in python file also. , want value of src.dir come web-inf/src not ${webinf.dir}/src

please how can this.

thanks..

i believe can use single properties file (e.g. build.py) that's read ant , python. example:

build.xml

<project default="build">     <property file="build.py"/>     <target name="build">         <echo message="${src.webinf}"/>     </target> </project> 

script.py

#!/usr/bin/python  import configparser config = configparser.configparser() config.read("build.py") print config.get("properties", "src.webinf") 

build.py

[properties] src.webinf = web-inf 

example usage

$ ant buildfile: /applications/mamp/htdocs/clicks/test/build.xml  build:      [echo] web-inf  build successful total time: 0 seconds  $ python script.py  web-inf 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -