New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add timestamp-based dependency system to build_clib #930

Merged
merged 3 commits into from Jan 29, 2017

Conversation

Projects
None yet
2 participants
@GandaG
Contributor

GandaG commented Jan 20, 2017

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. 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'}
    }
)]
...
)
  • 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.

If the implementation is fine I can get started on documentation, just not sure where to put it.

GandaG added some commits Jan 14, 2017

Added build_clib module and unit tests.
Added rudimentary dependency system for build_libraries.
Added obj_deps and cflags keys to build_info dictionary.
@jaraco

This comment has been minimized.

Member

jaraco commented Jan 29, 2017

This seems reasonable, and I appreciate the effort put into making this first request a complete and thorough one.

I welcome subsequent improvements to the documentation. I also encourage you to see this implementation made the default in distutils (stdlib) with setuptools providing forward compatibility but eventually delegating that role back to distutils. I won't stipulate that as a requirement, however.

@jaraco jaraco merged commit f681001 into pypa:master Jan 29, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

jaraco added a commit that referenced this pull request Jan 29, 2017

@GandaG

This comment has been minimized.

Contributor

GandaG commented Jan 29, 2017

I'll definitely look into that, time to start learning mercurial :) Thanks!

@GandaG GandaG deleted the GandaG:build_clib branch Jan 29, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment