[Distutils] First steps with distutils...

M.-A. Lemburg mal@lemburg.com
Tue Sep 5 04:39:01 2000


"M.-A. Lemburg" wrote:
> 
> > > OK, after that hack the RPM compile runs through, but it now finishes
> > > with the following lines (and no apparent reason):
> > >
> > > creating /var/tmp/mx-Extensions-BASE-buildroot/usr/local/lib/python2.0/site-packages/mx/Tools
> > > creating /var/tmp/mx-Extensions-BASE-buildroot/usr/local/lib/python2.0/site-packages/mx/Tools/mxTools
> > > copying build/lib.linux2/mx/Tools/mxTools/mxTools.so -> /var/tmp/mx-Extensions-BASE-buildroot/usr/local/lib/python2.0/site-packages/mx/Tools/mxTools
> > > byte-compiling /var/tmp/mx-Extensions-BASE-buildroot/usr/local/lib/python2.0/site-packages/mx/__init__.py to __init__.pyc
> > > writing list of installed files to 'INSTALLED_FILES'
> > > warning: install: modules installed to '/var/tmp/mx-Extensions-BASE-buildroot/usr/local/lib/python2.0/site-packages/', which is not in Python's module search path (sys.path) -- you'll have to change the search path yourself
> > > + exit 0
> > > Processing files: mx-Extensions-BASE
> > > File listed twice: /usr/local/lib/python2.0/site-packages/mx/Tools/mxTools/mxTools.so
> > > Finding provides...
> > > Finding requires...
> > > Provides: mxDateTime.so mxProxy.so mxQueue.so mxStack.so mxTextTools.so mxTools.so
> > > Requires: ld-linux.so.2 libc.so.6 libc.so.6(GLIBC_2.0) libc.so.6(GLIBC_2.1)
> > > error: command 'rpm' failed with exit status 1
> >
> > ??? I'm confused again.
> >
> > Try running "bdist_rpm" with the --source-only option, and then see if
> > you can build from the source RPM directly.  About the only way to debug
> > these sort of problems is to break the thing down, and a *heck* of a lot
> > of stuff happens between you typing "setup.py bdist_rpm" and the
> > finished RPM files being moved into dist/.  (Just listen to your hard
> > drive go!)
> 
> This works.
> 
> Hmm, runnning
> 
> /home/lemburg> rpm -q --whatprovides ld-linux.so.2 libc.so.6 "libc.so.6(GLIBC_2.0)" "libc.so.6(GLIBC_2.1)"
> 
> I get:
> 
> shlibs-2.1.1-4
> shlibs-2.1.1-4
> javarunt-1.1.7v1a-11
> shlibs-2.1.1-4
> shlibs-2.1.1-4
> 
> This looks ok, so it's not the "Requires" part which causes the
> problem either.

Ok, I found the bug...

RPM didn't like a mistake I made in the setup.py file: I listed
one Extension twice. While distutils didn't warn about this,
RPM fails to produce a binary RPM if a file is "listed twice".
Removing the duplicate in setup.py remedies the problem.

Now I have another problem ;-): 

the created RPM doesn't include all needed files, just the
base package's __init__.py file and the compiled .so files:

tmp/dist> rpm -qpl mx-Extensions-BASE-1.0.0-1.i386.rpm
/usr/local/lib/python2.0/site-packages/mx/DateTime/mxDateTime/mxDateTime.so
/usr/local/lib/python2.0/site-packages/mx/Proxy/mxProxy/mxProxy.so
/usr/local/lib/python2.0/site-packages/mx/Queue/mxQueue/mxQueue.so
/usr/local/lib/python2.0/site-packages/mx/Stack/mxStack/mxStack.so
/usr/local/lib/python2.0/site-packages/mx/TextTools/mxTextTools/mxTextTools.so
/usr/local/lib/python2.0/site-packages/mx/Tools/mxTools/mxTools.so
/usr/local/lib/python2.0/site-packages/mx/__init__.py
/usr/local/lib/python2.0/site-packages/mx/__init__.pyc

Here's my setup.py file:
#!/usr/bin/env python2.0

""" Distutils Setup File for the mx Extensions BASE distribution.
"""

import string
from distutils.core import setup, Extension
from distutils.command.config import config

__version__ = '1.0.0'

setup (name = "mx-Extensions-BASE",
       version = __version__,
       description = "",
       long_description = "",
       author = "Marc-André Lemburg",
       author_email = "mal@lemburg.com",
       url = "http://starship.python.net/~lemburg/mxBASE.html",

       packages = ['mx'],

       ext_modules = [
    Extension('mx.DateTime.mxDateTime.mxDateTime',
              ['mx/DateTime/mxDateTime/mxDateTime.c'],
              include_dirs=['mx/DateTime/mxDateTime']),
    Extension('mx.Proxy.mxProxy.mxProxy',
              ['mx/Proxy/mxProxy/mxProxy.c'],
              include_dirs=['mx/Proxy/mxProxy']),
    Extension('mx.Queue.mxQueue.mxQueue',
              ['mx/Queue/mxQueue/mxQueue.c'],
              include_dirs=['mx/Queue/mxQueue']),
    Extension('mx.Stack.mxStack.mxStack',
              ['mx/Stack/mxStack/mxStack.c'],
              include_dirs=['mx/Stack/mxStack']),
    Extension('mx.TextTools.mxTextTools.mxTextTools',
              ['mx/TextTools/mxTextTools/mxTextTools.c'],
              include_dirs=['mx/TextTools/mxTextTools']),
    Extension('mx.Tools.mxTools.mxTools',
              ['mx/Tools/mxTools/mxTools.c'],
              include_dirs=['mx/Tools/mxTools']),
    ]
       )

Do I need to include *all* subpackages in the packages list ?
(distutils seems to work without it.)

-- 
Marc-Andre Lemburg
______________________________________________________________________
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/