This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: specifying headers for extensions
Type: Stage:
Components: Distutils Versions: Python 2.3
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: jhylton Nosy List: fdrake, gvanrossum, jhylton, theller
Priority: normal Keywords: patch

Created on 2002-03-21 11:09 by theller, last changed 2022-04-10 16:05 by admin. This issue is now closed.

File name Uploaded Description Edit
headers_patch_3 theller, 2002-03-21 11:09 patch1.txt
Messages (9)
msg39305 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2002-03-21 11:09
This patch allows to specify that C header files are 
part of source files for dependency checking. 
The 'sources' list in Extension instances can be 
simple filenames as before, but they can also be 
SourceFile instances created by

SourceFile("myfile.c", headers=["inc1.h", "inc2.h"]).

Unfortunately not only changes to command.build_ext 
and command.build_clib had to be made, also all the 
ccompiler (sub)classes have to be changed because the 
ccompiler does the actual dependency checking. I 
updated all the ccompiler subclasses except, but only msvccompiler has actually 
been tested.

The argument list which dep_util.newer_pairwise() now 
accepts has changed, the first arg must now be a 
sequence of SourceFile instances. This may be 
problematic, better would IMO be to move this function 
(with a new name?) into ccompiler.
msg39306 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-03-24 22:05
Logged In: YES 

Why is this priority 7??????
msg39307 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2002-03-25 09:03
Logged In: YES 

Fred requested it this way:
msg39308 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2002-04-04 19:57
Logged In: YES 

Wow!  That's certainly more patch than I'd expected, but the
approach looks about right to me.  I'd like to take another
look at it in a few days (mail me if I don't take action
soon) before we accept, just to make sure I understand it

msg39309 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2002-04-25 17:13
Logged In: YES 

This patch has two problems:
- it is too large,
- it breaks custom subclasses of distutils' build command
family. I have two of them in my setup scripts, there are
probably more out in the world.

Here is an idea for a totally different approach:
The checking whether targets needs to be rebuild is done
with  the newer_group() and newer_pairwise() functions in
distutils.dep_util. These methods could scan the
source-files for include directives and user the timestamps
of the include files as well.
This patch would be fairly small.
OTOH, I have no C-source scanner lying around, and also
don't feel to write one.
msg39310 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2002-05-24 18:28
Logged In: YES 

Shouldn't holdup any release.
msg39311 - (view) Author: Fred Drake (fdrake) (Python committer) Date: 2002-06-12 20:13
Logged In: YES 

Assigned to Jeremy since he's dealing with this issue today.
msg39312 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2002-06-12 20:18
Logged In: YES 

I think this approach to dependency tracking is too
complicated.  The recent depends argument to Extension
rebuilds everything.  This patch would allow individual .o
files to be rebuilt, but at the expense of complicating the
list of sources too much.

Perhaps a compromise would be to use depends to specify
either a list of global dependencies or a list of per-file
dependencies specified as a pair containing a filename and a
msg39313 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2002-10-15 16:03
Logged In: YES 

Jeremy's solution works nicely, and is already implemented.
Closing as works for me.
Date User Action Args
2022-04-10 16:05:07adminsetgithub: 36301
2002-03-21 11:09:37thellercreate