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.

Author daniel.nunes
Recipients daniel.nunes, dstufft, eric.araujo
Date 2017-02-01.01:19:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1485912008.84.0.925111372259.issue29408@psf.upfronthosting.co.za>
In-reply-to
Content
Summary:
  - Added newer_pairwise_group function to distutils.dep_util
  - Added documentation and tests for previous function
  - Added timestamp-based dependency system to build_libraries in build_clib
  - Added tests for the above

build_clib is sorely missing one thing in distutils - checking outdated dependencies when compiling. This makes it so that, when building a static c library, all objects are always all compiled.

The function to create the static library itself does implement something of this sort, but since all objects have been recompiled it has no practical effect (everything still runs every time).

This is a small patch designed to fix that, with a couple of qol improvements along the way. Two new keys were added to the build_info dictionary:
    obj_deps - Allows specifying extra dependencies for each source so they can be recognized as being newer than the object being compiled. 
    cflags - This just allows the user to provide an extra set of flags to the compiler.

That is pretty much it, a simple (but important) quality of life improvement for those of us who need to compile static libs with python.

Example:
setup(
...
libraries=[(
    'examplelib', 
    {'sources': 'example.c', 
     'obj_deps': {'': 'global.h',  # use an empty string to define global (for all sources) dependencies
                  'example.c': 'example.h'}
    }
)]
...
)


Documentation for the new function is done but there is no documentation for build_clib itself. After submitting this I'll start working on it and will wait to submit it until this patch is accepted/rejected (so I can know what to include).

Thanks!
History
Date User Action Args
2017-02-01 01:20:10daniel.nunessetrecipients: + daniel.nunes, eric.araujo, dstufft
2017-02-01 01:20:08daniel.nunessetmessageid: <1485912008.84.0.925111372259.issue29408@psf.upfronthosting.co.za>
2017-02-01 01:20:08daniel.nuneslinkissue29408 messages
2017-02-01 01:20:06daniel.nunescreate