On Friday, January 22, 2016 10:54:54 AM Donald Stufft wrote:
> > On Jan 22, 2016, at 10:36 AM, Piotr Ożarowski <pi...@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.

I decided to work on switching something I'm upstream for from distutils to 
setuptools today (since hey, it's the future) and discovered there aren't 
three kinds as listed above.  There are four:

4) Packages that use distutils features that aren't available in setuptools 
and break horribly when switched.

As a result, I think I global change is a non-starter.

In my particular case, here's what I have (snipped from setup.py) to install 
man pages and a configuration file for an application written in python3:

    data_files=[(os.path.join('share', 'man', 'man1'),
      ['policyd-spf.1']), (os.path.join('share', 'man', 'man5'),
      ['policyd-spf.conf.5']), (os.path.join('/etc', 'python-policyd-spf'),
      ['policyd-spf.conf']), (os.path.join('share', 'man', 'man5'),
      ['policyd-spf.peruser.5'])],

The man pages end up in build/bdist.linux-x86_64/egg as does the config file if 
I remove the leading "/", but it still won't install it.

codesearch.debian.net claims 720 packages using data_files.  I doubt they are 
all using that pythonically, but they'll need to be checked for breakage.

The standard Google answer to the question of how to install man pages using 
setuptools seems to be use distutils.

No way can we do any automagic switching.

Scott K

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to