Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

distutils.core.setup console script entry point?

I used to distribute my python programs with setuptools.setup. But now I want to use distutils.core.setup.

With setuptools I used a code similar to this:

setup(
    name = "radish",
    version = "0.01.00",
    description = "Behaviour-Driven-Development tool for python",
    author = "Timo Furrer",
    author_email = "[email protected]",
    url = "http://github.com/timofurrer/radish",
    packages = [ "radish", "radish/Writers" ],
    entry_points = { "console_scripts": [ "radish = radish.main:main", ] },
    package_data = { "radish": [ "*.md" ] }
    ...
)

I want to do the same with distutils - but there is no entry_points available. How can I manage this? How can I specify my new command?

like image 751
tuxtimo Avatar asked Dec 22 '12 10:12

tuxtimo


2 Answers

You can't, not with distutils. It does not support entry_points, that's a setuptools-only feature.

Use setuptools instead; it supports Python 3.

like image 196
Martijn Pieters Avatar answered Sep 21 '22 00:09

Martijn Pieters


With distutils, scripts are just files, like this example:

#!/usr/bin/env python
from radish.main import main
main()

In your setup script, you use the scripts parameter to list these files.

This works great on Unix and can work on Windows if people/installers set up file associations properly (no binary wrappers are generated, like what setuptools does). A .py extension will be needed for Windows, and will be okay (unneeded and for many people ugly) on Unix.

Far from perfect, but can work if you audience is developers for example, or doesn’t use Windows.

like image 23
merwok Avatar answered Sep 20 '22 00:09

merwok