66 python setup.py install
77"""
88
9+ from __future__ import print_function
910import sys
1011import os .path
1112
1516sys .path .insert (0 , HERE )
1617
1718from setuptools import find_packages , setup
19+ import inspect
1820# MAYBE: from setuptools_behave import behave_test
1921
2022# -----------------------------------------------------------------------------
@@ -30,20 +32,50 @@ def find_packages_by_root_package(where):
3032 packages .insert (0 , root_package )
3133 return packages
3234
35+ def make_long_description (marker = None , intro = None ):
36+ """
37+ This package extends the click_ functionality by adding support for commands
38+ that use configuration files.
39+
40+ .. _click: https://click.pocoo.org/
41+
42+
43+ .. code-block:: python
44+
45+ # EXAMPLE:
46+ """
47+ if intro is None :
48+ intro = inspect .getdoc (make_long_description )
49+
50+ with open ("README.rst" , "r" ) as infile :
51+ line = infile .readline ()
52+ while not line .strip ().startswith (marker ):
53+ line = infile .readline ()
54+
55+ # -- COLLECT REMAINING: Usage example
56+ contents = infile .read ()
57+
58+ text = intro + "\n " + contents
59+ return text
60+
61+ # -- FILE: example_command_with_configfile.py (ALL PARTS: simplified)
3362
3463# ----------------------------------------------------------------------------
3564# PROJECT CONFIGURATION (for sdist/setup mostly):
3665# ----------------------------------------------------------------------------
37- install_requires = [ "click >= 6.6" ]
66+ install_requires = ["click >= 6.6" , "six >= 1.10" ]
3867before_py35_extra = []
3968if sys .version < "3.5" :
40- install_requires .append ("configparser" )
41- before_py35_extra .append ("configparser" )
69+ install_requires .append ("configparser >= 3.5.0" )
70+ before_py35_extra .append ("configparser >= 3.5.0" )
71+
72+ EXAMPLE_MARKER = "# MARKER-EXAMPLE:"
73+ long_description = make_long_description (EXAMPLE_MARKER )
74+ SETUP_DEBUG = os .environ .get ("SETUP_DEBUG" , "no" ) in ("yes" , "true" , "on" )
75+ if SETUP_DEBUG :
76+ print (long_description )
4277
43- README = os .path .join (HERE , "README.rst" )
44- long_description = "" .join (open (README ).readlines ()[4 :])
4578
46- NAME = "click-configfile"
4779CLASSIFIERS = """\
4880 License :: OSI Approved :: BSD License
4981Development Status :: 3 - Alpha
@@ -82,8 +114,10 @@ def find_packages_by_root_package(where):
82114 platforms = [ 'any' ],
83115 classifiers = CLASSIFIERS .splitlines (),
84116 # packages = find_packages_by_root_package("click_configfile"),
85- modules = ["click_configfile" ],
117+ py_modules = ["click_configfile" ],
86118 install_requires = install_requires ,
119+ setup_requires = ["pytest-runner" ],
120+ tests_require = ["pytest >= 3.0" ],
87121 include_package_data = True ,
88122 extras_require = {
89123 # -- SUPPORT-WHEELS: Extra packages for Python2.6
0 commit comments