Seems like python doesn't find the script (because there is no error
message).
Possible solutions:
- use absolute path for script location:
<arg value="${basedir}/install/tools/jsmin.py"/>
- call script directly (like your working test.py):
<exec executable="${basedir}/install/tools/jsmin.py"
resolveexecutable="true">
<arg value="</var/www/hv/lib/proj/build/proj-all.js>"/>
<arg value="/var/www/hv/lib/proj//build/proj-all-min.js"/>
</exec>
I also note the double slash in the last argument.
Cheers,
André
Keith Hughitt schrieb:
Hi Luis,
Thanks for the suggestion. I had tried using "ant -v" before, and also
redirecting the output, but was not aware of the '-d' parameter.
The script *should* result in a new file, "proj-all-min.js" being created.
The file is only created when I run the script manually, however,
and not when I call the script during an Ant build.
Here is the relevant section of my build.xml as well as the complete output
from execution:
========= BEGIN build.xml ===============
<project name="proj" default="build" basedir="../">
.
.
.
<target name="build">
<!-- create build directory -->
<mkdir dir="lib/proj/build"/>
<!-- test -->
<exec dir="install" executable="test.py" resolveexecutable="true"/>
<!-- minify -->
<exec dir="./" executable="python" resolveexecutable="true">
<arg value="install/tools/jsmin.py"/>
<arg value="</var/www/hv/lib/proj/build/proj-all.js>"/>
<arg value="/var/www/hv/lib/proj//build/proj-all-min.js"/>
</exec>
========= END build.xml ===========
Note: Ant is run from /install, and thus "../" points to the project's root
directory.
The relevant python script is located in /install/tools, and
"test.py" is a dummy
script located in /install that I used to test a simple case of
script execution.
=========BEGIN OUTPUT===========
$:/var/www/hv/install$ ant -d
Apache Ant version 1.7.0 compiled on August 29 2007
Buildfile: build.xml
Adding reference: ant.PropertyHelper
Detected Java version: 1.6 in: /usr/lib/jvm/java-6-sun-1.6.0.06/jre
Detected OS: Linux
Adding reference: ant.ComponentHelper
Setting ro project property: ant.file -> /var/www/hv/install/build.xml
Adding reference: ant.projectHelper
Adding reference: ant.parsing.context
Adding reference: ant.targets
parsing buildfile /var/www/hv/install/build.xml with URI =
file:/var/www/hv/install/build.xml
Setting ro project property: ant.project.name -> proj
Adding reference: proj
Setting ro project property: ant.file.proj -> /var/www/hv/install/build.xml
Project base dir set to: /var/www/hv
+Target:
+Target: build
[antlib:org.apache.tools.ant] Could not load definitions from resource
org/apache/tools/ant/antlib.xml. It could not be found.
Attempting to create object of type
org.apache.tools.ant.helper.DefaultExecutor
Adding reference: ant.executor
Build sequence for target(s) `build' is [build]
Complete build sequence is [build, ]
build:
[exec] Current OS is Linux
[exec] Executing '/var/www/hv/install/test.py'
[exec] The ' characters around the executable and arguments are
[exec] not part of the command.
Execute:Java13CommandLauncher: Executing '/var/www/hv/install/test.py'
The ' characters around the executable and arguments are
not part of the command.
[exec] Hello World
[exec] Current OS is Linux
[exec] Executing 'python' with arguments:
[exec] 'install/tools/jsmin.py'
[exec] '</var/www/hv/lib/proj/build/proj-all.js>'
[exec] '/var/www/hv/lib/proj//build/proj-all-min.js'
[exec]
[exec] The ' characters around the executable and arguments are
[exec] not part of the command.
Execute:Java13CommandLauncher: Executing 'python' with arguments:
'install/tools/jsmin.py'
'</var/www/hv/lib/proj/build/proj-all.js>'
'/var/www/hv/lib/proj//build/proj-all-min.js'
The ' characters around the executable and arguments are
not part of the command.
BUILD SUCCESSFUL
Total time: 0 seconds
=========END OUTPUT===========
Any ideas?
Thanks,
Keith
On Wed, Jul 16, 2008 at 5:56 AM, André Pilz <[EMAIL PROTECTED]> wrote:
Hi,
need more info to help you. Use "ant -d" to get the command line and the
arguments how python is called. How exactly does it not work? Any error
message?
Cheers,
André
Keith Hughitt schrieb:
Hi all,
I've just recently started using Ant on Linux, and so far it has been
really
amazing. I've run into
one problem, however, that I haven't been able to get past.
I would like to call an external script (a python script to minimize some
JavaScript files),
but have not been able to get it to execute properly. I searched around
some, and found
an earlier thread (http://marc.info/?l=ant-user&m=115078380228196&w=2)
where someone with a similar problem was able to fix things setting
"resolveexecutable" to true.
This works for me when I try running a dummy script with no arguments,
e.g:
...
<exec dir="./" executable="test.py" resolveexecutable="true"/>
...
[exec] Hello World
When I try and do something requiring command-line arguments though I
can't
get it to work:
<exec dir="./" executable="python" resolveexecutable="true">
<arg value="install/tools/jsmin.py"/>
<arg value="<${libs}/build/test.js>"/>
<arg value="${libs}/build/testl-min.js"/>
</exec>
I've tried executing both "python" (and passing the scripts name as an
argument), and the script itself.
Nothing seems to work. The command executes fine from the command-line,
and
what even more, when
I print the arguments passed to the python script using argv, and then
string them together and run them
it works fine, but still no luck when I try to get it working through ant.
Anyone have any suggestions as to what might be the problem?
Any help would be greatly appreciated.
Thanks,
Keith
---------------------------------------------------------------------
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]