Thank a bunch for the reply!

I have never used p.resolveFile() and am having a hard time finding documentation on it. Is it Ant api or python?

Would you use it directly inside <script>? Would you use it for the sys.path.append() calls? If so, how?

<target name="bar" description="Does something">
       <script language="jython"><![CDATA[
import sys
# make the python standard library avialable
sys.path.append("lib/pyLib.zip")
sys.path.append(".")

# import re
import os
from buildUtil import *

3rdPartyFunction()
]]></script>
</target>


Thanks again!
Sorry for my ignorance.

-Sol

On Jun 20, 2006, at 10:47 AM, Dominique Devienne wrote:

The 'cwd' is never changed. What changes in the project's basedir,
based on the various attributes that <ant> accepts. See the table in
<ant>'s documentation for details.

Personally, I always use <subant> instead of <ant>, to avoid messing
up the 'basedir'. You probably also want to use
p.resolveFile(relative_filename) within your script to translate
relative_filename to an abs. path relative to the project's basedir,
rather than 'cwd', which can be different depending where you call the
build from.

Leaving the 'basedir' alone, combined with p.resolveFile() should do
the trick. --DD

On 6/20/06, Sol Kindle <[EMAIL PROTECTED]> wrote:
Hey now,

This is my first Ant project (so please bear with me). My goal here is
to have a single Ant file to build all of my sub-projects.

I am having some trouble getting a third party Ant project (call it
"foo") to run as a subproject to my "top-level" build project. The Foo build runs just fine when Ant is run directly on it (in it's sub- dir), but fails to run a jython script when called from my "top-level" build
file.  Here's the failure output...

Buildfile: build.xml
foo:
bar:
  [script] Traceback (innermost last):
  [script]   File "<string>", line 9, in ?
  [script] ImportError: no module named buildUtil
BUILD FAILED

It fails because the script in the "bar" target cannot find cannot find the buildUtil.py file. But the buildUtil.py file is located in the same
directory as the Foo build.xml file (see Directory Layout below)

I had thought that "dir" attribute of the "ant" task would change the
current directory context for scripts as well as the build.txt file.
It seems to me as if the "dir" attribute of the "ant" task in my
top-level build file does not change the working dir for the jyhon
script.  Does this make sense?

Any suggestions?  Thank you in advance.

-Sol


My build.xml target to build 3rd party project
===============================
<target name="foo" description="builds the foo project">
       <ant dir="./foo/buildscripts" target="bar"></ant>
</target>


Directory Layout
===========
./build.xml                                 #my top-level build file
./foo/buildscripts/build.xml         #3rd party build file
./foo/buildscripts/buildUtil.py     #jython script
./foo/buildscripts/lib/pyLib.zip    #jython library


3rd Party Target (from ./foo/buildscripts/build.xml)
===========
<target name="bar" description="Does something">
       <script language="jython"><![CDATA[
import sys
# make the python standard library avialable
sys.path.append("lib/pyLib.zip")
sys.path.append(".")

# import re
import os
from buildUtil import *

3rdPartyFunction()
]]></script>
</target>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to