6
6
python setup.py install
7
7
"""
8
8
9
+ from __future__ import print_function
9
10
import sys
10
11
import os .path
11
12
15
16
sys .path .insert (0 , HERE )
16
17
17
18
from setuptools import find_packages , setup
19
+ import inspect
18
20
# MAYBE: from setuptools_behave import behave_test
19
21
20
22
# -----------------------------------------------------------------------------
@@ -30,20 +32,50 @@ def find_packages_by_root_package(where):
30
32
packages .insert (0 , root_package )
31
33
return packages
32
34
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)
33
62
34
63
# ----------------------------------------------------------------------------
35
64
# PROJECT CONFIGURATION (for sdist/setup mostly):
36
65
# ----------------------------------------------------------------------------
37
- install_requires = [ "click >= 6.6" ]
66
+ install_requires = ["click >= 6.6" , "six >= 1.10" ]
38
67
before_py35_extra = []
39
68
if 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 )
42
77
43
- README = os .path .join (HERE , "README.rst" )
44
- long_description = "" .join (open (README ).readlines ()[4 :])
45
78
46
- NAME = "click-configfile"
47
79
CLASSIFIERS = """\
48
80
License :: OSI Approved :: BSD License
49
81
Development Status :: 3 - Alpha
@@ -82,8 +114,10 @@ def find_packages_by_root_package(where):
82
114
platforms = [ 'any' ],
83
115
classifiers = CLASSIFIERS .splitlines (),
84
116
# packages = find_packages_by_root_package("click_configfile"),
85
- modules = ["click_configfile" ],
117
+ py_modules = ["click_configfile" ],
86
118
install_requires = install_requires ,
119
+ setup_requires = ["pytest-runner" ],
120
+ tests_require = ["pytest >= 3.0" ],
87
121
include_package_data = True ,
88
122
extras_require = {
89
123
# -- SUPPORT-WHEELS: Extra packages for Python2.6
0 commit comments