attrs/setup.py

113 lines
3.1 KiB
Python
Raw Normal View History

2015-01-27 16:53:17 +00:00
import codecs
import os
import re
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")
META_PATH = os.path.join("src", "attr", "__init__.py")
2015-09-22 12:22:21 +00:00
KEYWORDS = ["class", "attribute", "boilerplate"]
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.4",
"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",
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 = []
EXTRAS_REQUIRE = {
2018-06-10 17:40:07 +00:00
"docs": ["sphinx", "zope.interface"],
"tests": [
"coverage",
"hypothesis",
"pympler",
"pytest",
"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):
"""
Build an absolute path from *parts* and and return the contents of the
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
VERSION = find_meta("version")
2016-02-20 08:34:45 +00:00
URI = find_meta("uri")
LONG = (
2018-06-10 17:40:07 +00:00
read("README.rst")
+ "\n\n"
+ "Release Information\n"
+ "===================\n\n"
+ re.search(
"(\d+.\d.\d \(.*?\)\n.*?)\n\n\n----\n\n\n", read("CHANGELOG.rst"), re.S
).group(1)
+ "\n\n`Full changelog "
+ "<{uri}en/stable/changelog.html>`_.\n\n".format(uri=URI)
+ 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"),
2016-02-20 08:34:45 +00:00
url=URI,
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,
2015-09-22 12:22:21 +00:00
packages=PACKAGES,
package_dir={"": "src"},
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,
extras_require=EXTRAS_REQUIRE,
2015-01-27 16:53:17 +00:00
)