From 4a751580ca5cdbc4c0d5bed1ae131ad8b663a52a Mon Sep 17 00:00:00 2001
From: Jack Jansen <jack.jansen@cwi.nl>
Date: Fri, 22 Sep 2000 23:54:07 +0000
Subject: mkcwproject now works,  but for one thing: the import of the XML
 document as a project through AppleEvents.

---
 Mac/Lib/mkcwproject/__init__.py               | 14 ++++++++++----
 Mac/Lib/mkcwproject/cwtalker.py               |  2 +-
 Mac/Lib/mkcwproject/template/template.prj.xml |  4 ++--
 Mac/Lib/test/mkcwproj/testmkcwproj.py         |  6 +++---
 4 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/Mac/Lib/mkcwproject/__init__.py b/Mac/Lib/mkcwproject/__init__.py
index 9664542..8bd3a8d 100644
--- a/Mac/Lib/mkcwproject/__init__.py
+++ b/Mac/Lib/mkcwproject/__init__.py
@@ -1,5 +1,8 @@
 import cwxmlgen
 import cwtalker
+import os
+import AppleEvents
+import macfs
 
 def mkproject(outputfile, modulename, settings):
 	#
@@ -16,7 +19,7 @@ def mkproject(outputfile, modulename, settings):
 	dictcopy['mac_outputdir'] = ':lib:'  # XXX Is this correct??
 	dictcopy['mac_dllname'] = modulename + '.ppc.slb'
 	dictcopy['mac_targetname'] = modulename + '.ppc'
-	of os.path.isabs(dictcopy['sysprefix']):
+	if os.path.isabs(dictcopy['sysprefix']):
 		dictcopy['mac_sysprefixtype'] = 'Absolute'
 	else:
 		dictcopy['mac_sysprefixtype'] = 'Project' # XXX not sure this is right...
@@ -26,7 +29,7 @@ def mkproject(outputfile, modulename, settings):
 	xmlbuilder = cwxmlgen.ProjectBuilder(dictcopy)
 	xmlbuilder.generate()
 	fp = open(dictcopy['mac_projectxmlname'], "w")
-	fp.write(dict["tmp_projectxmldata"])
+	fp.write(dictcopy["tmp_projectxmldata"])
 	fp.close()
 	#
 	# Generate the export file
@@ -39,8 +42,11 @@ def mkproject(outputfile, modulename, settings):
 	#
 	cw = cwtalker.MyCodeWarrior(start=1)
 	cw.send_timeout = AppleEvents.kNoTimeOut
-	xmlfss = macfs.FSSpec(dictcopy['mac_projectxmlname'])
-	prjfss = macfs.FSSpec(outputfile)
+##	xmlfss = macfs.FSSpec(dictcopy['mac_projectxmlname'])
+##	prjfss = macfs.FSSpec(outputfile)
+	xmlfss = dictcopy['mac_projectxmlname']
+	prjfss = outputfile
+	cw.activate()
 	cw.my_mkproject(prjfss, xmlfss)
 	
 def buildproject(projectfile):
diff --git a/Mac/Lib/mkcwproject/cwtalker.py b/Mac/Lib/mkcwproject/cwtalker.py
index fbce620..3b2d3b4 100644
--- a/Mac/Lib/mkcwproject/cwtalker.py
+++ b/Mac/Lib/mkcwproject/cwtalker.py
@@ -23,4 +23,4 @@ class MyCodeWarrior(CodeWarrior.CodeWarrior):
 			return _arguments['----']
 
 	def my_mkproject(self, prjfile, xmlfile):
-		self.make(new=CodeWarrior.project_document, with_data=xmlfile, at=prjfile)
+		self.make(new=CodeWarrior.project_document(), with_data=xmlfile, as=prjfile)
diff --git a/Mac/Lib/mkcwproject/template/template.prj.xml b/Mac/Lib/mkcwproject/template/template.prj.xml
index ac38544..8642343 100644
--- a/Mac/Lib/mkcwproject/template/template.prj.xml
+++ b/Mac/Lib/mkcwproject/template/template.prj.xml
@@ -92,7 +92,7 @@
                     </SETTING>
                     <SETTING>
                         <SETTING><NAME>SearchPath</NAME>
-                            <SETTING><NAME>Path</NAME><VALUE>%(sysprefix)s:Mac:</VALUE></SETTING>
+                            <SETTING><NAME>Path</NAME><VALUE>%(sysprefix)sMac:</VALUE></SETTING>
                             <SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>
                             <SETTING><NAME>PathRoot</NAME><VALUE>%(mac_sysprefixtype)s</VALUE></SETTING>
                         </SETTING>
@@ -113,7 +113,7 @@
                     %(tmp_extrasearchdirs)s
                     <SETTING>
                         <SETTING><NAME>SearchPath</NAME>
-                            <SETTING><NAME>Path</NAME><VALUE>%(sysprefix)s::GUSI2:include:</VALUE></SETTING>
+                            <SETTING><NAME>Path</NAME><VALUE>%(sysprefix)s:GUSI2:include:</VALUE></SETTING>
                             <SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>
                             <SETTING><NAME>PathRoot</NAME><VALUE>%(mac_sysprefixtype)s</VALUE></SETTING>
                         </SETTING>
diff --git a/Mac/Lib/test/mkcwproj/testmkcwproj.py b/Mac/Lib/test/mkcwproj/testmkcwproj.py
index 4c46e96..ac1cb8e 100644
--- a/Mac/Lib/test/mkcwproj/testmkcwproj.py
+++ b/Mac/Lib/test/mkcwproj/testmkcwproj.py
@@ -1,4 +1,4 @@
-import mkcwproj
+import mkcwproject
 import sys
 
 dict = {
@@ -8,5 +8,5 @@ dict = {
 }
 	
 	
-mkcwproj.mkproject("mkcwtest.prj", "mkcwtest", dict)
-mkcwproj.buildproject("mkcwtest.prj")
+mkcwproject.mkproject("mkcwtest.prj", "mkcwtest", dict)
+mkcwproject.buildproject("mkcwtest.prj")
-- 
cgit v0.12

