create a command for setup.py

I’ve been looking into distutils stuff lately. It seems like really nice stuff… it’s capable of all sorts of nice things. One of the things I’d like to do is add some commands for creating releases, which involves automatically creating a release branch in perforce. I was having a lot of trouble getting enough information to do this, so here it goes. I also found a very informative skeleton on lesscode.


class HelloWorld(Command):
  """This is a simple hello world command addition."""
  # user options is a list of tuples. each tuple conforms to:
  # ('long-arg-name=', 'a', "Description of option.")
  user_options = []
  command_name = "helloworld"
  def initialize_options(self):
    pass

  def finalize_options(self):
    pass

  def run(self):
    print "hello world."

You’ll also need to add setup(cmdclass={'build_py': build_py}, ...) to setup.py, as explained in the python docs.

Advertisements

Post a Comment

Required fields are marked *
*
*

%d bloggers like this: