• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3"""
4Setup script for "parse_type" package.
5
6USAGE:
7    python setup.py install
8    # OR:
9    pip install .
10
11SEE ALSO:
12
13* https://pypi.org/pypi/parse_type
14* https://github.com/jenisys/parse_type
15
16RELATED:
17
18* https://setuptools.readthedocs.io/en/latest/history.html
19"""
20
21import sys
22import os.path
23sys.path.insert(0, os.curdir)
24
25# -- USE: setuptools
26from setuptools import setup, find_packages
27
28
29# -----------------------------------------------------------------------------
30# PREPARE SETUP:
31# -----------------------------------------------------------------------------
32HERE = os.path.dirname(__file__)
33python_version = float('%s.%s' % sys.version_info[:2])
34
35README = os.path.join(HERE, "README.rst")
36long_description = ''.join(open(README).readlines()[4:])
37extra = dict(
38    tests_require=[
39        "pytest <  5.0; python_version <  '3.0'", # >= 4.2
40        "pytest >= 5.0; python_version >= '3.0'",
41        "pytest-html >= 1.19.0",
42        # -- PYTHON 2.6 SUPPORT:
43        "unittest2; python_version < '2.7'",
44    ],
45)
46
47if python_version >= 3.0:
48    extra["use_2to3"] = True
49
50# -- NICE-TO-HAVE:
51# # FILE: setup.cfg -- Use pytest-runner (ptr) as test runner.
52# [aliases]
53# test = ptr
54# USE_PYTEST_RUNNER = os.environ.get("PYSETUP_TEST", "pytest") == "pytest"
55USE_PYTEST_RUNNER = os.environ.get("PYSETUP_TEST", "no") == "pytest"
56if USE_PYTEST_RUNNER:
57    extra["tests_require"].append("pytest-runner")
58
59# -----------------------------------------------------------------------------
60# UTILITY:
61# -----------------------------------------------------------------------------
62def find_packages_by_root_package(where):
63    """
64    Better than excluding everything that is not needed,
65    collect only what is needed.
66    """
67    root_package = os.path.basename(where)
68    packages = [ "%s.%s" % (root_package, sub_package)
69                 for sub_package in find_packages(where)]
70    packages.insert(0, root_package)
71    return packages
72
73
74# -----------------------------------------------------------------------------
75# SETUP:
76# -----------------------------------------------------------------------------
77setup(
78    name = "parse_type",
79    version = "0.5.3",
80    author = "Jens Engel",
81    author_email = "jenisys@noreply.github.com",
82    url = "https://github.com/jenisys/parse_type",
83    download_url= "http://pypi.python.org/pypi/parse_type",
84    description = "Simplifies to build parse types based on the parse module",
85    long_description = long_description,
86    keywords= "parse, parsing",
87    license = "BSD",
88    packages = find_packages_by_root_package("parse_type"),
89    include_package_data = True,
90
91    # -- REQUIREMENTS:
92    python_requires=">=2.6, !=3.0.*, !=3.1.*",
93    install_requires=[
94        "parse >= 1.9.1",
95        "enum34; python_version < '3.4'",
96        "six >= 1.11",
97        "ordereddict; python_version < '2.7'",
98    ],
99    extras_require={
100        'docs': ["sphinx>=1.2"],
101        'develop': [
102            "coverage >= 4.4",
103            "pytest <  5.0; python_version <  '3.0'", # >= 4.2
104            "pytest >= 5.0; python_version >= '3.0'",
105            "pytest-html >= 1.19.0",
106            "pytest-cov",
107            "tox >= 2.8",
108        ],
109    },
110
111    test_suite = "tests",
112    test_loader = "setuptools.command.test:ScanningLoader",
113    zip_safe = True,
114
115    classifiers = [
116        "Development Status :: 4 - Beta",
117        "Environment :: Console",
118        "Environment :: Web Environment",
119        "Intended Audience :: Developers",
120        "Operating System :: OS Independent",
121        "Programming Language :: Python :: 2.7",
122        "Programming Language :: Python :: 3.2",
123        "Programming Language :: Python :: 3.3",
124        "Programming Language :: Python :: 3.4",
125        "Programming Language :: Python :: 3.5",
126        "Programming Language :: Python :: 3.6",
127        "Programming Language :: Python :: 3.7",
128        "Programming Language :: Python :: 3.8",
129        "Programming Language :: Python :: Implementation :: CPython",
130        "Programming Language :: Python :: Implementation :: PyPy",
131        "Topic :: Software Development :: Code Generators",
132        "Topic :: Software Development :: Libraries :: Python Modules",
133        "License :: OSI Approved :: BSD License",
134    ],
135    platforms = ['any'],
136    **extra
137)
138