Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > distutils, extensions, and missing headers

Reply
Thread Tools

distutils, extensions, and missing headers

 
 
Gary Jefferson
Guest
Posts: n/a
 
      09-20-2007
My setup.py (with extension) seems to work great for build and
install, but for bdist_rpm, compilation of the extension fails because
some of the headers needed to build the extension aren't in the bdist
tarball.

I've tried adding a 'depends=[]' to the Extension definition with
these header files present, but they still don't get put in the
tarball.

What's the key to getting headers or other [non-python] files included
in a bdist?

Thanks,
Gary

 
Reply With Quote
 
 
 
 
Robert Kern
Guest
Posts: n/a
 
      09-20-2007
Gary Jefferson wrote:
> My setup.py (with extension) seems to work great for build and
> install, but for bdist_rpm, compilation of the extension fails because
> some of the headers needed to build the extension aren't in the bdist
> tarball.
>
> I've tried adding a 'depends=[]' to the Extension definition with
> these header files present, but they still don't get put in the
> tarball.
>
> What's the key to getting headers or other [non-python] files included
> in a bdist?


Use the "headers" keyword to setup() to list the header files you want installed.

For other files, it depends on where you need them to go. If you want the data
files to be inside the package, you should use the "package_data" keyword. It
was introduced in Python 2.4, so if you need to support pre-2.4 Pythons, there
are recipes floating around to do so more nicely.

http://docs.python.org/dist/node12.html

For other things (and hopefully, you can live with package data), use "data_files":

http://docs.python.org/dist/node13.html

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

 
Reply With Quote
 
 
 
 
Gary Jefferson
Guest
Posts: n/a
 
      09-20-2007
Robert, thanks for the help!


On Sep 20, 1:22 am, Robert Kern <(E-Mail Removed)> wrote:
>
> Use the "headers" keyword to setup() to list the header files you want installed.


I've tried "headers=['header1.h', 'header2.h']" in setup() as well
as in Extension(), and neither seem to get the files into the bdist or
bdist_rpm tarball. Am I doing it wrong? I can't seem to find any
examples that use this via google.


> For other files, it depends on where you need them to go. If you want the data
> files to be inside the package, you should use the "package_data" keyword. It
> was introduced in Python 2.4, so if you need to support pre-2.4 Pythons, there
> are recipes floating around to do so more nicely.
>
> http://docs.python.org/dist/node12.html
>
> For other things (and hopefully, you can live with package data), use "data_files":
>
> http://docs.python.org/dist/node13.html


I also tried using data_files to get the headers included, but can't
seem to get that to work either. No errors are reported for either
method.

Thanks,
Gary

 
Reply With Quote
 
Robert Kern
Guest
Posts: n/a
 
      09-20-2007
Gary Jefferson wrote:
> On Sep 20, 1:22 am, Robert Kern <(E-Mail Removed)> wrote:
>> Use the "headers" keyword to setup() to list the header files you want installed.

>
> I've tried "headers=['header1.h', 'header2.h']" in setup() as well
> as in Extension(), and neither seem to get the files into the bdist or
> bdist_rpm tarball. Am I doing it wrong? I can't seem to find any
> examples that use this via google.


You might need an accurate relative path. I'm assuming that you don't actually
keep header1.h and header2.h in the top-level directory next to the setup.py.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

 
Reply With Quote
 
Gary Jefferson
Guest
Posts: n/a
 
      09-21-2007
On Sep 20, 12:08 pm, Robert Kern <(E-Mail Removed)> wrote:
> Gary Jefferson wrote:
> > On Sep 20, 1:22 am, Robert Kern <(E-Mail Removed)> wrote:
> >> Use the "headers" keyword to setup() to list theheaderfiles you want installed.

>
> > I've tried "headers=['header1.h', 'header2.h']" in setup() as well
> > as in Extension(), and neither seem to get the files into the bdist or
> > bdist_rpm tarball. Am I doing it wrong? I can't seem to find any
> > examples that use this via google.

>
> You might need an accurate relative path. I'm assuming that you don't actually
> keep header1.h and header2.h in the top-level directory next to the setup.py.


I think I've got it, just needed to do a MANIFEST.in file as in
http://groups.google.com/group/comp....29ad06c50cff46
.. Apparently, the headers arg doesn't affect sdist or bdist.

With that, the headers get included in the tarballs, and bdist_rpm no
longer complains about them. Unfortunately, it now complains about
missing .o files. These .o's are built automatically via 'setup.py
build', but not via 'setup.py bdist_rpm', for reasons I can't fathom
at the moment. But if I figure it out, I'll post here.

Gary

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with wsgiref.headers.Headers Phil Python 4 01-17-2010 04:47 PM
Server cannot clear headers after HTTP headers have been sent Ian ASP .Net Security 2 03-20-2007 09:00 AM
Date missing from message headers Danny Colyer Firefox 2 04-25-2004 10:07 AM
Reading 'received' headers: Email Headers Parsing dont bother Python 0 03-03-2004 08:18 PM
HREF attribute missing from child DataGrid column headers after render... Nathan Baulch ASP .Net Building Controls 1 09-19-2003 01:43 AM



Advertisments