Custom distutils commands

前端 未结 4 1256
别跟我提以往
别跟我提以往 2020-12-02 13:32

I have a library called \"example\" that I\'m installing into my global site-packages directory. However, I\'d like to be able to install two versions, one for production a

4条回答
  •  春和景丽
    2020-12-02 14:06

    Sure, you can extend distutils with new commands. In your distutil configuration file, add:

     [global]
     command-packages=foo.bar
    

    this can be in distutils.cfg in the distutils package itself, ..pydistutils.cfg in your home directory (no leading dot on Windows), or setup.cfg in the current directory.

    Then you need a foo.bar package in your Python's site-packages directory.

    Then in that package you add the classes implementing your new desired commands, such as stage, subclassing distutils.cmd -- the docs are weak, but there are plenty of examples since all the existing distutils commands are also built that way.

提交回复
热议问题