[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: to distribute_setup() or not, that is the question



On Mon, Jan 30, 2012 at 08:21:38PM -0500, Barry Warsaw wrote:
> On Jan 27, 2012, at 05:43 PM, Brian Sutherland wrote:
> 
> >On Fri, Jan 27, 2012 at 11:16:02AM -0500, Barry Warsaw wrote:
> >> On Jan 27, 2012, at 03:38 PM, Brian Sutherland wrote:
> >> 
> >> >On Fri, Jan 27, 2012 at 08:36:40AM -0500, Barry Warsaw wrote:
> >> >> What if we proposed a hook to get DEFAULT_VERSION from a file or environment
> >> >> variable?  Then at least on Debian systems we could provide that file in our
> >> >> python-setuptools package, or set the envar in our d/rules files?  I'd
> >> >> probably prefer the former since it would allow us to specify the default
> >> >> version for the majority of Python packages.  The two aren't mutually
> >> >> exclusive, but I'm not sure both would be useful.
> >> >
> >> >I'm not sure it's more useful than just setting DEFAULT_VERSION to a
> >> >very old version. It's certainly more complex.
> >> 
> >> Yes, but it would allow us to "solve" this once, globally, rather than
> >> patching every upstream package that uses distribute_setup.py.  We can't
> >> control what upstreams do, but if we could make it easier to adhere to our
> >> own policies without patching upstream, all the better.
> >
> >Hmm, I thought my solution would ""solve" this problem once globally" :)
> >
> >But I realize that I was quite imprecise in my comment about DEFAULT_VERSION,
> >I think use_setuptools should do this kind of thing:
> >
> >    DEFAULT_VERSION="0.6c11"
> >    MIN_ACCEPTABLE_VERSION='0.6b1' # very very old version with
> >                                   # hopefully not too many bugx
> >
> >    def use_setuptools(version=MIN_ACCEPTABLE_VERSION):
> >        if setuptools_installed:
> >            if installed_setuptools_version < version:
> >                download(DEFAULT_VERSION)
> >        else:
> >            download(DEFAULT_VERSION)
> >
> >Currently MIN_ACCEPTABLE_VERSION=DEFAULT_VERSION according to
> >http://peak.telecommunity.com/dist/ez_setup.py.
> >
> >As I understand it, your suggestion is to allow Debian systems to
> >override MIN_ACCEPTABLE_VERSION. I don't think that's necessary to
> >"solve" the problem if the default for MIN_ACCEPTABLE_VERSION is
> >sufficiently old.
> 
> Hi Brian.  What I meant by "globally" was to avoid having to patch any
> distribute_setup.py or even setup.py in every upstream package itself.

I see, sorry I was being quite thick.

With my proposal you'd need to wait for all the upstreams to update
their ez_setup.py/distribute_setup.py. I'm sure they don't do that
frequently.

> If use_setuptools() could consult some file or environment variable that was
> within the domain of the operating system, that would avoid having to patch
> every package that uses distribute_setup.py (or ez_setup.py).

That looks very difficult, distribute_setup.py is very self-contained.
It would probably need to make this:

    pkg_resources.require("distribute>="+version) == True

even when it's not, but then only when you're calling setup.py. I
suppose dh_python2 can set an environment variable and pkg_resources can
be patched to tell lies when that environment variable is set.

My gosh but that's ugly...

-- 
Brian Sutherland


Reply to: