Use entry_points instead of scripts in setup.py

This allows a fine-grained control of the dependencies, because it generates a wrapper script
that calls the specifiend function (i.e., main inside cheat/app.py)
This commit is contained in:
Alessio Bogon 2015-01-09 00:36:49 +01:00
parent 5caa8fed38
commit 4d57f529c9
2 changed files with 12 additions and 4 deletions

View File

@ -31,12 +31,13 @@ Options:
"""
# require the dependencies
from cheat import *
from cheat.utils import *
import sheet
import sheets
from utils import *
from docopt import docopt
if __name__ == '__main__':
def main():
# parse the command-line options
options = docopt(__doc__, version='cheat 2.1.3')
@ -59,3 +60,6 @@ if __name__ == '__main__':
# print the cheatsheet
else:
print(colorize(sheet.read(options['<cheatsheet>'])))
if __name__ == '__main__':
main()

View File

@ -23,7 +23,11 @@ setup(
package_data = {
'cheat.cheatsheets': ['*'],
},
scripts = ['bin/cheat'],
entry_points = {
'console_scripts': [
'cheat = cheat.app:main',
],
},
install_requires = [
'docopt >= 0.6.1',
'pygments >= 1.6.0',