[Distutils] setuptools for people behind a firewall
Phillip J. Eby
pje at telecommunity.com
Thu Jul 14 17:14:36 CEST 2005
At 11:26 AM 7/14/2005 +0100, Paul Moore wrote:
>On 7/13/05, Phillip J. Eby <pje at telecommunity.com> wrote:
> > At 03:00 PM 7/13/2005 +0100, Paul Moore wrote:
> > >On 7/12/05, Paul Moore <p.f.moore at gmail.com> wrote:
> > >Given a Distribution object (maybe derived from a user's command line,
> > >maybe from selection off a GUI) I can "uninstall" the Distribution by
> > >simply removing the egg (file or directory).
> >
> > Make sure you *only* do this to a directory if it has a '.egg' extension;
> > otherwise you could delete a package installed using "develop"!
>
>Hmm, I'm only looking on sys.path - I hadn't imagined that development
>software would be added to the *default* sys.path...
By default, if you use "develop" on a package, it becomes part of the
default sys.path; this makes sense on machines that are "development"
machines. If you are developing on a machine that also has production
software, you need to use a different staging area (--install-dir) for the
develop command. This is easily set on a per-user or sitewide basis; in a
shop making use of these tools, you'd probably do this (as root):
setup.py setopt -g -c develop -o install_dir -s /somewhere/staging
To set the sitewide staging area. Hmm, actually, it would probably make
more sense to have user-specific staging areas, by making the default
something like ~/staging. I should probably think about adding
expanduser() support to a lot of setuptools' options.
>But I take your point. Actually, as I'm only looking at these
>utilities from the POV of managing site-packages, maybe I should just
>strip out any entries from sys.path which aren't under that directory
>(although I don't know if I can find that directory on Unix - on
>Windows, it's under sys.(exec)prefix, but I don't know directory
>structures under Unix so well). I'll have to check the source of
>easy_install to see how it decides where to copy files *to* (in the
>absence of user overrides...)
There's a get_python_lib() function in distutils that I use. However, I've
recently discovered that the situation on Mac OS X is more complex; users
have a ~/Library/python2.X/site-packages directory as well.
>Sorry - I'm doing find_distribution() on every entry in sys.path. What
>I was getting at, is whether that process could miss any eggs which
>easy_install may have put into site-packages.
No; find_distributions(site_packages) would list everything installed in
that directory, whether active or not, plus distributions for anything that
was installed as a development link in site-packages. That is, even if
*all* you call find_distributions() on is site-packages, it's still going
to include distributions whose .path is elsewhere, and that's fine because
you want to know about those anyway; just list them with a "(Development)"
status or something in your output.
More information about the Distutils-SIG
mailing list