[Distutils] Intermediat library and sdist problem

Sophie Coon sophiec@scripps.edu
Mon Aug 6 19:40:04 2001


Hi,
I am trying to write a setup.py to create a source distribution for a
wrapped library. The trick is that I need to build an intermediate
library and the sdist command doesn't seem to like it.
Here is the setup.py that I wrote.
=========================================================================================
import os, sys, string
from distutils.sysconfig import get_python_inc
from distutils.core import setup, Extension
# key is python version : value is the correspondent python directory
name
versionPath = {'2.0':'python2.0',
               '1.5.2':'python1.5',
               '2.1':'python2.1'}

# Where the source file for the amber library are.
libamberSrcs = ['./src/binpos.c',
                './src/conjgrad.c',
                './src/memutil.c',
                './src/prm.c',
                './src/sff.c',
                './src/rand2.c']

# Here could be replace by sys.prefix and sys.exec_prefix.
# That will be for the distribution purpose.

version = string.split(sys.version)[0]

depInclude = sys.exec_prefix + '/include/%s/'%versionPath[version]
numInclude = sys.prefix+'/include/%s/Numeric/'%versionPath[version]
shareInclude = sys.prefix+'/include/%s/'%versionPath[version]

setup( name = 'amber',
       version = '94',
       description = 'Simple Force Field (SFF) package from Amber',
       author = "Tom Mackle, David Case",
       packages = [''],
       libraries = [('libamber',
                     {'sources':libamberSrcs,
                      'include_dirs':['./src/',depInclude, numInclude,
                                      shareInclude
                                      ],
                      'macros':[]},
                     ),],
       ext_modules = [Extension('sffCmodule', ['sffCmodule.c',],
                                include_dirs = ['./src/',depInclude,
                                               
numInclude,shareInclude,],
                                libraries=['libamber'])
                      ])

=========================================================================================================================
python2.0 setup.py sdist gives me the following error message:

Traceback (innermost last):
  File "setup.py", line 44, in ?
    libraries=['libamber'])
  File
"/tsri/python/share/lib/python1.5/site-packages/distutils/core.py", line
138, in setup
    dist.run_commands()
  File
"/tsri/python/share/lib/python1.5/site-packages/distutils/dist.py", line
829, in run_commands
    self.run_command(cmd)
  File
"/tsri/python/share/lib/python1.5/site-packages/distutils/dist.py", line
849, in run_command
    cmd_obj.run()
  File
"/tsri/python/share/lib/python1.5/site-packages/distutils/command/sdist.py",
line 143, in run
    self.get_file_list()
  File
"/tsri/python/share/lib/python1.5/site-packages/distutils/command/sdist.py",
line 242, in get_file_list
    self.add_defaults()
  File
"/tsri/python/share/lib/python1.5/site-packages/distutils/command/sdist.py",
line 319, in add_defaults
    self.filelist.extend(build_clib.get_source_files())
  File
"/tsri/python/share/lib/python1.5/site-packages/distutils/cmd.py", line
107, in __getattr__
    raise AttributeError, attr
AttributeError: get_source_files

I can very successfully run the following command:
python2.0 setup.py bdist
python2.0 setup.py build 
In the last case I have a working package that I can import from a
python interpreter.

I am pretty sure that the sdist command doesn't work because the
intermediate library has not benn build yet when trying to do the tar
ball. Did I make a mistake in the setup.py? if not is there a way around
that problem?

Thanks for any suggestions !
Sophie
-- 
############################################################
Sophie COON	              The Scripps Research Institute
Research Programmer III       Molecular Graphics Laboratory
			      10550 North Torrey Pines Road
Phone: (858) 784-9556                    La Jolla, CA 92037 
Fax  : (858) 784-2860
############################################################