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

View File

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