2015-01-27 16:53:17 +00:00
|
|
|
import codecs
|
|
|
|
import os
|
|
|
|
import re
|
|
|
|
|
2017-11-26 21:18:07 +00:00
|
|
|
from setuptools import find_packages, setup
|
2015-01-27 16:53:17 +00:00
|
|
|
|
|
|
|
|
2015-09-22 12:22:21 +00:00
|
|
|
###############################################################################
|
|
|
|
|
2015-02-21 13:08:36 +00:00
|
|
|
NAME = "attrs"
|
2015-10-18 10:15:06 +00:00
|
|
|
PACKAGES = find_packages(where="src")
|
2015-10-16 13:09:28 +00:00
|
|
|
META_PATH = os.path.join("src", "attr", "__init__.py")
|
2015-09-22 12:22:21 +00:00
|
|
|
KEYWORDS = ["class", "attribute", "boilerplate"]
|
2018-06-23 09:50:49 +00:00
|
|
|
PROJECT_URLS = {
|
2018-08-20 04:47:37 +00:00
|
|
|
"Documentation": "https://www.attrs.org/",
|
2018-06-23 09:50:49 +00:00
|
|
|
"Bug Tracker": "https://github.com/python-attrs/attrs/issues",
|
|
|
|
"Source Code": "https://github.com/python-attrs/attrs",
|
|
|
|
}
|
2015-09-22 12:22:21 +00:00
|
|
|
CLASSIFIERS = [
|
|
|
|
"Development Status :: 5 - Production/Stable",
|
|
|
|
"Intended Audience :: Developers",
|
|
|
|
"Natural Language :: English",
|
|
|
|
"License :: OSI Approved :: MIT License",
|
|
|
|
"Operating System :: OS Independent",
|
|
|
|
"Programming Language :: Python",
|
|
|
|
"Programming Language :: Python :: 2",
|
|
|
|
"Programming Language :: Python :: 2.7",
|
|
|
|
"Programming Language :: Python :: 3",
|
|
|
|
"Programming Language :: Python :: 3.5",
|
2017-06-01 11:12:19 +00:00
|
|
|
"Programming Language :: Python :: 3.6",
|
2018-02-05 11:40:24 +00:00
|
|
|
"Programming Language :: Python :: 3.7",
|
2019-10-02 15:07:02 +00:00
|
|
|
"Programming Language :: Python :: 3.8",
|
2020-08-24 07:26:22 +00:00
|
|
|
"Programming Language :: Python :: 3.9",
|
2015-09-22 12:22:21 +00:00
|
|
|
"Programming Language :: Python :: Implementation :: CPython",
|
|
|
|
"Programming Language :: Python :: Implementation :: PyPy",
|
|
|
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
|
|
]
|
|
|
|
INSTALL_REQUIRES = []
|
2017-12-29 15:11:47 +00:00
|
|
|
EXTRAS_REQUIRE = {
|
2020-03-08 06:30:03 +00:00
|
|
|
"docs": ["sphinx", "sphinx-rtd-theme", "zope.interface"],
|
2017-12-29 15:11:47 +00:00
|
|
|
"tests": [
|
2020-01-09 11:34:38 +00:00
|
|
|
# 5.0 introduced toml; parallel was broken until 5.0.2
|
|
|
|
"coverage[toml]>=5.0.2",
|
2017-12-29 15:11:47 +00:00
|
|
|
"hypothesis",
|
|
|
|
"pympler",
|
2019-03-07 08:17:33 +00:00
|
|
|
"pytest>=4.3.0", # 4.3.0 dropped last use of `convert`
|
2017-12-29 15:11:47 +00:00
|
|
|
"six",
|
|
|
|
"zope.interface",
|
|
|
|
],
|
|
|
|
}
|
2018-06-10 17:40:07 +00:00
|
|
|
EXTRAS_REQUIRE["dev"] = (
|
|
|
|
EXTRAS_REQUIRE["tests"] + EXTRAS_REQUIRE["docs"] + ["pre-commit"]
|
|
|
|
)
|
2015-02-21 13:08:36 +00:00
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
HERE = os.path.abspath(os.path.dirname(__file__))
|
|
|
|
|
|
|
|
|
2015-01-27 16:53:17 +00:00
|
|
|
def read(*parts):
|
|
|
|
"""
|
2020-06-27 12:43:38 +00:00
|
|
|
Build an absolute path from *parts* and return the contents of the
|
2015-01-27 16:53:17 +00:00
|
|
|
resulting file. Assume UTF-8 encoding.
|
|
|
|
"""
|
2015-02-21 13:08:36 +00:00
|
|
|
with codecs.open(os.path.join(HERE, *parts), "rb", "utf-8") as f:
|
2015-01-27 16:53:17 +00:00
|
|
|
return f.read()
|
|
|
|
|
|
|
|
|
2015-02-21 13:08:36 +00:00
|
|
|
META_FILE = read(META_PATH)
|
|
|
|
|
|
|
|
|
|
|
|
def find_meta(meta):
|
2015-01-27 16:53:17 +00:00
|
|
|
"""
|
2015-02-21 13:08:36 +00:00
|
|
|
Extract __*meta*__ from META_FILE.
|
2015-01-27 16:53:17 +00:00
|
|
|
"""
|
2015-02-21 13:08:36 +00:00
|
|
|
meta_match = re.search(
|
2018-06-10 17:40:07 +00:00
|
|
|
r"^__{meta}__ = ['\"]([^'\"]*)['\"]".format(meta=meta), META_FILE, re.M
|
2015-02-21 13:08:36 +00:00
|
|
|
)
|
|
|
|
if meta_match:
|
|
|
|
return meta_match.group(1)
|
|
|
|
raise RuntimeError("Unable to find __{meta}__ string.".format(meta=meta))
|
2015-01-27 16:53:17 +00:00
|
|
|
|
|
|
|
|
2016-05-23 11:16:53 +00:00
|
|
|
VERSION = find_meta("version")
|
2018-06-23 09:50:49 +00:00
|
|
|
URL = find_meta("url")
|
2016-02-20 08:34:45 +00:00
|
|
|
LONG = (
|
2018-06-10 17:40:07 +00:00
|
|
|
read("README.rst")
|
|
|
|
+ "\n\n"
|
|
|
|
+ "Release Information\n"
|
|
|
|
+ "===================\n\n"
|
|
|
|
+ re.search(
|
2019-08-19 18:55:46 +00:00
|
|
|
r"(\d+.\d.\d \(.*?\)\r?\n.*?)\r?\n\r?\n\r?\n----\r?\n\r?\n\r?\n",
|
2018-10-24 10:13:44 +00:00
|
|
|
read("CHANGELOG.rst"),
|
|
|
|
re.S,
|
2018-06-10 17:40:07 +00:00
|
|
|
).group(1)
|
|
|
|
+ "\n\n`Full changelog "
|
2018-06-23 09:50:49 +00:00
|
|
|
+ "<{url}en/stable/changelog.html>`_.\n\n".format(url=URL)
|
2018-06-10 17:40:07 +00:00
|
|
|
+ read("AUTHORS.rst")
|
2016-02-20 08:34:45 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2015-01-27 16:53:17 +00:00
|
|
|
if __name__ == "__main__":
|
|
|
|
setup(
|
2015-02-21 13:08:36 +00:00
|
|
|
name=NAME,
|
|
|
|
description=find_meta("description"),
|
|
|
|
license=find_meta("license"),
|
2018-06-23 09:50:49 +00:00
|
|
|
url=URL,
|
|
|
|
project_urls=PROJECT_URLS,
|
2016-05-23 11:16:53 +00:00
|
|
|
version=VERSION,
|
2015-02-21 13:08:36 +00:00
|
|
|
author=find_meta("author"),
|
|
|
|
author_email=find_meta("email"),
|
|
|
|
maintainer=find_meta("author"),
|
|
|
|
maintainer_email=find_meta("email"),
|
2015-09-22 12:22:21 +00:00
|
|
|
keywords=KEYWORDS,
|
2016-02-20 08:34:45 +00:00
|
|
|
long_description=LONG,
|
2019-03-04 19:25:26 +00:00
|
|
|
long_description_content_type="text/x-rst",
|
2015-09-22 12:22:21 +00:00
|
|
|
packages=PACKAGES,
|
2015-10-16 13:09:28 +00:00
|
|
|
package_dir={"": "src"},
|
2018-10-25 10:50:37 +00:00
|
|
|
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
|
2015-02-21 13:08:36 +00:00
|
|
|
zip_safe=False,
|
2015-09-22 12:22:21 +00:00
|
|
|
classifiers=CLASSIFIERS,
|
|
|
|
install_requires=INSTALL_REQUIRES,
|
2017-12-29 15:11:47 +00:00
|
|
|
extras_require=EXTRAS_REQUIRE,
|
2018-07-12 10:19:24 +00:00
|
|
|
include_package_data=True,
|
2019-10-16 18:04:20 +00:00
|
|
|
options={"bdist_wheel": {"universal": "1"}},
|
2015-01-27 16:53:17 +00:00
|
|
|
)
|