Opened 13 years ago

Closed 13 years ago

#1334 closed enhancement (fixed)

Fix for Jython when run as a task from a base directory other than buildscripts

Reported by: kindsol@… Owned by: alex
Priority: high Milestone:
Component: BuildTools Version: 0.3
Keywords: Ant jython subproject Cc:
Blocked By: Blocking:

Description

This is an ammendment to Ticket#1006.

There are more places where jython breaks when run as a task from a base directory other than buildscripts. This following patch allows the dojo build.xml script to be run as a subproject of a larger Ant project.

Let me know if you have any questions.

Here is the patch to the 0.3.1 version of build.xml:

Index: build.xml
===================================================================
--- build.xml	(revision 5278)
+++ build.xml	(working copy)
@@ -102,8 +102,8 @@
 		<script language="jython"><![CDATA[
 # make the python standard library available
 import sys
-sys.path.append("lib/pyLib.zip")
-sys.path.append(".")
+sys.path.append(project.resolveFile("lib/pyLib.zip").getPath())
+sys.path.append(project.resolveFile(".").getPath())
 import buildUtil
 
 buildUtil.buildTestFiles()
@@ -159,8 +159,9 @@
 		<script language="jython"><![CDATA[
 import sys
 # make the python standard library avialable
-sys.path.append("lib/pyLib.zip")
+sys.path.append(project.resolveFile("lib/pyLib.zip").getPath())
 
+
 # import re
 
 echo = dojo.createTask("echo")
@@ -278,8 +279,8 @@
 		<script language="jython"><![CDATA[
 import sys
 # make the python standard library avialable
-sys.path.append("lib/pyLib.zip")
-sys.path.append(".")
+sys.path.append(project.resolveFile("lib/pyLib.zip").getPath())
+sys.path.append(project.resolveFile(".").getPath())
 
 # import re
 import os
@@ -523,15 +524,16 @@
 		<script language="jython"><![CDATA[
 import sys
 # make the python standard library avialable
-sys.path.append("lib/pyLib.zip")
-sys.path.append(".")
+sys.path.append(project.resolveFile("lib/pyLib.zip").getPath())
+sys.path.append(project.resolveFile(".").getPath())
 
+			
 # import re
 import os
 from buildUtil import *
 
 print "Setting version for Dojo to: " + dojo.getProperty("version")
-replaceVersion(dojo.getProperty("release_dir") + "/source.__package__.js", dojo.getProperty("version"))
+replaceVersion(project.resolveFile(dojo.getProperty("release_dir") + "/source.__package__.js").getPath(), dojo.getProperty("version"))
 ]]></script>
 
 		<antcall target="-rhino-compress">
@@ -603,15 +605,17 @@
 		<script language="jython"><![CDATA[
 import sys
 # make the python standard library avialable
-sys.path.append("lib/pyLib.zip")
-sys.path.append(".")
+sys.path.append(project.resolveFile("lib/pyLib.zip").getPath())
+sys.path.append(project.resolveFile(".").getPath())
 
 # import re
 import os
 from buildUtil import *
 
-print "Interning strings for directory: " + dojo.getProperty("release_dir")
-internTemplateStrings(dojo.getProperty("dojoLoader"), dojo.getProperty("release_dir"))
+releaseDir = project.resolveFile(dojo.getProperty("release_dir")).getPath() 			
+srcRoot=project.resolveFile("../").getPath() + "\"			
+print "Interning strings for directory: " + releaseDir
+internTemplateStrings(dojo.getProperty("dojoLoader"), releaseDir, srcRoot)
 ]]></script>
 	</target>
 	<!-- end intern-strings task -->

Change History (1)

comment:1 Changed 13 years ago by jkuhnert

Resolution: fixed
Status: newclosed

(In [5368]) Replaced remaining python file path references with calls to the ant project variable to help make the paths resolvable by varying execution contexts. Fixes #1334.

Note: See TracTickets for help on using tickets.