[Distutils] zc.buildout and zc.recipe.egg
Miles Waller
miles at jamkit.com
Fri Jul 20 00:04:39 CEST 2007
Actually, I'm a bit unclear as to how to test this in a useful way: do
you think it is sufficient just to test that the content of the script
generated contains specific text (that doesn't guarantee the script that
is generated actually works!)?
Thanks
Miles
Jim Fulton wrote:
> Much thanks. Can you also supply a test? Better yet, since you are a
> zope contributor, you could just check in the change, including the test.
>
> Jim
>
> On Jul 19, 2007, at 5:21 PM, Miles wrote:
>
>> Hi,
>>
>>> That's correct. This is a limitation in zc.recipe.egg; we're open
>>> to patches that improve the generated interpreter script.
>>
>> Thanks for confirming, I wasn't sure if it was like that for a reason.
>>
>> I attach a patch that fixes up some other parameters so the generated
>> interpreter script's behaviour is less distinguis matches what you
>> get when you start the python interpreter more exactly. Works for
>> me, but I'd appreciate some more eyes...
>>
>> Miles
>>
>> Index: zc.buildout/src/zc/buildout/easy_install.py
>> ===================================================================
>> --- zc.buildout/src/zc/buildout/easy_install.py (revision 78190)
>> +++ zc.buildout/src/zc/buildout/easy_install.py (working copy)
>> @@ -896,11 +896,17 @@
>> py_script_template = '''\
>> #!%(python)s
>> import sys
>> -
>> +import os
>> +
>> sys.path[0:0] = [
>> + '',
>> %(path)s,
>> ]
>>
>> +abs__file__ = os.path.abspath( __file__ )
>> +sys.executable = abs__file__
>> +del ( __file__ )
>> +
>> _interactive = True
>> if len(sys.argv) > 1:
>> import getopt
>> @@ -914,7 +920,12 @@
>>
>> if _args:
>> sys.argv[:] = _args
>> - execfile(sys.argv[0])
>> + f = sys.argv[0]
>> + absf = os.path.abspath(f)
>> + p = os.path.split( absf )[0]
>> + sys.path[0] = os.path.join( p )
>> + __file__ = absf
>> + execfile( f )
>>
>> if _interactive:
>> import code
>> _______________________________________________
>> Distutils-SIG maillist - Distutils-SIG at python.org
>> http://mail.python.org/mailman/listinfo/distutils-sig
>
> --
> Jim Fulton mailto:jim at zope.com Python Powered!
> CTO (540) 361-1714 http://www.python.org
> Zope Corporation http://www.zope.com http://www.zope.org
>
>
>
>
More information about the Distutils-SIG
mailing list