Created
July 28, 2010 19:34
-
-
Save ssokolow/495943 to your computer and use it in GitHub Desktop.
Template for custom Distutils commands with dependencies
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
"""Template for custom Distutils commands with dependencies""" | |
from distutils.core import Command | |
commands = {} | |
try: | |
from third_party_package import something | |
class MyCommand(Command): | |
description = "Use ThirdPartyPackage™ to frob the project source" | |
user_options = [] | |
def initialize_options(self): | |
"""Use this to set option defaults before parsing.""" | |
pass | |
def finalize_options(self): | |
"""Code to validate/modify command-line/config input goes here.""" | |
pass | |
def run(self): | |
"""Your actual command functionality goes here.""" | |
something.frob(self.distribution.packages) | |
commands['frobnicate'] = MyCommand | |
except ImportError: | |
pass | |
# from distutils.core import setup | |
# setup(..., cmdclass=commands) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment