classification
Title: Add timestamp-based dependency system to build_clib
Type: enhancement Stage: resolved
Components: Distutils Versions: Python 3.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: daniel.nunes, dstufft, eric.araujo, steve.dower
Priority: normal Keywords: patch

Created on 2017-02-01 01:20 by daniel.nunes, last changed 2021-02-03 18:21 by steve.dower. This issue is now closed.

Files
File name Uploaded Description Edit
build_clib.patch daniel.nunes, 2017-02-01 01:19 review
Messages (2)
msg286577 - (view) Author: Daniel Nunes (daniel.nunes) * Date: 2017-02-01 01:19
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!
msg386354 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-02-03 18:21
Distutils is now deprecated (see PEP 632) and all tagged issues are being closed. From now until removal, only release blocking issues will be considered for distutils.

If this issue does not relate to distutils, please remove the component and reopen it. If you believe it still requires a fix, most likely the issue should be re-reported at https://github.com/pypa/setuptools
History
Date User Action Args
2021-02-03 18:21:25steve.dowersetstatus: open -> closed

nosy: + steve.dower
messages: + msg386354

resolution: out of date
stage: resolved
2017-02-01 01:20:08daniel.nunescreate