473,386 Members | 1,702 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

distutils, extensions, and missing headers

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

Sep 20 '07 #1
4 2410
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

Sep 20 '07 #2
Robert, thanks for the help!
On Sep 20, 1:22 am, Robert Kern <robert.k...@gmail.comwrote:
>
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

Sep 20 '07 #3
Gary Jefferson wrote:
On Sep 20, 1:22 am, Robert Kern <robert.k...@gmail.comwrote:
>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

Sep 20 '07 #4
On Sep 20, 12:08 pm, Robert Kern <robert.k...@gmail.comwrote:
Gary Jefferson wrote:
On Sep 20, 1:22 am, Robert Kern <robert.k...@gmail.comwrote:
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

Sep 21 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Isaac Jones | last post by:
Hello Python Community. I bring greetings from the Haskell community (http://www.haskell.org) ;) There has been a lot of discussion of late about creating a grand-unified build & distribution...
15
by: Colin J. Williams | last post by:
The distutils download page has: -------------------------------------------------------- Current stable release The current stable release is Distutils 1.0.2; you can download it as: *...
5
by: Fuzzyman | last post by:
Python 2.4 is built with Microsoft Visiual C++ 7. This means that it uses msvcr7.dll, which *isn't* a standard part of the windows operating system. This means that if you build a windows installer...
0
by: Maarten Sneep | last post by:
I'm trying to build PyBison on Mac OS X, and I'm running into some problems with the distutils. Just for starters: PyBison requires Pyrex. This is not a problem, and Pyrex seems to work without...
0
by: Benjamin Rutt | last post by:
I have a rather large C++ project which has his own build system (scons) and I would prefer to stay inside scons in order to build some python extensions/embeddings (that is, I prefer to avoid...
6
by: ajikoe | last post by:
Hello I tried to combine c++ and python together. So I follow from this website: http://kortis.to/radix/python_ext/ I have this code: # prmodule.c static PyObject *pr_isprime(PyObject *self,...
3
by: Chris Paul | last post by:
I'm having trouble with PHP & PostgreSQL/OpenLDAP/Apache on Windows. I've set this up countless times on BSD (piece of cake) but I'm trying to do this on Windows now so that my developer can work...
6
by: seberino | last post by:
I know distutils well but don't know anything about Ant except that it is a build tool from Apache project. Could it possible be better or as good as distutils? (There are extensions for...
2
by: Blair LeGent | last post by:
Following the directions in "Python in a Nutshell" (an excellent book), I entered the C code for "helloworld.c", saved it as a file, and entered this script and saved it as setup.py: from...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.