473,503 Members | 8,784 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Distutils vs. Extension header files

I've got a package that includes an extension that has a number of
header files in the directory with the extension. They are specified
as "depends = [...]" in the Extension class. However, Distutils
doesn't seem to do anything with them.

If I do an sdist, the include files aren't added to the tarball.

If I do a bdist_rpm, the source files get copied into the build
directory and the build starts, but the header files aren't copied
with the source file, so the build fails with a missing header file.

I find it hard to believe that this is a bug in distutils, so I'd
appreciate it if someone could tell me what I'm doing wrong.

Thanks,
<mike
--
Mike Meyer <mw*@mired.org> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
Jul 18 '05 #1
3 2098
Mike Meyer wrote:
I've got a package that includes an extension that has a number of
header files in the directory with the extension. They are specified
as "depends = [...]" in the Extension class. However, Distutils
doesn't seem to do anything with them.

If I do an sdist, the include files aren't added to the tarball.
IIRC you need to add a MANIFEST.IN file to get non-Python files
(including those already referenced in your setup.py) in the mix. You'll
propably need a MANIFEST.IN looking something like the following:

include *.txt
include MANIFEST.in
include setup.py
include setup.cfg

recursive-include src *.c *.h
recursive-include docs *.html *.css *.gif *.jpg *.txt

prune someolddir
HTH,
--

Vincent Wehren


If I do a bdist_rpm, the source files get copied into the build
directory and the build starts, but the header files aren't copied
with the source file, so the build fails with a missing header file.

I find it hard to believe that this is a bug in distutils, so I'd
appreciate it if someone could tell me what I'm doing wrong.

Thanks,
<mike

Jul 18 '05 #2
Mike Meyer <mw*@mired.org> writes:
I've got a package that includes an extension that has a number of
header files in the directory with the extension. They are specified
as "depends = [...]" in the Extension class. However, Distutils
doesn't seem to do anything with them.

If I do an sdist, the include files aren't added to the tarball.

If I do a bdist_rpm, the source files get copied into the build
directory and the build starts, but the header files aren't copied
with the source file, so the build fails with a missing header file.

I find it hard to believe that this is a bug in distutils, so I'd
appreciate it if someone could tell me what I'm doing wrong.


vincent has the solution (you need to specify them in MANIFEST.in),
but I'll add my 2 cents.

depends = [...] is used in building (it's like dependencies in make).
If one of those files change, distutils will rebuild the extension.
But that's all distutils does with it. It's braindead including stuff
in the source distribution, including depends, data files, and other
stuff you'd think it would do. When in doubt, add it to MANIFEST.in.

--
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke
|cookedm(at)physics(dot)mcmaster(dot)ca
Jul 18 '05 #3
co**********@physics.mcmaster.ca (David M. Cooke) writes:
vincent has the solution (you need to specify them in MANIFEST.in),
but I'll add my 2 cents.
Yup. That solved the problem.
depends = [...] is used in building (it's like dependencies in make).
If one of those files change, distutils will rebuild the extension.
But that's all distutils does with it. It's braindead including stuff
in the source distribution, including depends, data files, and other
stuff you'd think it would do. When in doubt, add it to MANIFEST.in.


That pretty much sucks. I've filed a bug report (1083299) about it. If
I find time, I'll look into a fixing it myself.

<mike
--
Mike Meyer <mw*@mired.org> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
Jul 18 '05 #4

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

Similar topics

2
2299
by: Christian Seberino | last post by:
I have a program that has Python and C code. I added Extension stuff to setup.py and all .c and .h files get into tarball fine. (I have something like Extension("foo", glob.glob("bar/*.") ) ...
1
1966
by: Christian Seberino | last post by:
(distutils question) I know how to configure C code with Extension class in setup.py. But, how do you handle header files??.. Do you mention them in your Extension(...) line?? It seems you...
1
2715
by: Christian Seberino | last post by:
I specify packages in my setup.py but what if I want all py files in a directory but one??? How remove just that one?? (Without listing all files I want explicitly??) I need header files to...
0
1844
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
1437
by: Glenn Pierce | last post by:
Hi I have a question about writing a portable setup.py script for distutils. I have a directory structure like this. FreeImage/ |----------Source/ | |------ FreeImage.h |...
6
2334
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,...
1
1158
by: olsongt | last post by:
I'm doing something a little wierd in one of my projects. I'm generating a C source file based on information extracted from python's header files. Although I can just generate the file and check...
9
4135
by: jtravs | last post by:
Hi all, I suspect that I'm doing something stupid, I would like some other opinions though. I'm getting started with ctypes and am trying to use distutils to help build my module. At the moment...
4
2412
by: Gary Jefferson | last post by:
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...
0
7267
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
7316
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...
1
6976
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4993
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1495
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
729
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
372
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.