Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a command hook into setuptools setup?

I am using setuptools Version 0.9.6 and want to add a command hook into setup, following the description shown here or here. I have created a class MyCommand derived from setuptools.Command within the same setup.py file and I am trying to add this hook as follows:

setup(
  # ...
  entry_points = {
    "distutils.commands": [
      "my_command = MyCommand"]}
)

However, the command my_command is not recognized, i.e. python setup.py my_command gives an error

error: invalid command 'my_command'

Maybe I do need to refer to my command in a different way? Or are there changes to the used version 0.9.6 of setuptools? How to do it right?

like image 539
Alex Avatar asked Jul 23 '13 06:07

Alex


1 Answers

Add your command in cmdclass instead thats what i found.

setup(
cmdclass = {'my_command':MyCommand},
)

Type :

>>> python setup.py --help-commands

Will list your command in Extra Commands

like image 61
Manuj Rastogi Avatar answered Sep 26 '22 03:09

Manuj Rastogi