Distutils vs. Extension header files

M

Mike Meyer

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
 
V

vincent wehren

Mike said:
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,
 
D

David M. Cooke

Mike Meyer said:
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.
 
M

Mike Meyer

[email protected] (David M. Cooke) said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,167
Messages
2,570,911
Members
47,453
Latest member
MadelinePh

Latest Threads

Top