Distutils problem

Sophie Coon sophiec at scripps.edu
Thu Aug 2 13:56:52 EDT 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

libgleSrcs = ['./src/ex_angle.c', './src/ex_raw.c',
              './src/intersect.c',
              './src/rotate.c', './src/round_cap.c',
              './src/texgen.c',
              './src/view.c', './src/ex_cut_round.c',
              './src/extrude.c',
              './src/qmesh.c', './src/rot_prince.c',
              './src/segment.c',
              './src/urotate.c']

# Describing the extension module, gle_wrap.c

setup( name = "gle",
       version = "3.0",
       description = "GLE Tubing and Extrusion Library",
       author = "Linas Vepstas",
       author_email = "linas at linas.org",
       url = "http://www.linas.org/gle/",
       packages = [''],
       libraries = [('libgle',
                     {'sources': libgleSrcs,
                      'include_dirs':['./src'],
                      'macros':[]},
                     ),
                    ],
       ext_modules = [Extension('glecmodule', ['gle_wrap.c'],
                                include_dirs = ['./src',
                                               
'/tsri/python/share/include/python2.0/Numeric/'],
                                library_dirs =
['./lib','mgl/apps/lib/i86Linux2/'],
                                libraries=['gle.3.0','GL','GLU'])
                      ]
       )
=========================================================================================================================
python2.0 setup.py sdist gives me the following error message:

Traceback (most recent call last):
  File "setup.py", line 36, in ?
    libraries=['gle.3.0','GL','GLU'])
  File "/tsri/python/share//lib/python2.0/distutils/core.py", line 138,
in setup    dist.run_commands()
  File "/tsri/python/share//lib/python2.0/distutils/dist.py", line 829,
in run_commands
    self.run_command(cmd)
  File "/tsri/python/share//lib/python2.0/distutils/dist.py", line 849,
in run_command
    cmd_obj.run()
  File "/tsri/python/share//lib/python2.0/distutils/command/sdist.py",
line 143, in run
    self.get_file_list()
  File "/tsri/python/share//lib/python2.0/distutils/command/sdist.py",
line 242, in get_file_list
    self.add_defaults()
  File "/tsri/python/share//lib/python2.0/distutils/command/sdist.py",
line 319, in add_defaults
    self.filelist.extend(build_clib.get_source_files())
  File "/tsri/python/share//lib/python2.0/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.

That is why I think this error occurs because the library is not yet
build. 
In fact if I build the intermediate library and use the following
setup.py instead I can very successfully run sdist.
setup( name = "gle",
       version = "3.0",
       description = "GLE Tubing and Extrusion Library",
       author = "Linas Vepstas",
       author_email = "linas at linas.org",
       url = "http://www.linas.org/gle/",
       packages = [''],
       ext_modules = [Extension('gle', ['gle_wrap.c'],
                               library_dirs=['./lib',
/mgl/apps/lib/i86Linux2/'],
                               libraries=['gle.3.0','GL', 'GLU'],
                               include_dirs = ['./libgle/',
                                              
'/tsri/python/share/include/python2.0/',
                                              
'/tsri/python/share/include/python2.0/Numeric',
                                               ])]
       )

Did I make a mistake in the way I wrote the setup.py? If not is there a
way around this problem besides building this intermediate library? 
Any help will be very welcome at that point.
Thanks a lot.

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
############################################################



More information about the Python-list mailing list