Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Distutils vs. Extension header files

72 views
Skip to first unread message

Mike Meyer

unread,
Dec 9, 2004, 7:20:10 PM12/9/04
to
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 <m...@mired.org> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

vincent wehren

unread,
Dec 9, 2004, 11:47:30 PM12/9/04
to
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

David M. Cooke

unread,
Dec 10, 2004, 4:32:12 PM12/10/04
to
Mike Meyer <m...@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

Mike Meyer

unread,
Dec 10, 2004, 8:23:24 PM12/10/04
to
cooked...@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.

0 new messages