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

Re: Amend Debian Python Proposal to Include More Python Metadata?



> On Jan 22, 2016, at 10:36 AM, Piotr Ożarowski <piotr@debian.org> wrote:
> 
> to be honest, I still don't know what you're asking for. What do you
> want us to do? Patch 2.7's distutils?

Essentially, ensure that setuptools not distutils is used in a setup.py. There are generally three kinds of setup.py files:

1) Ones that use setuptools unconditionally - These ones you just leave alone, they are already correct and you should already have a build depends on python-setuptools.
2) Ones that conditionally use setuptools - These ones you just need to satisfy whatever condition the setup.py uses to enable setuptools. Typically this is just checking if setuptools is importable but sometimes they use environment variables or similar.
3) Ones that use distutils unconditionally - These ones you switch to making them use setuptools instead of distutils.

Now, that’s the high level overview, there’s an easier, more automatic way that could maybe just be added to pybuild (Not sure exactly how pybuild works) where instead of invoking the setup.py as:

    python setup.py install (or whatever commands/args you’re passing)

You do it as (taken from pip):

    python -c "import setuptools, tokenize;__file__='$PWD/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))” install (or whatever commands/args you’re passing).

The thing is kind of ugly, but that will install things using setuptools (just like pip does) regardless of if it imports setuptools or distutils in it’s setup.py file.


-----------------
Donald Stufft
PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail


Reply to: