[Pythonmac-SIG] Re: Pythonmac-SIG Digest, Vol 20, Issue 24 (original) (raw)

Brian Lenihan brian_l at mac.com
Tue Dec 21 13:22:17 CET 2004


>> 208-186-56-189:/sw/bin jis$ cat /sw/bin/idle2.3 >> #!/sw/bin/python

Which python is first on your path? IIRC there is a feature in darwin that wreaks havoc with the setup code in python that finds the correct prefix (and library). This ends up always picking the prefix for the first python on the path. Darwinports contains a patch for that. Using "#!/usr/bin/env /sw/bin/python" should also work.

The "feature" is that OS X does not include the full path to the executable in argv[0]. Using #!/usr/bin/env /path/to/python helps.
Especially in the really annoying case where command line scripts work, but scripts launched from applications don't.

Which reminds me, both pyobjc's and py2app's bdist_mpkg also could be tweaked so preflight shell scripts won't fail to run on some systems:

--- pyobjc_mpkg.py (revision 1287) +++ pyobjc_mpkg.py (working copy) @@ -13,7 +13,7 @@ from bdist_mpkg import tools

JUNK = set(['.DS_Store', '.gdb_history', 'build', 'dist', 'NonFunctional']) -JUNK_EXTS = set(['.pbxuser', '.pyc', '.pyo']) +JUNK_EXTS = set(['.pbxuser', '.pyc', '.pyo', '.swp']) def skipjunk(fn, junk=JUNK, junk_exts=JUNK_EXTS): if not skipscm(fn): return False @@ -23,7 +23,8 @@ return False return True

-PREFLIGHT_RM = """#!/usr/bin/env python +PREFLIGHT_RM = """
+#!/usr/bin/env %(sys_executable_path)s import shutil, os for fn in %(files)r: if os.path.isdir(fn): @@ -31,6 +32,7 @@ elif os.path.exists(fn): os.unlink(fn) """ + def run_setup(*args, **kwargs): import distutils.core d = { @@ -45,10 +47,10 @@ for k,v in d.iteritems(): setattr(distutils.core, k, v)

-------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2359 bytes Desc: not available Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20041221/0f433e0d/smime.bin



More information about the Pythonmac-SIG mailing list