Created
September 2, 2011 19:29
-
-
Save embray/1189618 to your computer and use it in GitHub Desktop.
A d2to1 example of setup_hooks and pre/post command hooks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./setup.py build | |
Setting up testproj | |
running build | |
running pre_hook testproj.pre_build_hook for command build | |
Someone is building my project! | |
running build_py | |
running post_hook testproj.post_build_hook for command build | |
Someone built my project! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[metadata] | |
name = testproj | |
version = 0.1 | |
[files] | |
modules = testproj | |
[global] | |
setup-hooks = testproj.setup_hook | |
[build] | |
pre-hook.test-hook = testproj.pre_build_hook | |
post-hook.test-hook = testproj.post_build_hook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from setuptools import setup | |
setup( | |
setup_requires=['d2to1'], | |
d2to1=True | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def setup_hook(cfg): | |
print 'Setting up %s' % cfg['metadata']['name'] | |
def pre_build_hook(cmd): | |
print 'Someone is building my project!' | |
def post_build_hook(cmd): | |
print 'Someone built my project!' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment