Skip to content

Commit 602f18e

Browse files
committed
Setup tweaks
1 parent 45d7f5c commit 602f18e

File tree

4 files changed

+60
-14
lines changed

4 files changed

+60
-14
lines changed

MANIFEST.in

+13-7
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,29 @@
11
include MANIFEST.in
2+
include LICENSE
23
include setup.py
34
include *.txt
45
include *.rst
56
include *.ini
6-
include *.cmd
7-
include .bumversion.cfg
7+
include .bumpversion.cfg
88
include .coveragerc
99
include .pylintrc
10-
include docs/Makefile
11-
recursive-include click_configfile *.py
12-
recursive-include docs *.py *.rst *.txt *.css *.json *.in make.bat
10+
1311
recursive-include tests *.txt *.py *.ini
14-
recursive-include bin *.py *.cmd *.zip
15-
recursive-include tasks/ *.py
12+
recursive-include tasks *.py *.txt *.rst
13+
recursive-include py.requirements *.txt
14+
# MAYBE: recursive-include tasks/ *.py *.zip
1615

16+
# include click_configfile.py
17+
# PREPARED: recursive-include click_configfile *.py
18+
# PREPARED: include *.cmd
19+
# PREPARED: recursive-include bin *.py *.cmd *.zip
20+
# PREPARED: recursive-include docs *.py *.rst *.txt *.css *.json *.in make.bat
21+
# PREPARED: include docs/Makefile
1722
# MAYBE: include bin/behave
1823
# MAYBE: recursive-include features *.feature *.py *.txt
1924
# MAYBE: recursive-include lib *.py *.pth *.zip *.egg
2025

26+
recursive-exclude _* *.*
2127
recursive-exclude .git *.*
2228
recursive-exclude .tox *.*
2329
recursive-exclude .venv* *.*

README.rst

+1
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ The resulting source code is:
160160

161161
.. code-block:: python
162162
163+
# MARKER-EXAMPLE:
163164
# -- FILE: example_command_with_configfile.py (ALL PARTS: simplified)
164165
from click_configfile import ConfigFileReader, Param, SectionSchema
165166
from click_configfile import matches_section

setup.cfg

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# -- CONVENIENCE: Use pytest-runner (ptr) as test runner.
2+
[aliases]
3+
docs = build_sphinx
4+
test = pytest
5+
16
[sdist]
27
formats = zip, gztar, bztar
38

setup.py

+41-7
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
python setup.py install
77
"""
88

9+
from __future__ import print_function
910
import sys
1011
import os.path
1112

@@ -15,6 +16,7 @@
1516
sys.path.insert(0, HERE)
1617

1718
from 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"]
3867
before_py35_extra = []
3968
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)
4277

43-
README = os.path.join(HERE, "README.rst")
44-
long_description = "".join(open(README).readlines()[4:])
4578

46-
NAME = "click-configfile"
4779
CLASSIFIERS = """\
4880
License :: OSI Approved :: BSD License
4981
Development 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

Comments
 (0)