[Distutils] Installing large applications

Bob Ippolito bob at redivi.com
Tue Jun 15 22:54:57 EDT 2004

On Jun 15, 2004, at 10:25 PM, Tim Peters wrote:

> [Bob Ippolito]
>> Nothing is stopping you from doing sys.path.insert(0, ...) in lieu of
>> addsitedir, so long as you don't have to process additional pth files.
> Not even good taste <0.5 wink>?  .pth files weren't intended to be a
> generally-programmable alternative to site-customize.py, and relying 
> on that
> site.py happens to exec entire lines starting with "import" seems 
> abusive to
> me.  Stuffing arbitrary executable code on the same line after an 
> import is
> a trick, and one I wouldn't count on sticking around.  As Guido said 
> here:
>    http://mail.python.org/pipermail/zope3-dev/2002-December/004336.html
> the Python developers have no idea why .pth files exec lines starting 
> with
> "import", and that doesn't bode well for the future of this trick.

Well, I find it incredibly convenient, because pth files don't do 
os.path.expanduser and offer you no control over WHERE in sys.path it 
goes.  For example, I use a pth file to override Python 2.3.0's 
slower-than-molasses date parser with the one from 2.3.3 without 
modifying the python installation itself.  PYTHONPATH is definitely not 
an option.

> Guido had a different solution in 1999.  Because it doesn't involve 
> obscure
> tricks, envars, or changing anything in the installed Python, nobody 
> liked
> it <wink>:
> http://mail.python.org/pipermail/python-dev/1999-September/000923.html
> It's not really a solution "for ZODB", though.

Well the easiest way to do versioning in Python is just to include the 
version in the name of your top level package.  Otherwise, I agree with 
Guido's recommendation..  That's more or less what I do when I 
distribute standalone applications.  I have private copies of every 
non-standard-library component in some place that the application 
"owns" and I make sure they end up early on sys.path when and only when 
the application executes.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2357 bytes
Desc: not available
Url : http://mail.python.org/pipermail/distutils-sig/attachments/20040615/d19a60ab/smime.bin

More information about the Distutils-SIG mailing list