Python: migrate setup.py “scripts=” to entry_points

前端 未结 1 893
忘了有多久
忘了有多久 2021-02-20 05:02

I\'d like to make use of someone else\'s python utility, foobartools, whose native environment is linux. Foobartools is pure python so there\'s no reason it ca

1条回答
  •  难免孤独
    2021-02-20 05:58

    I got to a working Scripts\foobar.exe, but it changes more of the code than I wish. I was hoping to get by with just a couple of tweaks to setup.py, or at least something that doesn't mess around inside upstream modules. I don't know it well enough to be sure I'm not getting in the way somehow.

    (1) move bin/foobar --> foobartools/foobar_cli.py
    (2) In setup.py, comment out #scripts=... and add:

    entry_points = {
        'console_scripts': ['foobar = foobartools.foobar_cli:main'],
    } 
    

    [later] A refinement of the same core idea, means I keep my fat feet out of the main business area:

    (1) move ./bin/foobar --> ./foobar_cli/foobar.py (note extension as well as folder change)
    (2) add an empty __init__.py to same folder
    (3) console_scripts': ['foobar = foobar_cli.foorbar:main'],

    0 讨论(0)
提交回复
热议问题