473,796 Members | 2,629 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.or g> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
Jul 18 '05 #1
3 2118
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.or g> 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)phy sics(dot)mcmast er(dot)ca
Jul 18 '05 #3
co**********@ph ysics.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.or g> 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
2313
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/*.") ) When I try to INSTALL the package it says header (.h) file is an unknown type. How fix this???
1
1980
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 must 1. Treat them like data files and put them *somewhere*.
1
2735
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 build a C extension but I DON't want headers installed. *How do I include header files in the tar.gz (tarball) file but NOT have them be installed when "python setup.py install" done??
0
1875
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 problems, at least the primes sample module shows a nice 25 to 30 fold speed increase over the pure python version. I used the distutils to create the module from the primes.pyx sample, following the setup.py from the PyBison distrubution:
0
1454
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 | |----------Dist/ | |------FreeImage.lib
6
2347
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, PyObject *args){ int n, input; if (!PyArg_ParseTuple(args, "i", &input))
1
1173
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 the result into source control, I'd rather have the file generated during the install process instead of doing it manually. So I'd like to: + have the file generated when a unix user runs setup.py install. + have the file generated when I...
9
4164
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 I simply want distutils to build a shared c library (not a python extension!). Under linux, the following works, under windows xp id doesn't (which I guess is obvious, but the linux success lead me on). I have two files at the moment...
4
2427
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 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 files included
0
9679
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10453
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10223
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10172
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9050
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7546
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5573
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.