[Distutils] Disabling --single-version-externally-managed
Phillip J. Eby
pje at telecommunity.com
Sun Sep 2 03:18:24 CEST 2007
At 02:54 PM 9/1/2007 -0700, Toshio Kuratomi wrote:
>Toshio Kuratomi wrote:
> >
> > This code creates an unordered list because you might have already had
> > to place something after one of the duplicate locations that this code
> > is removing. We need to do a sort of the entire list after each add +
> > duplicate removal run.
>
>Here's a quick and dirty patch. It's correct but it's inefficient. A
>better sort algorithm would help some. Refactoring code so we call a
>sort method after we finish adding entries to the path would be even better.
>
>I'll test how this affects packaging tonight.
Please, please stop and back up a minute. appreciate your eagerness
to help, really, but right now I can't trust the correctness of the
initial system against which you are performing your tests. You've
got crazy stuff on sys.path, you appear to be calling insert_on()
(which isn't a documented API), and you're manually creating .pth
files, among other things.
So before you do anything else, please restore your system to
something which consists *only* of files generated by setuptools or
easy_install without *any* added hacks, workarounds, or manually
edited files. That also means NO scripts that were not generated by
easy_install.
If you *must* have other scripts, there is an undocumented internal
feature that you can use to specify a script's requirements such that
they override the default package versions. What you have to do is
add a __requires__ definition to the script, e.g.:
__requires__= 'TurboGears>1.0', 'FibbledyDee<27.2'
This definition must be in the actual script run by Python. When
pkg_resources is initially imported, any __requires__ requirements
are given higher precedence than the default versions. You must,
however, still import pkg_resources, and it must be imported *after*
setting __requires__, not before.
Assuming I understand your requirements, you should be able to
accomplish everything you want using only this one feature, plus
single-version eggs for system default packages, and multi-version
eggs (i.e. *no* .pth files) for everything else.
It should not be necessary for you to generate or edit any files, use
other undocumented APIs, or anything else.
More information about the Distutils-SIG
mailing list