Skip to content
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
Merged

Add timestamp-based dependency system to build_clib #930

merged 3 commits into from Jan 29, 2017

Conversation

GandaG
Copy link

@GandaG 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.

Daniel Nunes added 3 commits January 14, 2017 22:05
Added rudimentary dependency system for build_libraries.
Added obj_deps and cflags keys to build_info dictionary.
@jaraco
Copy link
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
jaraco added a commit that referenced this pull request Jan 29, 2017
@GandaG
Copy link
Author

GandaG commented Jan 29, 2017

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

@GandaG GandaG deleted the build_clib branch January 29, 2017 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants