|
1 | 1 | #!/usr/bin/env python |
| 2 | +# pylint: disable=missing-docstring |
2 | 3 |
|
3 | 4 | """Main setup script.""" |
4 | 5 |
|
5 | 6 | import ast |
6 | 7 | from os import path |
7 | 8 | from setuptools import setup, find_packages |
8 | 9 |
|
9 | | -CLI_TREE = ast.parse(open(path.join("twtoolbox", "cli.py")).read()) |
10 | | -CONSOLE_SCRIPTS = ["%s = twtoolbox.cli:%s" % (fn.name.replace("_", "-"), fn.name) |
11 | | - for fn in CLI_TREE.body |
12 | | - if isinstance(fn, ast.FunctionDef) and fn.name.startswith('tt_')] |
| 10 | +VERSION = "1.2.0" |
| 11 | +DESCRIPTION = "Twitter Toolbox for Python" |
| 12 | +AUTHOR = "Hugo Hromic" |
| 13 | +AUTHOR_EMAIL = "hhromic@gmail.com" |
| 14 | +URL = "https://github.com/hhromic/python-twitter-toolbox" |
| 15 | + |
| 16 | +def read_long_description(): |
| 17 | + with open("README.rst") as reader: |
| 18 | + return reader.read() |
| 19 | + |
| 20 | +def generate_console_scripts(): |
| 21 | + with open(path.join("twtoolbox", "cli.py")) as reader: |
| 22 | + cli_tree = ast.parse(reader.read()) |
| 23 | + return ["%s = twtoolbox.cli:%s" % (fn.name.replace("_", "-"), fn.name) |
| 24 | + for fn in cli_tree.body if isinstance(fn, ast.FunctionDef) and |
| 25 | + fn.name.startswith('tt_')] |
13 | 26 |
|
14 | 27 | setup( |
| 28 | + name="twitter-toolbox", version=VERSION, description=DESCRIPTION, |
| 29 | + author=AUTHOR, author_email=AUTHOR_EMAIL, |
| 30 | + maintainer=AUTHOR, maintainer_email=AUTHOR_EMAIL, |
| 31 | + url=URL, download_url=URL + "/tarball/" + VERSION, |
| 32 | + requires=["tweepy", "colorlog"], |
| 33 | + install_requires=["tweepy", "colorlog"], |
| 34 | + provides=["twtoolbox"], |
| 35 | + keywords=["twitter", "api", "cli", "toolbox"], |
| 36 | + classifiers=["Environment :: Console"], |
| 37 | + license="Apache-2.0", |
| 38 | + platforms=["all"], |
| 39 | + long_description=read_long_description(), |
15 | 40 | packages=find_packages(), |
16 | | - entry_points={"console_scripts": CONSOLE_SCRIPTS}, |
| 41 | + package_data={"twtoolbox": ["defaults.cfg"]}, |
| 42 | + entry_points={"console_scripts": generate_console_scripts()}, |
17 | 43 | ) |
0 commit comments