[Chandler-dev] Subzilla updated
Phillip J. Eby
pje at telecommunity.com
Fri Jul 14 10:45:02 PDT 2006
At 11:01 AM 7/14/2006 -0400, Reid Ellis wrote:
>I thought it would be better to allow easy_install to put the files
>where they belong.
They "belong" wherever you want them to. ;) The location that they're put
in by default is a default inherited from the distutils, that's inherited
from Python -- and it's a crappy default on OS X and Windows. The default
for other Unixes is usually $prefix/bin. (i.e., /usr/bin, /usr/local/bin,
EasyInstall's own documentation recommends that you change this to ~/bin on
>I was just hoping that in a .cshrc I could say
> set path=($path `python -c 'import setuptools; print
>or in a .profile:
> export PATH="$PATH":`python -c 'import setuptools; print
Unfortunately, it's not that simple. The path is computed via a chain of
configuration files that's managed by stuff deep in the bowels of the
distutils library. There is nothing that you can run that would get you
the information without writing a new class to inherit from distutils stuff
and do some rather complex things.
>This way, if I get a new version of python or what have you, my path
>is automatically changed to match without me messing with
The good news is, you don't have to. ~/.pydistutils.cfg is a per-user
Python configuration file, and will be read by *any* version of Python.
>I know there must be a way, since obviously
>easy_install puts the files there.
>I'll dig through the source and see what I can find.
Good luck. :) See the 'finalize_options()' method of the easy_install
class in setuptools.command.easy_install. The bit that gets the default
default, in the case where the script directory wasn't explicitly set on
the command line or in easy_install's configuration files, is:
This requests that the distutils set the default based on what the
install_scripts command would use. You can then trace the inheritance tree
to find that finalize_options() of install_scripts does a similar thing to
inherit the install_dir option from --install-scripts of the 'install'
command. You will then have to trace through some amazing logic in the
distutils.command.install.install class that sets up the default default
defaults. Welcome to the wonderful world of the distutils internals. :)
In short, I don't think you're going to find a simple way to just get a
value that will be correct, without creating an easy_install command
instance and asking it for its finalized options, so that this whole dark
carnival of default-setting and config-file reading will take place.
The good news is, you could take a few seconds to set the default yourself,
and know that easy_install will then always follow what you told it to.
More information about the chandler-dev