On mer, 2009-05-13 at 11:17 +0100, Jamie Kirkpatrick wrote:
> Hi Giovanni
> 
> 
> Soooo glad you are online...maybe you can get me through my day :)
> 
> 
> The problem with virtualenv and PyInstaller is that virtualenv
> installs the Python framework binary ("Python") as ".Python" in the
> virtualenv and adjust the main executable to reference it.  I think he
> hides it on the filesystem just for aesthetic reasons but it means
> that in launch.c where you do:
> 
> 
> /* Determine the path */
> #ifdef __APPLE__
> sprintf(dllpath, "%sPython",
> f_workpath ? f_workpath : f_homepath);
> 
> 
> You cannot pick it up.  If you wanted to be compatible, you could make
> your code try both "Python" and ".Python"?

You could, and I would accept it as a workaround. I think the correct
solution here is not to hardcode the library name, but just find it out
at build time, and embed it as metadata in the generated executable.

Anyway: try the attached untested patch and let me know.
-- 
Giovanni Bajo
Develer S.r.l.
http://www.develer.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/PyInstaller?hl=en
-~----------~----~----~----~------~----~------~--~---

Index: launch.c
===================================================================
--- launch.c	(revision 660)
+++ launch.c	(working copy)
@@ -460,8 +460,16 @@
 
 	/* Determine the path */
 #ifdef __APPLE__
+	struct stat sbuf;
+
 	sprintf(dllpath, "%sPython",
 		f_workpath ? f_workpath : f_homepath);
+	/* Workaround for virtualenv: it renames the Python framework. */
+	/* A proper solution would be to let Build.py found out the correct
+	 * name and embed it in the PKG as metadata. */
+	if (stat(dllpath, &sbuf) < 0)
+		sprintf(dllpath, "%s.Python",
+			f_workpath ? f_workpath : f_homepath);
 #else
 	sprintf(dllpath, "%slibpython%01d.%01d.so.1.0",
 		f_workpath ? f_workpath : f_homepath,

Reply via email to